diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/themes/browser_theme_pack.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/chrome/browser/themes/browser_theme_pack.h b/chrome/browser/themes/browser_theme_pack.h index 85d27af..5fa55e2 100644 --- a/chrome/browser/themes/browser_theme_pack.h +++ b/chrome/browser/themes/browser_theme_pack.h @@ -13,6 +13,7 @@ #include "base/scoped_ptr.h" #include "base/ref_counted.h" #include "gfx/color_utils.h" +#include "chrome/browser/browser_thread.h" #include "chrome/common/extensions/extension.h" namespace base { @@ -35,10 +36,13 @@ class RefCountedMemory; // UI thread that consumes a BrowserThemePack. There is no locking; thread // safety between the writing thread and the UI thread is ensured by having the // data be immutable. -class BrowserThemePack : public base::RefCountedThreadSafe<BrowserThemePack> { +// +// BrowserThemePacks are always deleted on the file thread because in the +// common case, they are backed by mmapped data and the unmmapping operation +// will trip our IO on the UI thread detector. +class BrowserThemePack : public base::RefCountedThreadSafe< + BrowserThemePack, BrowserThread::DeleteOnFileThread> { public: - ~BrowserThemePack(); - // 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. @@ -79,6 +83,8 @@ class BrowserThemePack : public base::RefCountedThreadSafe<BrowserThemePack> { bool HasCustomImage(int id) const; private: + friend struct BrowserThread::DeleteOnThread<BrowserThread::FILE>; + friend class DeleteTask<BrowserThemePack>; friend class BrowserThemePackTest; // Cached images. We cache all retrieved and generated bitmaps and keep @@ -98,6 +104,8 @@ class BrowserThemePack : public base::RefCountedThreadSafe<BrowserThemePack> { // Default. Everything is empty. BrowserThemePack(); + virtual ~BrowserThemePack(); + // Builds a header ready to write to disk. void BuildHeader(Extension* extension); |