summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-23 18:31:25 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-23 18:31:25 +0000
commit156ed27bc42a66a694e243f3ecb0ad80f0c83351 (patch)
tree999d33767f2c2a2b41a97daa2c1ea65a7045f10a /chrome/test
parenta1dc714c599af4971dfe74a71c73a2be0ff3033b (diff)
downloadchromium_src-156ed27bc42a66a694e243f3ecb0ad80f0c83351.zip
chromium_src-156ed27bc42a66a694e243f3ecb0ad80f0c83351.tar.gz
chromium_src-156ed27bc42a66a694e243f3ecb0ad80f0c83351.tar.bz2
Take 2 at moving NTP CSS resources into the NTP resource cache.
Moving the HTML to the cache saved 8ms on New Tab Warm on Windows, maybe we can shave a few more ms off by moving the CSS. The last change had a regression on the mac new tab perf, so I suspect it's the extra round trip to the UI thread when trying to load the CSS (the UI thread is probably just busy at that time). Instead, I'm moving the generation of the CSS to the time the object is constructed, rather than when the resource is requested. This is like the code before, except sometimes we'll hit the cache. BUG=26228 Review URL: http://codereview.chromium.org/427003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32815 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/testing_profile.cc7
-rw-r--r--chrome/test/testing_profile.h4
2 files changed, 10 insertions, 1 deletions
diff --git a/chrome/test/testing_profile.cc b/chrome/test/testing_profile.cc
index b718773..39e847a 100644
--- a/chrome/test/testing_profile.cc
+++ b/chrome/test/testing_profile.cc
@@ -7,6 +7,7 @@
#include "build/build_config.h"
#include "base/string_util.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
+#include "chrome/browser/dom_ui/ntp_resource_cache.h"
#include "chrome/browser/history/history_backend.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/common/chrome_constants.h"
@@ -201,6 +202,12 @@ void TestingProfile::InitThemes() {
}
}
+NTPResourceCache* TestingProfile::GetNTPResourceCache() {
+ if (!ntp_resource_cache_.get())
+ ntp_resource_cache_.reset(new NTPResourceCache(this));
+ return ntp_resource_cache_.get();
+}
+
void TestingProfile::BlockUntilHistoryProcessesPendingRequests() {
DCHECK(history_service_.get());
DCHECK(MessageLoop::current());
diff --git a/chrome/test/testing_profile.h b/chrome/test/testing_profile.h
index 677bb7e..37c35ea 100644
--- a/chrome/test/testing_profile.h
+++ b/chrome/test/testing_profile.h
@@ -182,7 +182,7 @@ class TestingProfile : public Profile {
virtual void MarkAsCleanShutdown() {}
virtual void InitExtensions() {}
virtual void InitWebResources() {}
- virtual NTPResourceCache* GetNTPResourceCache() { return NULL; }
+ virtual NTPResourceCache* GetNTPResourceCache();
virtual DesktopNotificationService* GetDesktopNotificationService() {
return NULL;
}
@@ -220,6 +220,8 @@ class TestingProfile : public Profile {
// The TemplateURLFetcher. Only created if CreateTemplateURLModel is invoked.
scoped_ptr<TemplateURLModel> template_url_model_;
+ scoped_ptr<NTPResourceCache> ntp_resource_cache_;
+
// The SessionService. Defaults to NULL, but can be set using the setter.
scoped_refptr<SessionService> session_service_;