Chromium Code Reviews| Index: ui/base/resource/data_pack.h |
| diff --git a/ui/base/resource/data_pack.h b/ui/base/resource/data_pack.h |
| index 46578186f23161a22b61e0924ad6a84d82d95c1b..7ceba7ebbfb64b15f596f5d9a9e14c17eb4b52a8 100644 |
| --- a/ui/base/resource/data_pack.h |
| +++ b/ui/base/resource/data_pack.h |
| @@ -50,6 +50,9 @@ class UI_DATA_PACK_EXPORT DataPack : public ResourceHandle { |
| bool LoadFromFileRegion(base::File file, |
| const base::MemoryMappedFile::Region& region); |
| + // Loads a pack file from |buffer|, returning false on error. |
| + bool LoadFromBuffer(base::StringPiece buffer); |
|
alex clarke (OOO till 29th)
2016/05/12 17:31:04
bikeshed: Should this be InitializeFromBuffer? Sa
altimin
2016/05/12 18:07:53
I don't think so — we already have LoadFromPath, L
|
| + |
| // Writes a pack file containing |resources| to |path|. If there are any |
| // text resources to be written, their encoding must already agree to the |
| // |textEncodingType| specified. If no text resources are present, please |
| @@ -75,11 +78,16 @@ class UI_DATA_PACK_EXPORT DataPack : public ResourceHandle { |
| #endif |
| private: |
| - // Does the actual loading of a pack file. Called by Load and LoadFromFile. |
| + // Does the actual loading of a pack file. |
| + // Called by Load and LoadFromFile and LoadFromBuffer. |
| bool LoadImpl(); |
| + void Clear(); |
| + |
| // The memory-mapped data. |
|
alex clarke (OOO till 29th)
2016/05/12 17:31:04
// The memory-mapped data. Might be null if initi
altimin
2016/05/12 18:07:53
Acknowledged.
|
| std::unique_ptr<base::MemoryMappedFile> mmap_; |
|
alex clarke (OOO till 29th)
2016/05/12 17:31:04
Not sure if this is overkill, but I would be tempt
altimin
2016/05/12 18:07:53
I thought about this and decided that's an overkil
|
| + size_t length_; |
| + const uint8_t* data_; |
| // Number of resources in the data. |
| size_t resource_count_; |