diff options
author | msarda@chromium.org <msarda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-18 17:17:33 +0000 |
---|---|---|
committer | msarda@chromium.org <msarda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-18 17:17:33 +0000 |
commit | afecfb73fdbca719e3a861b3255e68f2c3ef8780 (patch) | |
tree | d10462f24aae74062803c782ae05cfbf6819bd41 /chrome/browser/profiles/profile_manager.cc | |
parent | ac68e24b25c6578e131ba420abeeebddfb7bca0c (diff) | |
download | chromium_src-afecfb73fdbca719e3a861b3255e68f2c3ef8780.zip chromium_src-afecfb73fdbca719e3a861b3255e68f2c3ef8780.tar.gz chromium_src-afecfb73fdbca719e3a861b3255e68f2c3ef8780.tar.bz2 |
Delay bookmarks load while the profile is loading.
This CL adds a new DeferredSequencedtaskRunner that queues up tasks
until a first call to Start is issued. It creates such a task runner for the
execution of bookmarks I/O operations. At profile creation, the bookmarks
task runner is stopped and its execution is started after the profile has
finished loading.
BUG=NONE
Review URL: https://chromiumcodereview.appspot.com/12952005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194956 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/profiles/profile_manager.cc')
-rw-r--r-- | chrome/browser/profiles/profile_manager.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc index e157d1f..ce4ff02 100644 --- a/chrome/browser/profiles/profile_manager.cc +++ b/chrome/browser/profiles/profile_manager.cc @@ -8,6 +8,7 @@ #include "base/bind.h" #include "base/command_line.h" +#include "base/deferred_sequenced_task_runner.h" #include "base/file_util.h" #include "base/files/file_path.h" #include "base/metrics/histogram.h" @@ -25,6 +26,8 @@ #include "chrome/browser/profiles/profile_destroyer.h" #include "chrome/browser/profiles/profile_info_cache.h" #include "chrome/browser/profiles/profile_metrics.h" +#include "chrome/browser/profiles/startup_task_runner_service.h" +#include "chrome/browser/profiles/startup_task_runner_service_factory.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/ui/browser.h" @@ -847,6 +850,9 @@ void ProfileManager::DoFinalInitForServices(Profile* profile, // initializing the managed flag if necessary). ManagedUserServiceFactory::GetForProfile(profile)->Init(); #endif + // Start the deferred task runners once the profile is loaded. + StartupTaskRunnerServiceFactory::GetForProfile(profile)-> + StartDeferredTaskRunners(); } void ProfileManager::DoFinalInitLogging(Profile* profile) { @@ -1173,12 +1179,17 @@ ProfileManagerWithoutInit::ProfileManagerWithoutInit( } void ProfileManager::RegisterTestingProfile(Profile* profile, - bool add_to_cache) { + bool add_to_cache, + bool start_deferred_task_runners) { RegisterProfile(profile, true); if (add_to_cache) { InitProfileUserPrefs(profile); AddProfileToCache(profile); } + if (start_deferred_task_runners) { + StartupTaskRunnerServiceFactory::GetForProfile(profile)-> + StartDeferredTaskRunners(); + } } void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, |