| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <iterator> | 9 #include <iterator> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
| 13 #include "components/keyed_service/content/browser_context_keyed_base_factory.h" | 13 #include "components/keyed_service/content/browser_context_keyed_base_factory.h" |
| 14 #include "content/public/browser/browser_context.h" | 14 #include "content/public/browser/browser_context.h" |
| 15 | 15 |
| 16 #ifndef NDEBUG | 16 #ifndef NDEBUG |
| 17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 18 #include "base/file_util.h" | 18 #include "base/files/file_util.h" |
| 19 | 19 |
| 20 // Dumps dependency information about our browser context keyed services | 20 // Dumps dependency information about our browser context keyed services |
| 21 // into a dot file in the browser context directory. | 21 // into a dot file in the browser context directory. |
| 22 const char kDumpBrowserContextDependencyGraphFlag[] = | 22 const char kDumpBrowserContextDependencyGraphFlag[] = |
| 23 "dump-browser-context-graph"; | 23 "dump-browser-context-graph"; |
| 24 #endif // NDEBUG | 24 #endif // NDEBUG |
| 25 | 25 |
| 26 void BrowserContextDependencyManager::AddComponent( | 26 void BrowserContextDependencyManager::AddComponent( |
| 27 BrowserContextKeyedBaseFactory* component) { | 27 BrowserContextKeyedBaseFactory* component) { |
| 28 dependency_graph_.AddNode(component); | 28 dependency_graph_.AddNode(component); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 kDumpBrowserContextDependencyGraphFlag)) { | 182 kDumpBrowserContextDependencyGraphFlag)) { |
| 183 base::FilePath dot_file = | 183 base::FilePath dot_file = |
| 184 context->GetPath().AppendASCII("browser-context-dependencies.dot"); | 184 context->GetPath().AppendASCII("browser-context-dependencies.dot"); |
| 185 std::string contents = dependency_graph_.DumpAsGraphviz( | 185 std::string contents = dependency_graph_.DumpAsGraphviz( |
| 186 "BrowserContext", | 186 "BrowserContext", |
| 187 base::Bind(&BrowserContextKeyedBaseFactoryGetNodeName)); | 187 base::Bind(&BrowserContextKeyedBaseFactoryGetNodeName)); |
| 188 base::WriteFile(dot_file, contents.c_str(), contents.size()); | 188 base::WriteFile(dot_file, contents.c_str(), contents.size()); |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 #endif // NDEBUG | 191 #endif // NDEBUG |
| OLD | NEW |