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

Unified Diff: chrome/browser/themes/browser_theme_pack.h

Issue 16977007: Only load theme images for the scale factors that use them (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: delay GetRawMemory Created 7 years, 6 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: chrome/browser/themes/browser_theme_pack.h
diff --git a/chrome/browser/themes/browser_theme_pack.h b/chrome/browser/themes/browser_theme_pack.h
index 8eca0b402abdc0d49db676e329e965a263151066..e66a388c1d5d2e662a68b14179ca05e57c355793 100644
--- a/chrome/browser/themes/browser_theme_pack.h
+++ b/chrome/browser/themes/browser_theme_pack.h
@@ -90,6 +90,13 @@ class BrowserThemePack : public base::RefCountedThreadSafe<
base::RefCountedMemory* GetRawData(int id,
ui::ScaleFactor scale_factor) const;
+ // Returns the raw PNG encoded data for IDR_THEME_NTP_* for the available
+ // scale factor with the highest scale if available, otherwise NULL.
+ // The corresponding scale factor is returned in |scale_factor|.
+ base::RefCountedMemory* GetRawDataWithHighestScale(
+ int id,
+ ui::ScaleFactor* scale_factor) const;
+
// Returns the set of image idrs which can be overwritten by a user provided
// theme.
static void GetThemeableImageIDRs(std::set<int>* result);
@@ -267,6 +274,9 @@ class BrowserThemePack : public base::RefCountedThreadSafe<
// The scale factors represented by the images in the theme pack.
std::vector<ui::ScaleFactor> scale_factors_;
+ // The scale factors ordered by scale from lowest to highest.
+ std::vector<ui::ScaleFactor> scale_factors_ordered_by_scale_;
+
// References to raw PNG data. This map isn't touched when |data_pack_| is
// non-NULL; |image_memory_| is only filled during BuildFromExtension(). Any
// image data that needs to be written to the DataPack during WriteToDisk()
@@ -284,6 +294,8 @@ class BrowserThemePack : public base::RefCountedThreadSafe<
// or vice versa.
ImageCache images_on_file_thread_;
+ base::WeakPtrFactory<BrowserThemePack> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(BrowserThemePack);
};
« no previous file with comments | « no previous file | chrome/browser/themes/browser_theme_pack.cc » ('j') | chrome/browser/themes/browser_theme_pack.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698