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

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

Issue 2919953002: Revert of Unpack theme data from extensions off of UI thread. (Closed)
Patch Set: Created 3 years, 7 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 d527e97342d83390848ffa9430e6763c5736596c..cc975cc1ce193ac82335a12617ad942aebb6f1dd 100644
--- a/chrome/browser/themes/browser_theme_pack.h
+++ b/chrome/browser/themes/browser_theme_pack.h
@@ -53,11 +53,11 @@
// will trip our IO on the UI thread detector.
class BrowserThemePack : public CustomThemeSupplier {
public:
- // Builds the theme from |extension| into |pack|. This may be done on a
- // separate thread as it takes so long. This can fail in the case where the
- // theme has invalid data, in which case |pack->is_valid()| will be false.
- static void BuildFromExtension(const extensions::Extension* extension,
- scoped_refptr<BrowserThemePack> pack);
+ // Builds the theme pack from all data from |extension|. This is often done
+ // on a separate thread as it takes so long. This can fail and return NULL in
+ // the case where the theme has invalid data.
+ static scoped_refptr<BrowserThemePack> BuildFromExtension(
+ const extensions::Extension* extension);
// Builds the theme pack from a previously performed WriteToDisk(). This
// operation should be relatively fast, as it should be an mmap() and some
@@ -68,11 +68,6 @@
// Returns whether the specified identifier is one of the images we persist
// in the data pack.
static bool IsPersistentImageID(int id);
-
- // Default. Everything is empty.
- BrowserThemePack();
-
- bool is_valid() const { return is_valid_; }
// Builds a data pack on disk at |path| for future quick loading by
// BuildFromDataPack(). Often (but not always) called from the file thread;
@@ -108,6 +103,9 @@
// Maps image ids to maps of scale factors to file paths.
typedef std::map<int, ScaleFactorToFileMap> FilePathMap;
+ // Default. Everything is empty.
+ BrowserThemePack();
+
~BrowserThemePack() override;
// Builds a header ready to write to disk.
@@ -219,7 +217,7 @@
// theme_id without NULL terminator.
uint8_t theme_id[16];
- }* header_ = nullptr;
+ } *header_;
// The remaining structs represent individual entries in an array. For the
// following three structs, BrowserThemePack will either allocate an array or
@@ -229,21 +227,21 @@
double h;
double s;
double l;
- }* tints_ = nullptr;
+ } *tints_;
struct ColorPair {
int32_t id;
SkColor color;
- }* colors_ = nullptr;
+ } *colors_;
struct DisplayPropertyPair {
int32_t id;
int32_t property;
- }* display_properties_ = nullptr;
+ } *display_properties_;
// A list of included source images. A pointer to a -1 terminated array of
// our persistent IDs.
- int* source_images_ = nullptr;
+ int* source_images_;
#pragma pack(pop)
// The scale factors represented by the images in the theme pack.
@@ -256,8 +254,9 @@
RawImages image_memory_;
// Loaded images. These are loaded from |image_memory_|, from |data_pack_|,
- // and by BuildFromExtension().
- ImageCache images_;
+ // and by BuildFromExtension(). These images should only be accessed on the UI
+ // thread.
+ ImageCache images_on_ui_thread_;
// Cache of images created in BuildFromExtension(). Once the theme pack is
// created, this cache should only be accessed on the file thread. There
@@ -265,10 +264,6 @@
// or vice versa.
ImageCache images_on_file_thread_;
- // Whether the theme pack has been succesfully initialized and is ready to
- // use.
- bool is_valid_ = false;
-
DISALLOW_COPY_AND_ASSIGN(BrowserThemePack);
};
« no previous file with comments | « chrome/browser/sync/test/integration/two_client_themes_sync_test.cc ('k') | chrome/browser/themes/browser_theme_pack.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698