summaryrefslogtreecommitdiffstats
path: root/base/data_pack.cc
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-27 20:45:08 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-27 20:45:08 +0000
commitd8fef52b071be812fd8a0f7ebea6c577bdb38592 (patch)
tree3ad1d267a3d978e4e68c0f3c49c3781e155e1a3f /base/data_pack.cc
parent19e0ff7bf0b74a121d52a75b1d883222d266b789 (diff)
downloadchromium_src-d8fef52b071be812fd8a0f7ebea6c577bdb38592.zip
chromium_src-d8fef52b071be812fd8a0f7ebea6c577bdb38592.tar.gz
chromium_src-d8fef52b071be812fd8a0f7ebea6c577bdb38592.tar.bz2
Modify DataPacks so they can return RefCountedStaticMemory objects.
(This is in preparation for a very large reworking of BrowserThemeProvider). BUG=http://crbug.com/21121 Review URL: http://codereview.chromium.org/338027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30241 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/data_pack.cc')
-rw-r--r--base/data_pack.cc11
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