| 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 #ifndef COMPONENTS_KEYED_SERVICE_CORE_KEYED_SERVICE_BASE_FACTORY_H_ | 5 #ifndef COMPONENTS_KEYED_SERVICE_CORE_KEYED_SERVICE_BASE_FACTORY_H_ |
| 6 #define COMPONENTS_KEYED_SERVICE_CORE_KEYED_SERVICE_BASE_FACTORY_H_ | 6 #define COMPONENTS_KEYED_SERVICE_CORE_KEYED_SERVICE_BASE_FACTORY_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/threading/non_thread_safe.h" | 10 #include "base/threading/non_thread_safe.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // |context|. Only test code is allowed to call this method. | 47 // |context|. Only test code is allowed to call this method. |
| 48 // | 48 // |
| 49 // TODO(gab): This method can be removed entirely when | 49 // TODO(gab): This method can be removed entirely when |
| 50 // PrefService::DeprecatedGetPrefRegistry() is phased out. | 50 // PrefService::DeprecatedGetPrefRegistry() is phased out. |
| 51 void RegisterUserPrefsOnContextForTest(base::SupportsUserData* context); | 51 void RegisterUserPrefsOnContextForTest(base::SupportsUserData* context); |
| 52 | 52 |
| 53 // The main public interface for declaring dependencies between services | 53 // The main public interface for declaring dependencies between services |
| 54 // created by factories. | 54 // created by factories. |
| 55 void DependsOn(KeyedServiceBaseFactory* rhs); | 55 void DependsOn(KeyedServiceBaseFactory* rhs); |
| 56 | 56 |
| 57 #ifndef NDEBUG | 57 // Runtime assertion to check if |context| is considered stale. Should be used |
| 58 // Debugging assertion that will NOTREACHED() is |context| is considered | 58 // by subclasses when accessing |context|. |
| 59 // stale. Should be used by subclasses when accessing |context|. | |
| 60 void AssertContextWasntDestroyed(base::SupportsUserData* context) const; | 59 void AssertContextWasntDestroyed(base::SupportsUserData* context) const; |
| 61 | 60 |
| 62 // Marks |context| as live (i.e., not stale). This method can be called as a | 61 // Marks |context| as live (i.e., not stale). This method can be called as a |
| 63 // safeguard against |AssertContextWasntDestroyed()| checks going off due to | 62 // safeguard against |AssertContextWasntDestroyed()| checks going off due to |
| 64 // |context| aliasing am instance from a prior test (i.e., 0xWhatever might | 63 // |context| aliasing an instance from a prior construction (i.e., 0xWhatever |
| 65 // be created, be destroyed, and then a new object might be created at | 64 // might be created, be destroyed, and then a new object might be created at |
| 66 // 0xWhatever). | 65 // 0xWhatever). |
| 67 void MarkContextLiveForTesting(base::SupportsUserData* context); | 66 void MarkContextLive(base::SupportsUserData* context); |
| 68 #endif | |
| 69 | 67 |
| 70 // Calls RegisterProfilePrefs() after doing house keeping required to work | 68 // Calls RegisterProfilePrefs() after doing house keeping required to work |
| 71 // alongside RegisterUserPrefsOnContextForTest(). | 69 // alongside RegisterUserPrefsOnContextForTest(). |
| 72 // TODO(gab): This method can be replaced by RegisterProfilePrefs() directly | 70 // TODO(gab): This method can be replaced by RegisterProfilePrefs() directly |
| 73 // once RegisterUserPrefsOnContextForTest() is phased out. | 71 // once RegisterUserPrefsOnContextForTest() is phased out. |
| 74 void RegisterPrefsIfNecessaryForContext( | 72 void RegisterPrefsIfNecessaryForContext( |
| 75 base::SupportsUserData* context, | 73 base::SupportsUserData* context, |
| 76 user_prefs::PrefRegistrySyncable* registry); | 74 user_prefs::PrefRegistrySyncable* registry); |
| 77 | 75 |
| 78 // Returns the |user_pref::PrefRegistrySyncable| associated with |context|. | 76 // Returns the |user_pref::PrefRegistrySyncable| associated with |context|. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 137 |
| 140 #if !defined(NDEBUG) | 138 #if !defined(NDEBUG) |
| 141 // A static string passed in to the constructor. Should be unique across all | 139 // A static string passed in to the constructor. Should be unique across all |
| 142 // services. This is used only for debugging in debug mode. (Used to print | 140 // services. This is used only for debugging in debug mode. (Used to print |
| 143 // pretty graphs with GraphViz.) | 141 // pretty graphs with GraphViz.) |
| 144 const char* service_name_; | 142 const char* service_name_; |
| 145 #endif | 143 #endif |
| 146 }; | 144 }; |
| 147 | 145 |
| 148 #endif // COMPONENTS_KEYED_SERVICE_CORE_KEYED_SERVICE_BASE_FACTORY_H_ | 146 #endif // COMPONENTS_KEYED_SERVICE_CORE_KEYED_SERVICE_BASE_FACTORY_H_ |
| OLD | NEW |