summaryrefslogtreecommitdiffstats
path: root/chrome/browser/memory_purger.cc
diff options
context:
space:
mode:
authoraltimofeev@chromium.org <altimofeev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-13 12:23:53 +0000
committeraltimofeev@chromium.org <altimofeev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-13 12:23:53 +0000
commite4f864978d24e79ed3a47142c3a146d09627d0d4 (patch)
treee8f0bf5ef24b7263f448a1b5a853083096249e4b /chrome/browser/memory_purger.cc
parentd139f87c7ede1b35c906b32c77e363da4c87bf74 (diff)
downloadchromium_src-e4f864978d24e79ed3a47142c3a146d09627d0d4.zip
chromium_src-e4f864978d24e79ed3a47142c3a146d09627d0d4.tar.gz
chromium_src-e4f864978d24e79ed3a47142c3a146d09627d0d4.tar.bz2
Revert 81394 (broke sync_integration_tests and clang) - This CL implements alternative asynchronous methods for profile and preferences loading.BUG=chromium-os:11104TEST=UserProfileGotten (see "/tmp/login-times-sent") time doesn't increase, while UI jankness decreases.Review URL: http://codereview.chromium.org/6716025
TBR=altimofeev@chromium.org Review URL: http://codereview.chromium.org/6834021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81396 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/memory_purger.cc')
-rw-r--r--chrome/browser/memory_purger.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/chrome/browser/memory_purger.cc b/chrome/browser/memory_purger.cc
index 80a884e..78d009d 100644
--- a/chrome/browser/memory_purger.cc
+++ b/chrome/browser/memory_purger.cc
@@ -98,10 +98,11 @@ void MemoryPurger::PurgeBrowser() {
new PurgeMemoryIOHelper(g_browser_process->resource_dispatcher_host()->
safe_browsing_service()));
ProfileManager* profile_manager = g_browser_process->profile_manager();
- std::vector<Profile*> profiles(profile_manager->GetLoadedProfiles());
- for (size_t i = 0; i < profiles.size(); ++i) {
+ for (ProfileManager::iterator i(profile_manager->begin());
+ i != profile_manager->end(); ++i) {
+ Profile* profile = *i;
purge_memory_io_helper->AddRequestContextGetter(
- make_scoped_refptr(profiles[i]->GetRequestContext()));
+ make_scoped_refptr(profile->GetRequestContext()));
// NOTE: Some objects below may be duplicates across profiles. We could
// conceivably put all these in sets and then iterate over the sets.
@@ -110,20 +111,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 =
- profiles[i]->GetHistoryServiceWithoutCreating();
+ profile->GetHistoryServiceWithoutCreating();
if (history_service)
history_service->UnloadBackend();
// Unload all web databases (freeing memory used to cache sqlite).
WebDataService* web_data_service =
- profiles[i]->GetWebDataServiceWithoutCreating();
+ profile->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.
- profiles[i]->GetWebKitContext()->PurgeMemory();
+ profile->GetWebKitContext()->PurgeMemory();
}
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,