Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_PROFILES_PROFILE_DEPENDENCY_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_DEPENDENCY_MANAGER_H_ |
| 6 #define CHROME_BROWSER_PROFILES_PROFILE_DEPENDENCY_MANAGER_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_DEPENDENCY_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 public: | 24 public: |
| 25 // Adds/Removes a component from our list of live components. Removing will | 25 // Adds/Removes a component from our list of live components. Removing will |
| 26 // also remove live dependency links. | 26 // also remove live dependency links. |
| 27 void AddComponent(ProfileKeyedServiceFactory* component); | 27 void AddComponent(ProfileKeyedServiceFactory* component); |
| 28 void RemoveComponent(ProfileKeyedServiceFactory* component); | 28 void RemoveComponent(ProfileKeyedServiceFactory* component); |
| 29 | 29 |
| 30 // Adds a dependency between two factories. | 30 // Adds a dependency between two factories. |
| 31 void AddEdge(ProfileKeyedServiceFactory* depended, | 31 void AddEdge(ProfileKeyedServiceFactory* depended, |
| 32 ProfileKeyedServiceFactory* dependee); | 32 ProfileKeyedServiceFactory* dependee); |
| 33 | 33 |
| 34 // Called by each Profile to alert us of its creation. Several services | |
| 35 // require configurations | |
|
Miranda Callahan
2011/07/20 20:53:09
nit: this comment kind of trails off; do you want
| |
| 36 void CreateProfileServices(Profile* profile, bool is_testing_profile); | |
| 37 | |
| 34 // Called by each Profile to alert us that we should destroy services | 38 // Called by each Profile to alert us that we should destroy services |
| 35 // associated with it. | 39 // associated with it. |
| 36 // | 40 // |
| 37 // Why not use the existing PROFILE_DESTROYED notification? | 41 // Why not use the existing PROFILE_DESTROYED notification? |
| 38 // | 42 // |
| 39 // - Because we need to do everything here after the application has handled | 43 // - Because we need to do everything here after the application has handled |
| 40 // being notified about PROFILE_DESTROYED. | 44 // being notified about PROFILE_DESTROYED. |
| 41 // - Because this class is a singleton and Singletons can't rely on | 45 // - Because this class is a singleton and Singletons can't rely on |
| 42 // NotificationService in unit tests because NotificationService is | 46 // NotificationService in unit tests because NotificationService is |
| 43 // replaced in many tests. | 47 // replaced in many tests. |
| 44 void DestroyProfileServices(Profile* profile); | 48 void DestroyProfileServices(Profile* profile); |
| 45 | 49 |
| 46 #ifndef NDEBUG | 50 #ifndef NDEBUG |
| 47 // Unmark |profile| as dead. This exists because of unit tests, which will | |
| 48 // often have similar stack structures. 0xWhatever might be created, go out | |
| 49 // of scope, and then a new Profile object might be created at 0xWhatever. | |
| 50 void ProfileNowExists(Profile* profile); | |
| 51 | |
| 52 // Debugging assertion called as part of GetServiceForProfile in debug | 51 // Debugging assertion called as part of GetServiceForProfile in debug |
| 53 // mode. This will NOTREACHED() whenever the user is trying to access a stale | 52 // mode. This will NOTREACHED() whenever the user is trying to access a stale |
| 54 // Profile*. | 53 // Profile*. |
| 55 void AssertProfileWasntDestroyed(Profile* profile); | 54 void AssertProfileWasntDestroyed(Profile* profile); |
| 56 #endif | 55 #endif |
| 57 | 56 |
| 58 static ProfileDependencyManager* GetInstance(); | 57 static ProfileDependencyManager* GetInstance(); |
| 59 | 58 |
| 60 private: | 59 private: |
| 61 friend class ProfileDependencyManagerUnittests; | 60 friend class ProfileDependencyManagerUnittests; |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 80 #ifndef NDEBUG | 79 #ifndef NDEBUG |
| 81 // A list of profile objects that have gone through the Shutdown() | 80 // A list of profile objects that have gone through the Shutdown() |
| 82 // phase. These pointers are most likely invalid, but we keep track of their | 81 // phase. These pointers are most likely invalid, but we keep track of their |
| 83 // locations in memory so we can nicely assert if we're asked to do anything | 82 // locations in memory so we can nicely assert if we're asked to do anything |
| 84 // with them. | 83 // with them. |
| 85 std::set<Profile*> dead_profile_pointers_; | 84 std::set<Profile*> dead_profile_pointers_; |
| 86 #endif | 85 #endif |
| 87 }; | 86 }; |
| 88 | 87 |
| 89 #endif // CHROME_BROWSER_PROFILES_PROFILE_DEPENDENCY_MANAGER_H_ | 88 #endif // CHROME_BROWSER_PROFILES_PROFILE_DEPENDENCY_MANAGER_H_ |
| OLD | NEW |