summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-29 20:32:56 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-29 20:32:56 +0000
commit5ef980a5d66feacec7bbdc9e3972bc56d7f3e420 (patch)
treed1ea34cedc92fbed4d205e28c4ab106ea8351e4d /chrome
parent6df3ebfbab4615970e363ad194ad279b5bdd1336 (diff)
downloadchromium_src-5ef980a5d66feacec7bbdc9e3972bc56d7f3e420.zip
chromium_src-5ef980a5d66feacec7bbdc9e3972bc56d7f3e420.tar.gz
chromium_src-5ef980a5d66feacec7bbdc9e3972bc56d7f3e420.tar.bz2
BrowserThemePacks can do IO during shutdown, so delete them on the FILE thread.
BUG=61135 TEST=none Review URL: http://codereview.chromium.org/4213005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64478 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/themes/browser_theme_pack.h14
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);