diff options
author | altimofeev@chromium.org <altimofeev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-13 11:27:06 +0000 |
---|---|---|
committer | altimofeev@chromium.org <altimofeev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-13 11:27:06 +0000 |
commit | 334c59d927639aaae464f76b082a893b9fdf6987 (patch) | |
tree | f3e0a7ef15974751cbbbb32e2d075dc27088179f /chrome/browser/memory_purger.cc | |
parent | c813df0195b2c96d2265ad767d4848dd13818211 (diff) | |
download | chromium_src-334c59d927639aaae464f76b082a893b9fdf6987.zip chromium_src-334c59d927639aaae464f76b082a893b9fdf6987.tar.gz chromium_src-334c59d927639aaae464f76b082a893b9fdf6987.tar.bz2 |
This CL implements alternative asynchronous methods for profile and preferences loading.
BUG=chromium-os:11104
TEST=UserProfileGotten (see "/tmp/login-times-sent") time doesn't increase, while UI jankness decreases.
Review URL: http://codereview.chromium.org/6716025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81394 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/memory_purger.cc')
-rw-r--r-- | chrome/browser/memory_purger.cc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/chrome/browser/memory_purger.cc b/chrome/browser/memory_purger.cc index 78d009d..80a884e 100644 --- a/chrome/browser/memory_purger.cc +++ b/chrome/browser/memory_purger.cc @@ -98,11 +98,10 @@ void MemoryPurger::PurgeBrowser() { new PurgeMemoryIOHelper(g_browser_process->resource_dispatcher_host()-> safe_browsing_service())); ProfileManager* profile_manager = g_browser_process->profile_manager(); - for (ProfileManager::iterator i(profile_manager->begin()); - i != profile_manager->end(); ++i) { - Profile* profile = *i; + std::vector<Profile*> profiles(profile_manager->GetLoadedProfiles()); + for (size_t i = 0; i < profiles.size(); ++i) { purge_memory_io_helper->AddRequestContextGetter( - make_scoped_refptr(profile->GetRequestContext())); + make_scoped_refptr(profiles[i]->GetRequestContext())); // NOTE: Some objects below may be duplicates across profiles. We could // conceivably put all these in sets and then iterate over the sets. @@ -111,20 +110,20 @@ void MemoryPurger::PurgeBrowser() { // Spinning up the history service is expensive, so we avoid doing it if it // hasn't been done already. HistoryService* history_service = - profile->GetHistoryServiceWithoutCreating(); + profiles[i]->GetHistoryServiceWithoutCreating(); if (history_service) history_service->UnloadBackend(); // Unload all web databases (freeing memory used to cache sqlite). WebDataService* web_data_service = - profile->GetWebDataServiceWithoutCreating(); + profiles[i]->GetWebDataServiceWithoutCreating(); if (web_data_service) web_data_service->UnloadDatabase(); // Ask all WebKitContexts to purge memory (freeing memory used to cache // the LocalStorage sqlite DB). WebKitContext creation is basically free so // we don't bother with a "...WithoutCreating()" function. - profile->GetWebKitContext()->PurgeMemory(); + profiles[i]->GetWebKitContext()->PurgeMemory(); } BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |