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

Unified Diff: app/resource_bundle_win.cc

Issue 288005: First fix to minimize copying of image data. (Closed)
Patch Set: Modify gyp 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
Index: app/resource_bundle_win.cc
diff --git a/app/resource_bundle_win.cc b/app/resource_bundle_win.cc
index fc9e36027f78dcb24d5e209b5fc13f870c2cd3c5..0c25c479310423af757110eed318a43fdfbd5b84 100644
--- a/app/resource_bundle_win.cc
+++ b/app/resource_bundle_win.cc
@@ -85,20 +85,17 @@ void ResourceBundle::LoadThemeResources() {
DCHECK(theme_data_ != NULL) << "unable to load " << theme_data_path.value();
}
-/* static */
-bool ResourceBundle::LoadResourceBytes(
- DataHandle module,
- int resource_id,
- std::vector<unsigned char>* bytes) {
+// static
+RefCountedStaticMemory* ResourceBundle::LoadResourceBytes(
+ DataHandle module, int resource_id) {
void* data_ptr;
size_t data_size;
if (base::GetDataResourceFromModule(module, resource_id, &data_ptr,
&data_size)) {
- bytes->resize(data_size);
- memcpy(&(bytes->front()), data_ptr, data_size);
- return true;
+ return new RefCountedStaticMemory(
+ reinterpret_cast<const unsigned char*>(data_ptr), data_size);
} else {
- return false;
+ return NULL;
}
}
« no previous file with comments | « app/resource_bundle_mac.mm ('k') | app/theme_provider.h » ('j') | base/ref_counted_memory.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698