| OLD | NEW |
| 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 #ifndef COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_DEPENDENCY_MANA
GER_H_ | 5 #ifndef COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_DEPENDENCY_MANA
GER_H_ |
| 6 #define COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_DEPENDENCY_MANA
GER_H_ | 6 #define COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_DEPENDENCY_MANA
GER_H_ |
| 7 | 7 |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "components/browser_context_keyed_service/browser_context_keyed_service
_export.h" |
| 9 #include "components/browser_context_keyed_service/dependency_graph.h" | 10 #include "components/browser_context_keyed_service/dependency_graph.h" |
| 10 | 11 |
| 11 #ifndef NDEBUG | 12 #ifndef NDEBUG |
| 12 #include <set> | 13 #include <set> |
| 13 #endif | 14 #endif |
| 14 | 15 |
| 15 class BrowserContextKeyedBaseFactory; | 16 class BrowserContextKeyedBaseFactory; |
| 16 | 17 |
| 17 namespace content { | 18 namespace content { |
| 18 class BrowserContext; | 19 class BrowserContext; |
| 19 } | 20 } |
| 20 | 21 |
| 21 // A singleton that listens for context destruction notifications and | 22 // A singleton that listens for context destruction notifications and |
| 22 // rebroadcasts them to each BrowserContextKeyedBaseFactory in a safe order | 23 // rebroadcasts them to each BrowserContextKeyedBaseFactory in a safe order |
| 23 // based on the stated dependencies by each service. | 24 // based on the stated dependencies by each service. |
| 24 class BrowserContextDependencyManager { | 25 class BROWSER_CONTEXT_KEYED_SERVICE_EXPORT BrowserContextDependencyManager { |
| 25 public: | 26 public: |
| 26 // Adds/Removes a component from our list of live components. Removing will | 27 // Adds/Removes a component from our list of live components. Removing will |
| 27 // also remove live dependency links. | 28 // also remove live dependency links. |
| 28 void AddComponent(BrowserContextKeyedBaseFactory* component); | 29 void AddComponent(BrowserContextKeyedBaseFactory* component); |
| 29 void RemoveComponent(BrowserContextKeyedBaseFactory* component); | 30 void RemoveComponent(BrowserContextKeyedBaseFactory* component); |
| 30 | 31 |
| 31 // Adds a dependency between two factories. | 32 // Adds a dependency between two factories. |
| 32 void AddEdge(BrowserContextKeyedBaseFactory* depended, | 33 void AddEdge(BrowserContextKeyedBaseFactory* depended, |
| 33 BrowserContextKeyedBaseFactory* dependee); | 34 BrowserContextKeyedBaseFactory* dependee); |
| 34 | 35 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 #ifndef NDEBUG | 70 #ifndef NDEBUG |
| 70 // A list of context objects that have gone through the Shutdown() | 71 // A list of context objects that have gone through the Shutdown() |
| 71 // phase. These pointers are most likely invalid, but we keep track of their | 72 // phase. These pointers are most likely invalid, but we keep track of their |
| 72 // locations in memory so we can nicely assert if we're asked to do anything | 73 // locations in memory so we can nicely assert if we're asked to do anything |
| 73 // with them. | 74 // with them. |
| 74 std::set<content::BrowserContext*> dead_context_pointers_; | 75 std::set<content::BrowserContext*> dead_context_pointers_; |
| 75 #endif | 76 #endif |
| 76 }; | 77 }; |
| 77 | 78 |
| 78 #endif // COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_DEPENDENCY_M
ANAGER_H_ | 79 #endif // COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_DEPENDENCY_M
ANAGER_H_ |
| OLD | NEW |