| 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/content/browser_context_dependency_manager.h" | 5 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 6 | 6 |
| 7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
| 8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
| 9 #include "content/public/browser/browser_context.h" | 9 #include "content/public/browser/browser_context.h" |
| 10 | 10 |
| 11 #ifndef NDEBUG | 11 #ifndef NDEBUG |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
| 14 | 14 |
| 15 // Dumps dependency information about our browser context keyed services | 15 // Dumps dependency information about our browser context keyed services |
| 16 // into a dot file in the browser context directory. | 16 // into a dot file in the browser context directory. |
| 17 const char kDumpBrowserContextDependencyGraphFlag[] = | 17 const char kDumpBrowserContextDependencyGraphFlag[] = |
| 18 "dump-browser-context-graph"; | 18 "dump-browser-context-graph"; |
| 19 #endif // NDEBUG | 19 #endif // NDEBUG |
| 20 | 20 |
| 21 void BrowserContextDependencyManager::RegisterProfilePrefsForServices( | 21 void BrowserContextDependencyManager::RegisterProfilePrefsForServices( |
| 22 const content::BrowserContext* context, | 22 const content::BrowserContext* context, |
| 23 user_prefs::PrefRegistrySyncable* pref_registry) { | 23 user_prefs::PrefRegistrySyncable* pref_registry) { |
| 24 TRACE_EVENT0( |
| 25 "browser", |
| 26 "BrowserContextDependencyManager::RegisterProfilePrefsForServices"); |
| 24 RegisterPrefsForServices(context, pref_registry); | 27 RegisterPrefsForServices(context, pref_registry); |
| 25 } | 28 } |
| 26 | 29 |
| 27 void BrowserContextDependencyManager::CreateBrowserContextServices( | 30 void BrowserContextDependencyManager::CreateBrowserContextServices( |
| 28 content::BrowserContext* context) { | 31 content::BrowserContext* context) { |
| 29 DoCreateBrowserContextServices(context, false); | 32 DoCreateBrowserContextServices(context, false); |
| 30 } | 33 } |
| 31 | 34 |
| 32 void BrowserContextDependencyManager::CreateBrowserContextServicesForTest( | 35 void BrowserContextDependencyManager::CreateBrowserContextServicesForTest( |
| 33 content::BrowserContext* context) { | 36 content::BrowserContext* context) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 89 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 87 kDumpBrowserContextDependencyGraphFlag)) { | 90 kDumpBrowserContextDependencyGraphFlag)) { |
| 88 base::FilePath dot_file = | 91 base::FilePath dot_file = |
| 89 static_cast<const content::BrowserContext*>(context) | 92 static_cast<const content::BrowserContext*>(context) |
| 90 ->GetPath() | 93 ->GetPath() |
| 91 .AppendASCII("browser-context-dependencies.dot"); | 94 .AppendASCII("browser-context-dependencies.dot"); |
| 92 DumpDependenciesAsGraphviz("BrowserContext", dot_file); | 95 DumpDependenciesAsGraphviz("BrowserContext", dot_file); |
| 93 } | 96 } |
| 94 } | 97 } |
| 95 #endif // NDEBUG | 98 #endif // NDEBUG |
| OLD | NEW |