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

Unified Diff: chrome/browser/ui/libgtk2ui/gtk2_ui.cc

Issue 1869693002: Theme suppliers: Avoid all Image copying. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 8 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 | « chrome/browser/ui/libgtk2ui/gtk2_ui.h ('k') | ui/views/linux_ui/linux_ui.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/libgtk2ui/gtk2_ui.cc
diff --git a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
index 433fc9d4d83d0bfde30aa3cfcb4774426a32410d..f1a55e5e788ac9e36c6b91cb08e041501a067580 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
+++ b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
@@ -524,7 +524,7 @@ Gtk2UI::~Gtk2UI() {
ClearAllThemeData();
}
-gfx::Image Gtk2UI::GetThemeImageNamed(int id) const {
+const gfx::Image& Gtk2UI::GetThemeImageNamed(int id) const {
// Try to get our cached version:
ImageCache::const_iterator it = gtk_images_.find(id);
if (it != gtk_images_.end())
@@ -538,8 +538,8 @@ gfx::Image Gtk2UI::GetThemeImageNamed(int id) const {
image = gfx::Image::CreateFrom1xBitmap(bitmap);
}
- gtk_images_[id] = image;
- return image;
+ auto result = gtk_images_.insert(std::make_pair(id, image));
+ return result.first->second;
}
bool Gtk2UI::GetTint(int id, color_utils::HSL* tint) const {
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_ui.h ('k') | ui/views/linux_ui/linux_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698