Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3783)

Unified Diff: chrome/browser/chrome_browser_main.cc

Issue 895933005: Cleanup: Only do a Local State file lookup when needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_browser_main.cc
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index 2b86dc063632c4e855f567c64033fecc511998ee..81c7c0c8a0af79f95d61c5722a3bb07fe87312e4 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)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698