| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/keyed_service/core/keyed_service_base_factory.h" | 5 #include "components/keyed_service/core/keyed_service_base_factory.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | |
| 8 #include "base/supports_user_data.h" | 7 #include "base/supports_user_data.h" |
| 9 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
| 10 #include "components/keyed_service/core/dependency_manager.h" | 9 #include "components/keyed_service/core/dependency_manager.h" |
| 11 #include "components/pref_registry/pref_registry_syncable.h" | 10 #include "components/pref_registry/pref_registry_syncable.h" |
| 11 #include "components/prefs/pref_service.h" |
| 12 #include "components/user_prefs/user_prefs.h" | 12 #include "components/user_prefs/user_prefs.h" |
| 13 | 13 |
| 14 void KeyedServiceBaseFactory::RegisterUserPrefsOnContextForTest( | 14 void KeyedServiceBaseFactory::RegisterUserPrefsOnContextForTest( |
| 15 base::SupportsUserData* context) { | 15 base::SupportsUserData* context) { |
| 16 TRACE_EVENT0("browser,startup", | 16 TRACE_EVENT0("browser,startup", |
| 17 "KeyedServiceBaseFactory::RegisterUserPrefsOnContextForTest"); | 17 "KeyedServiceBaseFactory::RegisterUserPrefsOnContextForTest"); |
| 18 // Safe timing for pref registration is hard. Previously, we made | 18 // Safe timing for pref registration is hard. Previously, we made |
| 19 // context responsible for all pref registration on every service | 19 // context responsible for all pref registration on every service |
| 20 // that used contexts. Now we don't and there are timing issues. | 20 // that used contexts. Now we don't and there are timing issues. |
| 21 // | 21 // |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 bool KeyedServiceBaseFactory::ArePreferencesSetOn( | 112 bool KeyedServiceBaseFactory::ArePreferencesSetOn( |
| 113 base::SupportsUserData* context) const { | 113 base::SupportsUserData* context) const { |
| 114 return registered_preferences_.find(context) != registered_preferences_.end(); | 114 return registered_preferences_.find(context) != registered_preferences_.end(); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void KeyedServiceBaseFactory::MarkPreferencesSetOn( | 117 void KeyedServiceBaseFactory::MarkPreferencesSetOn( |
| 118 base::SupportsUserData* context) { | 118 base::SupportsUserData* context) { |
| 119 DCHECK(!ArePreferencesSetOn(context)); | 119 DCHECK(!ArePreferencesSetOn(context)); |
| 120 registered_preferences_.insert(context); | 120 registered_preferences_.insert(context); |
| 121 } | 121 } |
| OLD | NEW |