diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-24 22:32:16 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-24 22:32:16 +0000 |
commit | 26d7ca2a3b70f96e0571295b0919be152598beaa (patch) | |
tree | 80ff7fe9878f8eb305f73f7d4d096d64a124a2d8 /chrome/browser/browser_theme_provider.cc | |
parent | 85e67bff2224246e3d991acbf9492d222ab34d05 (diff) | |
download | chromium_src-26d7ca2a3b70f96e0571295b0919be152598beaa.zip chromium_src-26d7ca2a3b70f96e0571295b0919be152598beaa.tar.gz chromium_src-26d7ca2a3b70f96e0571295b0919be152598beaa.tar.bz2 |
Move some theme images to being serviced on the IO thread. For
Linux Release builds on my machine, all the chrome://theme/ image
requests block for 300-400ms during browser startup (it's faster
after startup). Something is blocking the UI thread so move
image requests that aren't themed off the UI thread. This is
safe to do because ResourceBundle is thread safe.
I still see chrome://theme/theme_ntp_attribution and
chrome://theme/theme_ntp_background blocking so I will look
into those next (I think with the default theme, they shouldn't
be loaded at all).
Review URL: http://codereview.chromium.org/440009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32985 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_theme_provider.cc')
-rw-r--r-- | chrome/browser/browser_theme_provider.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/chrome/browser/browser_theme_provider.cc b/chrome/browser/browser_theme_provider.cc index 7f598a7..6bc9e97 100644 --- a/chrome/browser/browser_theme_provider.cc +++ b/chrome/browser/browser_theme_provider.cc @@ -223,7 +223,6 @@ bool HasThemeableImage(int themeable_image_id) { } - class WriteImagesToDiskTask : public Task { public: WriteImagesToDiskTask( @@ -270,10 +269,16 @@ class WriteImagesToDiskTask : public Task { } // namespace +bool BrowserThemeProvider::IsThemeableImage(int resource_id) { + return HasThemeableImage(resource_id); +} + BrowserThemeProvider::BrowserThemeProvider() : rb_(ResourceBundle::GetSharedInstance()), profile_(NULL), process_images_(false) { + // Initialize the themeable image map so we can use it on other threads. + HasThemeableImage(0); resource_names_[IDR_THEME_FRAME] = "theme_frame"; resource_names_[IDR_THEME_FRAME_INACTIVE] = "theme_frame_inactive"; resource_names_[IDR_THEME_FRAME_OVERLAY] = "theme_frame_overlay"; |