diff options
author | thestig <thestig@chromium.org> | 2015-02-05 09:35:21 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-05 17:36:26 +0000 |
commit | 8b4c3589c2a26b212cce47aa76acf8d029b4f9a6 (patch) | |
tree | 40c617cff2381f6de442b0f4290650ea13781cdf /chrome/browser/chrome_browser_main.cc | |
parent | 9d2eae585146f128074c316dbf8d8a1d4da99f07 (diff) | |
download | chromium_src-8b4c3589c2a26b212cce47aa76acf8d029b4f9a6.zip chromium_src-8b4c3589c2a26b212cce47aa76acf8d029b4f9a6.tar.gz chromium_src-8b4c3589c2a26b212cce47aa76acf8d029b4f9a6.tar.bz2 |
Cleanup: Only do a Local State file lookup when needed.
Review URL: https://codereview.chromium.org/895933005
Cr-Commit-Position: refs/heads/master@{#314829}
Diffstat (limited to 'chrome/browser/chrome_browser_main.cc')
-rw-r--r-- | chrome/browser/chrome_browser_main.cc | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index 2b86dc0..81c7c0c8 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc @@ -249,9 +249,6 @@ PrefService* InitializeLocalState( base::SequencedTaskRunner* local_state_task_runner, const base::CommandLine& parsed_command_line) { TRACE_EVENT0("startup", "ChromeBrowserMainParts::InitializeLocalState") - base::FilePath local_state_path; - PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); - bool local_state_file_exists = base::PathExists(local_state_path); // Load local state. This includes the application locale so we know which // locale dll to load. This also causes local state prefs to be registered. @@ -285,23 +282,27 @@ PrefService* InitializeLocalState( // JSONPrefStore here instead of an entire PrefService. Once this is // addressed, the call to browser_prefs::RegisterLocalState can move // to chrome_prefs::CreateLocalState. - if (!local_state_file_exists && - parsed_command_line.HasSwitch(switches::kParentProfile)) { - base::FilePath parent_profile = - parsed_command_line.GetSwitchValuePath(switches::kParentProfile); - scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple(); - scoped_ptr<PrefService> parent_local_state( - chrome_prefs::CreateLocalState( - parent_profile, - local_state_task_runner, - g_browser_process->policy_service(), - registry, - false)); - registry->RegisterStringPref(prefs::kApplicationLocale, std::string()); - // Right now, we only inherit the locale setting from the parent profile. - local_state->SetString( - prefs::kApplicationLocale, - parent_local_state->GetString(prefs::kApplicationLocale)); + if (parsed_command_line.HasSwitch(switches::kParentProfile)) { + base::FilePath local_state_path; + PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); + bool local_state_file_exists = base::PathExists(local_state_path); + if (!local_state_file_exists) { + base::FilePath parent_profile = + parsed_command_line.GetSwitchValuePath(switches::kParentProfile); + scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple(); + scoped_ptr<PrefService> parent_local_state( + chrome_prefs::CreateLocalState( + parent_profile, + local_state_task_runner, + g_browser_process->policy_service(), + registry, + false)); + registry->RegisterStringPref(prefs::kApplicationLocale, std::string()); + // Right now, we only inherit the locale setting from the parent profile. + local_state->SetString( + prefs::kApplicationLocale, + parent_local_state->GetString(prefs::kApplicationLocale)); + } } #if defined(OS_CHROMEOS) |