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

Unified Diff: chrome/browser/dom_ui/dom_ui_theme_source.h

Issue 179069: Improve New Tab Page load performance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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/dom_ui/dom_ui_theme_source.h
===================================================================
--- chrome/browser/dom_ui/dom_ui_theme_source.h (revision 25173)
+++ chrome/browser/dom_ui/dom_ui_theme_source.h (working copy)
@@ -24,12 +24,20 @@
virtual void SendResponse(int request_id, RefCountedBytes* data);
+ virtual MessageLoop* MessageLoopForRequestPath(const std::string& path) const;
+
private:
- // Generate and send the CSS for the new tab.
- void SendNewTabCSS(int request_id);
+ // Populate new_tab_css_ and new_incognito_tab_css. These must be called
+ // from the UI thread because they involve profile and theme access.
+ //
+ // A new DOMUIThemeSource object is used for each new tab page instance
+ // and each reload of an existing new tab page, so there is no concern about
+ // cached data becoming stale.
+ void InitNewTabCSS();
+ void InitNewIncognitoTabCSS();
- // Generate and send the CSS for the new incognito tab.
- void SendNewIncognitoTabCSS(int request_id);
+ // Send the CSS for the new tab or the new incognito tab.
+ void SendNewTabCSS(int request_id, const std::string& css_string);
// Fetch and send the theme bitmap.
void SendThemeBitmap(int request_id, int resource_id);
@@ -42,6 +50,11 @@
// masks in browser_theme_provider.h).
std::string GetNewTabBackgroundTilingCSS();
+ // The content to be served by SendNewTabCSS, stored by InitNewTabCSS and
+ // InitNewIncognitoTabCSS.
+ std::string new_tab_css_;
+ std::string new_incognito_tab_css_;
+
Profile* profile_;
DISALLOW_COPY_AND_ASSIGN(DOMUIThemeSource);
};

Powered by Google App Engine
This is Rietveld 408576698