Index: ui/base/resource/data_pack.h |
diff --git a/ui/base/resource/data_pack.h b/ui/base/resource/data_pack.h |
index 26b94c2b4b7c98670a8eb418f9c927a3c21f84bc..ba8d8bb212f68c32c7c954360f51fc840455b24b 100644 |
--- a/ui/base/resource/data_pack.h |
+++ b/ui/base/resource/data_pack.h |
@@ -33,6 +33,8 @@ enum ScaleFactor : int; |
class UI_DATA_PACK_EXPORT DataPack : public ResourceHandle { |
public: |
+ class DataSource; |
sky
2017/02/08 22:22:58
Move to private section.
altimin
2017/02/09 00:13:52
Done.
|
+ |
explicit DataPack(ui::ScaleFactor scale_factor); |
~DataPack() override; |
@@ -46,6 +48,10 @@ 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. |
+ // Data is not copied, |buffer| should stay alive during |DataPack| lifetime. |
+ bool LoadFromBuffer(base::StringPiece buffer); |
+ |
// 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 |
@@ -70,11 +76,11 @@ 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(); |
- // The memory-mapped data. |
- std::unique_ptr<base::MemoryMappedFile> mmap_; |
+ std::unique_ptr<DataSource> data_source_; |
// Number of resources in the data. |
size_t resource_count_; |