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
3 // found in the LICENSE file.
5 #include "components/keyed_service/ios/browser_state_dependency_manager.h"
7 #include "base/memory/singleton.h"
8 #include "base/trace_event/trace_event.h"
9 #include "ios/web/public/browser_state.h"
12 BrowserStateDependencyManager
* BrowserStateDependencyManager::GetInstance() {
13 return Singleton
<BrowserStateDependencyManager
>::get();
16 void BrowserStateDependencyManager::RegisterProfilePrefsForServices(
17 const web::BrowserState
* context
,
18 user_prefs::PrefRegistrySyncable
* pref_registry
) {
19 RegisterPrefsForServices(context
, pref_registry
);
22 void BrowserStateDependencyManager::CreateBrowserStateServices(
23 web::BrowserState
* context
) {
24 DoCreateBrowserStateServices(context
, false);
27 void BrowserStateDependencyManager::CreateBrowserStateServicesForTest(
28 web::BrowserState
* context
) {
29 DoCreateBrowserStateServices(context
, true);
32 void BrowserStateDependencyManager::DestroyBrowserStateServices(
33 web::BrowserState
* context
) {
34 DependencyManager::DestroyContextServices(context
);
38 void BrowserStateDependencyManager::AssertBrowserStateWasntDestroyed(
39 web::BrowserState
* context
) {
40 DependencyManager::AssertContextWasntDestroyed(context
);
43 void BrowserStateDependencyManager::MarkBrowserStateLiveForTesting(
44 web::BrowserState
* context
) {
45 DependencyManager::MarkContextLiveForTesting(context
);
49 BrowserStateDependencyManager::BrowserStateDependencyManager() {
52 BrowserStateDependencyManager::~BrowserStateDependencyManager() {
55 void BrowserStateDependencyManager::DoCreateBrowserStateServices(
56 web::BrowserState
* context
,
57 bool is_testing_context
) {
58 TRACE_EVENT0("browser",
59 "BrowserStateDependencyManager::DoCreateBrowserStateServices")
60 DependencyManager::CreateContextServices(context
, is_testing_context
);
64 void BrowserStateDependencyManager::DumpContextDependencies(
65 const base::SupportsUserData
* context
) const {