summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-24 22:32:16 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-24 22:32:16 +0000
commit26d7ca2a3b70f96e0571295b0919be152598beaa (patch)
tree80ff7fe9878f8eb305f73f7d4d096d64a124a2d8 /chrome/browser/dom_ui
parent85e67bff2224246e3d991acbf9492d222ab34d05 (diff)
downloadchromium_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/dom_ui')
-rw-r--r--chrome/browser/dom_ui/dom_ui_theme_source.cc21
1 files changed, 16 insertions, 5 deletions
diff --git a/chrome/browser/dom_ui/dom_ui_theme_source.cc b/chrome/browser/dom_ui/dom_ui_theme_source.cc
index 3640c40..9fa4f25 100644
--- a/chrome/browser/dom_ui/dom_ui_theme_source.cc
+++ b/chrome/browser/dom_ui/dom_ui_theme_source.cc
@@ -79,6 +79,11 @@ MessageLoop* DOMUIThemeSource::MessageLoopForRequestPath(
return NULL;
}
+ // If it's not a themeable image, we don't need to go to the UI thread.
+ int resource_id = ThemeResourcesUtil::GetId(uncached_path);
+ if (!BrowserThemeProvider::IsThemeableImage(resource_id))
+ return NULL;
+
return DataSource::MessageLoopForRequestPath(path);
}
@@ -86,10 +91,16 @@ MessageLoop* DOMUIThemeSource::MessageLoopForRequestPath(
// DOMUIThemeSource, private:
void DOMUIThemeSource::SendThemeBitmap(int request_id, int resource_id) {
- DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
- ThemeProvider* tp = profile_->GetThemeProvider();
- DCHECK(tp);
+ if (BrowserThemeProvider::IsThemeableImage(resource_id)) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
+ ThemeProvider* tp = profile_->GetThemeProvider();
+ DCHECK(tp);
- scoped_refptr<RefCountedMemory> image_data(tp->GetRawData(resource_id));
- SendResponse(request_id, image_data);
+ scoped_refptr<RefCountedMemory> image_data(tp->GetRawData(resource_id));
+ SendResponse(request_id, image_data);
+ } else {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
+ const ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ SendResponse(request_id, rb.LoadDataResourceBytes(resource_id));
+ }
}