refactor: mmap asar files (#24470)

This commit is contained in:
Jeremy Rose 2020-08-04 11:48:04 -07:00 committed by GitHub
parent 15ee34a1f2
commit 01a2e23194
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 133 additions and 114 deletions

View file

@ -11,6 +11,7 @@
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/files/memory_mapped_file.h"
namespace base {
class DictionaryValue;
@ -61,16 +62,13 @@ class Archive {
// For unpacked file, this method will return its real path.
bool CopyFileOut(const base::FilePath& path, base::FilePath* out);
// Returns the file's fd.
int GetFD() const;
base::MemoryMappedFile* file() { return &file_; }
base::FilePath path() const { return path_; }
base::DictionaryValue* header() const { return header_.get(); }
private:
base::FilePath path_;
base::File file_;
int fd_ = -1;
base::MemoryMappedFile file_;
uint32_t header_size_ = 0;
std::unique_ptr<base::DictionaryValue> header_;