diff options
Diffstat (limited to 'base/data_pack.cc')
-rw-r--r-- | base/data_pack.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/base/data_pack.cc b/base/data_pack.cc index 46f3cb4..27054d3 100644 --- a/base/data_pack.cc +++ b/base/data_pack.cc @@ -89,7 +89,7 @@ bool DataPack::Load(const FilePath& path) { return true; } -bool DataPack::Get(uint32_t resource_id, StringPiece* data) { +bool DataPack::GetStringPiece(uint32_t resource_id, StringPiece* data) { // It won't be hard to make this endian-agnostic, but it's not worth // bothering to do right now. #if defined(__BYTE_ORDER) @@ -113,4 +113,13 @@ bool DataPack::Get(uint32_t resource_id, StringPiece* data) { return true; } +RefCountedStaticMemory* DataPack::GetStaticMemory(uint32_t resource_id) { + base::StringPiece piece; + if (!GetStringPiece(resource_id, &piece)) + return NULL; + + return new RefCountedStaticMemory( + reinterpret_cast<const unsigned char*>(piece.data()), piece.length()); +} + } // namespace base |