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

Side by Side Diff: chrome/browser/prefs/chrome_pref_service_factory.cc

Issue 2740493002: Pref service: create service at browser startup (Closed)
Patch Set: Merge Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <chrome/browser/prefs/chrome_command_line_pref_store.h> 5 #include <chrome/browser/prefs/chrome_command_line_pref_store.h>
6 #include "chrome/browser/prefs/chrome_pref_service_factory.h" 6 #include "chrome/browser/prefs/chrome_pref_service_factory.h"
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 } 496 }
497 497
498 std::unique_ptr<sync_preferences::PrefServiceSyncable> CreateProfilePrefs( 498 std::unique_ptr<sync_preferences::PrefServiceSyncable> CreateProfilePrefs(
499 const base::FilePath& profile_path, 499 const base::FilePath& profile_path,
500 base::SequencedTaskRunner* pref_io_task_runner, 500 base::SequencedTaskRunner* pref_io_task_runner,
501 prefs::mojom::TrackedPreferenceValidationDelegate* validation_delegate, 501 prefs::mojom::TrackedPreferenceValidationDelegate* validation_delegate,
502 policy::PolicyService* policy_service, 502 policy::PolicyService* policy_service,
503 SupervisedUserSettingsService* supervised_user_settings, 503 SupervisedUserSettingsService* supervised_user_settings,
504 const scoped_refptr<PrefStore>& extension_prefs, 504 const scoped_refptr<PrefStore>& extension_prefs,
505 const scoped_refptr<user_prefs::PrefRegistrySyncable>& pref_registry, 505 const scoped_refptr<user_prefs::PrefRegistrySyncable>& pref_registry,
506 bool async) { 506 bool async,
507 service_manager::Connector* connector) {
507 TRACE_EVENT0("browser", "chrome_prefs::CreateProfilePrefs"); 508 TRACE_EVENT0("browser", "chrome_prefs::CreateProfilePrefs");
508 SCOPED_UMA_HISTOGRAM_TIMER("PrefService.CreateProfilePrefsTime"); 509 SCOPED_UMA_HISTOGRAM_TIMER("PrefService.CreateProfilePrefsTime");
509 510
510 // A StartSyncFlare used to kick sync early in case of a reset event. This is 511 // A StartSyncFlare used to kick sync early in case of a reset event. This is
511 // done since sync may bring back the user's server value post-reset which 512 // done since sync may bring back the user's server value post-reset which
512 // could potentially cause a "settings flash" between the factory default and 513 // could potentially cause a "settings flash" between the factory default and
513 // the re-instantiated server value. Starting sync ASAP minimizes the window 514 // the re-instantiated server value. Starting sync ASAP minimizes the window
514 // before the server value is re-instantiated (this window can otherwise be 515 // before the server value is re-instantiated (this window can otherwise be
515 // as long as 10 seconds by default). 516 // as long as 10 seconds by default).
516 const base::Closure start_sync_flare_for_prefs = 517 const base::Closure start_sync_flare_for_prefs =
517 base::Bind(sync_start_util::GetFlareForSyncableService(profile_path), 518 base::Bind(sync_start_util::GetFlareForSyncableService(profile_path),
518 syncer::PREFERENCES); 519 syncer::PREFERENCES);
519 520
520 sync_preferences::PrefServiceSyncableFactory factory; 521 sync_preferences::PrefServiceSyncableFactory factory;
521 scoped_refptr<PersistentPrefStore> user_pref_store( 522 scoped_refptr<PersistentPrefStore> user_pref_store(
522 CreateProfilePrefStoreManager(profile_path) 523 CreateProfilePrefStoreManager(profile_path)
523 ->CreateProfilePrefStore(pref_io_task_runner, 524 ->CreateProfilePrefStore(pref_io_task_runner,
524 start_sync_flare_for_prefs, 525 start_sync_flare_for_prefs,
525 validation_delegate)); 526 validation_delegate));
526 PrepareFactory(&factory, profile_path, policy_service, 527 PrepareFactory(&factory, profile_path, policy_service,
527 supervised_user_settings, user_pref_store, extension_prefs, 528 supervised_user_settings, user_pref_store, extension_prefs,
528 async); 529 async);
529 std::unique_ptr<sync_preferences::PrefServiceSyncable> pref_service = 530 std::unique_ptr<sync_preferences::PrefServiceSyncable> pref_service =
530 factory.CreateSyncable(pref_registry.get()); 531 factory.CreateSyncable(pref_registry.get(), connector);
531 532
532 return pref_service; 533 return pref_service;
533 } 534 }
534 535
535 void DisableDomainCheckForTesting() { 536 void DisableDomainCheckForTesting() {
536 #if defined(OS_WIN) 537 #if defined(OS_WIN)
537 g_disable_domain_check_for_testing = true; 538 g_disable_domain_check_for_testing = true;
538 #endif // OS_WIN 539 #endif // OS_WIN
539 } 540 }
540 541
(...skipping 10 matching lines...) Expand all
551 552
552 void ClearResetTime(Profile* profile) { 553 void ClearResetTime(Profile* profile) {
553 ProfilePrefStoreManager::ClearResetTime(profile->GetPrefs()); 554 ProfilePrefStoreManager::ClearResetTime(profile->GetPrefs());
554 } 555 }
555 556
556 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { 557 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
557 ProfilePrefStoreManager::RegisterProfilePrefs(registry); 558 ProfilePrefStoreManager::RegisterProfilePrefs(registry);
558 } 559 }
559 560
560 } // namespace chrome_prefs 561 } // namespace chrome_prefs
OLDNEW
« no previous file with comments | « chrome/browser/prefs/chrome_pref_service_factory.h ('k') | chrome/browser/profiles/profile_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698