Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3228)

Unified Diff: base/memory/memory_coordinator_proxy.h

Issue 2703743002: Refactor MemoryCoordinatorProxy (Closed)
Patch Set: Remove atomics Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/memory/memory_coordinator_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..036f126f4c62b451f886bce3a5aa3331d9237f05 100644
--- a/base/memory/memory_coordinator_proxy.h
+++ b/base/memory/memory_coordinator_proxy.h
@@ -12,37 +12,39 @@
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.
+ // This should be called before any components starts using 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);
};
« no previous file with comments | « no previous file | base/memory/memory_coordinator_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698