| Index: components/browser_context_keyed_service/browser_context_dependency_manager.h
|
| diff --git a/components/browser_context_keyed_service/browser_context_dependency_manager.h b/components/browser_context_keyed_service/browser_context_dependency_manager.h
|
| index 2b5ba0e5512d045637e39fdd50f48c4fab5ba2f6..fdaef1451e5049c6c8f77b584dbe4b316268c938 100644
|
| --- a/components/browser_context_keyed_service/browser_context_dependency_manager.h
|
| +++ b/components/browser_context_keyed_service/browser_context_dependency_manager.h
|
| @@ -12,74 +12,66 @@
|
| #include <set>
|
| #endif
|
|
|
| -class ProfileKeyedBaseFactory;
|
| +class BrowserContextKeyedBaseFactory;
|
|
|
| namespace content {
|
| class BrowserContext;
|
| }
|
|
|
| -// A singleton that listens for profile destruction notifications and
|
| -// rebroadcasts them to each ProfileKeyedBaseFactory in a safe order based
|
| -// on the stated dependencies by each service.
|
| -class ProfileDependencyManager {
|
| +// A singleton that listens for context destruction notifications and
|
| +// rebroadcasts them to each BrowserContextKeyedBaseFactory in a safe order
|
| +// based on the stated dependencies by each service.
|
| +class BrowserContextDependencyManager {
|
| public:
|
| // Adds/Removes a component from our list of live components. Removing will
|
| // also remove live dependency links.
|
| - void AddComponent(ProfileKeyedBaseFactory* component);
|
| - void RemoveComponent(ProfileKeyedBaseFactory* component);
|
| + void AddComponent(BrowserContextKeyedBaseFactory* component);
|
| + void RemoveComponent(BrowserContextKeyedBaseFactory* component);
|
|
|
| // Adds a dependency between two factories.
|
| - void AddEdge(ProfileKeyedBaseFactory* depended,
|
| - ProfileKeyedBaseFactory* dependee);
|
| -
|
| - // Called by each Profile to alert us of its creation. Several services want
|
| - // to be started when a profile is created. Testing configuration is also
|
| - // done at this time. (If you want your ProfileKeyedService to be started
|
| - // with the Profile, override ProfileKeyedBaseFactory::
|
| - // ServiceIsCreatedWithProfile() to return true.)
|
| - void CreateProfileServices(content::BrowserContext* profile,
|
| - bool is_testing_profile);
|
| -
|
| - // Called by each Profile to alert us that we should destroy services
|
| + void AddEdge(BrowserContextKeyedBaseFactory* depended,
|
| + BrowserContextKeyedBaseFactory* dependee);
|
| +
|
| + // Called by each BrowserContext to alert us of its creation. Several services
|
| + // want to be started when a context is created. Testing configuration is also
|
| + // done at this time. (If you want your BrowserContextKeyedService to be
|
| + // started with the BrowserContext, override BrowserContextKeyedBaseFactory::
|
| + // ServiceIsCreatedWithBrowserContext() to return true.)
|
| + void CreateBrowserContextServices(content::BrowserContext* context,
|
| + bool is_testing_context);
|
| +
|
| + // Called by each BrowserContext to alert us that we should destroy services
|
| // associated with it.
|
| - //
|
| - // Why not use the existing PROFILE_DESTROYED notification?
|
| - //
|
| - // - Because we need to do everything here after the application has handled
|
| - // being notified about PROFILE_DESTROYED.
|
| - // - Because this class is a singleton and Singletons can't rely on
|
| - // NotificationService in unit tests because NotificationService is
|
| - // replaced in many tests.
|
| - void DestroyProfileServices(content::BrowserContext* profile);
|
| + void DestroyBrowserContextServices(content::BrowserContext* context);
|
|
|
| #ifndef NDEBUG
|
| - // Debugging assertion called as part of GetServiceForProfile in debug
|
| + // Debugging assertion called as part of GetServiceForBrowserContext in debug
|
| // mode. This will NOTREACHED() whenever the user is trying to access a stale
|
| - // Profile*.
|
| - void AssertProfileWasntDestroyed(content::BrowserContext* profile);
|
| + // BrowserContext*.
|
| + void AssertBrowserContextWasntDestroyed(content::BrowserContext* context);
|
| #endif
|
|
|
| - static ProfileDependencyManager* GetInstance();
|
| + static BrowserContextDependencyManager* GetInstance();
|
|
|
| private:
|
| - friend class ProfileDependencyManagerUnittests;
|
| - friend struct DefaultSingletonTraits<ProfileDependencyManager>;
|
| + friend class BrowserContextDependencyManagerUnittests;
|
| + friend struct DefaultSingletonTraits<BrowserContextDependencyManager>;
|
|
|
| - ProfileDependencyManager();
|
| - virtual ~ProfileDependencyManager();
|
| + BrowserContextDependencyManager();
|
| + virtual ~BrowserContextDependencyManager();
|
|
|
| #ifndef NDEBUG
|
| - void DumpProfileDependencies(content::BrowserContext* profile);
|
| + void DumpBrowserContextDependencies(content::BrowserContext* context);
|
| #endif
|
|
|
| DependencyGraph dependency_graph_;
|
|
|
| #ifndef NDEBUG
|
| - // A list of profile objects that have gone through the Shutdown()
|
| + // A list of context objects that have gone through the Shutdown()
|
| // phase. These pointers are most likely invalid, but we keep track of their
|
| // locations in memory so we can nicely assert if we're asked to do anything
|
| // with them.
|
| - std::set<content::BrowserContext*> dead_profile_pointers_;
|
| + std::set<content::BrowserContext*> dead_context_pointers_;
|
| #endif
|
| };
|
|
|
|
|