Index: base/memory/memory_coordinator_proxy.h |
diff --git a/base/memory/memory_coordinator_proxy.h b/base/memory/memory_coordinator_proxy.h |
index 4148da5dceec0c59e39462a6f740569263432ba9..6ba8f87d3bea67ee10d0e01af291d091302d6825 100644 |
--- a/base/memory/memory_coordinator_proxy.h |
+++ b/base/memory/memory_coordinator_proxy.h |
@@ -12,37 +12,38 @@ |
namespace base { |
+// The MemoryCoordinator interface. See comments in MemoryCoordinatorProxy for |
+// method descriptions. |
+class BASE_EXPORT MemoryCoordinator { |
+ public: |
+ virtual ~MemoryCoordinator() {} |
+ |
+ virtual MemoryState GetCurrentMemoryState() const = 0; |
+ virtual void SetCurrentMemoryStateForTesting(MemoryState memory_state) = 0; |
+}; |
+ |
// The proxy of MemoryCoordinator to be accessed from components that are not |
// in content/browser e.g. net. |
class BASE_EXPORT MemoryCoordinatorProxy { |
public: |
- using GetCurrentMemoryStateCallback = base::Callback<MemoryState()>; |
- using SetCurrentMemoryStateCallback = base::Callback<void(MemoryState)>; |
- |
static MemoryCoordinatorProxy* GetInstance(); |
+ // Sets an implementation of MemoryCoordinator. MemoryCoordinatorProxy doesn't |
+ // take the ownership of |coordinator|. It must outlive this proxy. |
+ static void SetMemoryCoordinator(MemoryCoordinator* coordinator); |
+ |
// Returns the current memory state. |
MemoryState GetCurrentMemoryState() const; |
// Sets the current memory state. This function is for testing only. |
void SetCurrentMemoryStateForTesting(MemoryState memory_state); |
- // Sets state-getter callback. |
- void SetGetCurrentMemoryStateCallback(GetCurrentMemoryStateCallback callback); |
- |
- // Sets state-setter callback. |
- void SetSetCurrentMemoryStateForTestingCallback( |
- SetCurrentMemoryStateCallback callback); |
- |
private: |
friend struct base::DefaultSingletonTraits<MemoryCoordinatorProxy>; |
MemoryCoordinatorProxy(); |
virtual ~MemoryCoordinatorProxy(); |
- GetCurrentMemoryStateCallback getter_callback_; |
- SetCurrentMemoryStateCallback setter_callback_; |
- |
DISALLOW_COPY_AND_ASSIGN(MemoryCoordinatorProxy); |
}; |