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

Side by Side Diff: chrome/browser/themes/theme_service.cc

Issue 747013003: Various optimizations to reduce the number of temporary allocations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added back calls to c_str that were removed by mistake. Created 6 years 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/themes/theme_properties.cc ('k') | chrome/browser/ui/prefs/prefs_tab_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/themes/theme_service.h" 5 #include "chrome/browser/themes/theme_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ref_counted_memory.h" 10 #include "base/memory/ref_counted_memory.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 if (HasCustomImage(IDR_THEME_FRAME)) 229 if (HasCustomImage(IDR_THEME_FRAME))
230 return false; 230 return false;
231 #if defined(OS_WIN) 231 #if defined(OS_WIN)
232 return ui::win::IsAeroGlassEnabled(); 232 return ui::win::IsAeroGlassEnabled();
233 #else 233 #else
234 return false; 234 return false;
235 #endif 235 #endif
236 } 236 }
237 237
238 bool ThemeService::HasCustomImage(int id) const { 238 bool ThemeService::HasCustomImage(int id) const {
239 if (!Properties::IsThemeableImage(id)) 239 return BrowserThemePack::IsPersistentImageID(id) &&
240 return false; 240 theme_supplier_ && theme_supplier_->HasCustomImage(id);
241
242 if (theme_supplier_.get())
243 return theme_supplier_->HasCustomImage(id);
244
245 return false;
246 } 241 }
247 242
248 base::RefCountedMemory* ThemeService::GetRawData( 243 base::RefCountedMemory* ThemeService::GetRawData(
249 int id, 244 int id,
250 ui::ScaleFactor scale_factor) const { 245 ui::ScaleFactor scale_factor) const {
251 // Check to see whether we should substitute some images. 246 // Check to see whether we should substitute some images.
252 int ntp_alternate = GetDisplayProperty(Properties::NTP_LOGO_ALTERNATE); 247 int ntp_alternate = GetDisplayProperty(Properties::NTP_LOGO_ALTERNATE);
253 if (id == IDR_PRODUCT_LOGO && ntp_alternate != 0) 248 if (id == IDR_PRODUCT_LOGO && ntp_alternate != 0)
254 id = IDR_PRODUCT_LOGO_WHITE; 249 id = IDR_PRODUCT_LOGO_WHITE;
255 250
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 void ThemeService::OnInfobarDestroyed() { 629 void ThemeService::OnInfobarDestroyed() {
635 number_of_infobars_--; 630 number_of_infobars_--;
636 631
637 if (number_of_infobars_ == 0) 632 if (number_of_infobars_ == 0)
638 RemoveUnusedThemes(false); 633 RemoveUnusedThemes(false);
639 } 634 }
640 635
641 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { 636 ThemeSyncableService* ThemeService::GetThemeSyncableService() const {
642 return theme_syncable_service_.get(); 637 return theme_syncable_service_.get();
643 } 638 }
OLDNEW
« no previous file with comments | « chrome/browser/themes/theme_properties.cc ('k') | chrome/browser/ui/prefs/prefs_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698