diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-31 22:48:52 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-31 22:48:52 +0000 |
commit | 5cdcd1526b94798ec1927836ef2f26369eee8008 (patch) | |
tree | a60b4fb4f8d2ffab422ad20f513905f2df1c3625 /chrome/test/testing_profile.h | |
parent | 2da10fe4f0cc07c5879ef10cae261ec3e5d1977f (diff) | |
download | chromium_src-5cdcd1526b94798ec1927836ef2f26369eee8008.zip chromium_src-5cdcd1526b94798ec1927836ef2f26369eee8008.tar.gz chromium_src-5cdcd1526b94798ec1927836ef2f26369eee8008.tar.bz2 |
Create a ProfileDependencyManager to order ProfileKeyedService destruction.
Since ProfileKeyedServices need to be able to specify complex graphs
representing their dependencies on other ProfileKeyedServices, add a simple
::DependsOn() method to explicitly state these dependencies and a singleton
manager in the background that does a topological sort to get a safe
destruction ordering.
This changes ThemeServiceFactory to use this new system, which also revealed a bunch of unsafe casting of Source<> pointers and NotificationCenter misuse between incompatible types. (Source<> uses void* underneath and therefore can't increment/decrement the pointer during casting.)
BUG=77155
TEST=compiles, new ProfileDependencyManagerUnittests.*
Review URL: http://codereview.chromium.org/6766004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80093 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/testing_profile.h')
-rw-r--r-- | chrome/test/testing_profile.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/chrome/test/testing_profile.h b/chrome/test/testing_profile.h index b370cde..3ac8d27 100644 --- a/chrome/test/testing_profile.h +++ b/chrome/test/testing_profile.h @@ -35,6 +35,7 @@ class GeolocationPermissionContext; class HistoryService; class HostContentSettingsMap; class PrefService; +class ProfileDependencyManager; class ProfileSyncService; class SessionService; class TemplateURLModel; @@ -125,6 +126,8 @@ class TestingProfile : public Profile { TestingPrefService* GetTestingPrefService(); + void SetProfileDependencyManager(ProfileDependencyManager* manager); + virtual ProfileId GetRuntimeId(); virtual FilePath GetPath(); @@ -389,6 +392,11 @@ class TestingProfile : public Profile { scoped_ptr<ChromeURLDataManager> chrome_url_data_manager_; scoped_refptr<prerender::PrerenderManager> prerender_manager_; + + // We keep a weak pointer to the dependency manager we want to notify on our + // death. Defaults to the Singleton implementation but overridable for + // testing. + ProfileDependencyManager* profile_dependency_manager_; }; // A profile that derives from another profile. This does not actually |