Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1655)

Unified Diff: app/resource_bundle_linux.cc

Issue 338027: Modify DataPacks so they can return RefCountedStaticMemory objects. (Closed)
Patch Set: Rewrite GetStaticMemory Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | app/resource_bundle_mac.mm » ('j') | base/data_pack.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/resource_bundle_linux.cc
diff --git a/app/resource_bundle_linux.cc b/app/resource_bundle_linux.cc
index 929a77f99338db92d8ecf32c450014adbe2d711b..2b2bc796993c57a5750321dbfc4cccd4abe1f169 100644
--- a/app/resource_bundle_linux.cc
+++ b/app/resource_bundle_linux.cc
@@ -121,18 +121,13 @@ void ResourceBundle::LoadThemeResources() {
RefCountedStaticMemory* ResourceBundle::LoadResourceBytes(
DataHandle module, int resource_id) {
DCHECK(module);
- base::StringPiece bytes;
- if (!module->Get(resource_id, &bytes))
- return NULL;
-
- return new RefCountedStaticMemory(
- reinterpret_cast<const unsigned char*>(bytes.data()), bytes.length());
+ return module->GetStaticMemory(resource_id);
}
base::StringPiece ResourceBundle::GetRawDataResource(int resource_id) {
DCHECK(resources_data_);
base::StringPiece data;
- if (!resources_data_->Get(resource_id, &data))
+ if (!resources_data_->GetStringPiece(resource_id, &data))
return base::StringPiece();
return data;
}
@@ -146,7 +141,7 @@ string16 ResourceBundle::GetLocalizedString(int message_id) {
}
base::StringPiece data;
- if (!locale_resources_data_->Get(message_id, &data)) {
+ if (!locale_resources_data_->GetStringPiece(message_id, &data)) {
// Fall back on the main data pack (shouldn't be any strings here except in
// unittests).
data = GetRawDataResource(message_id);
« no previous file with comments | « no previous file | app/resource_bundle_mac.mm » ('j') | base/data_pack.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698