Keep archive's file opened in the archive's whole life time

This commit is contained in:
Cheng Zhao 2015-05-11 10:47:07 +08:00
parent f02cae1b0a
commit f8e1dfbbc6
4 changed files with 15 additions and 10 deletions

View file

@ -36,13 +36,12 @@ bool ScopedTemporaryFile::Init() {
return base::CreateTemporaryFile(&path_);
}
bool ScopedTemporaryFile::InitFromFile(const base::FilePath& path,
bool ScopedTemporaryFile::InitFromFile(base::File& src,
uint64 offset, uint64 size) {
if (!Init())
if (!src.IsValid())
return false;
base::File src(path, base::File::FLAG_OPEN | base::File::FLAG_READ);
if (!src.IsValid())
if (!Init())
return false;
std::vector<char> buf(size);