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

Unified Diff: base/memory/memory_coordinator_proxy.h

Issue 2434353003: Introduce MemoryCoordinatorProxy in base (Closed)
Patch Set: Address on reviews Created 4 years, 2 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
Index: base/memory/memory_coordinator_proxy.h
diff --git a/base/memory/memory_coordinator_proxy.h b/base/memory/memory_coordinator_proxy.h
new file mode 100644
index 0000000000000000000000000000000000000000..22a65324a64c8444a68fe649df480f8915270776
--- /dev/null
+++ b/base/memory/memory_coordinator_proxy.h
@@ -0,0 +1,42 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_MEMORY_MEMORY_COORDINATOR_PROXY_H_
+#define BASE_MEMORY_MEMORY_COORDINATOR_PROXY_H_
+
+#include "base/base_export.h"
+#include "base/callback.h"
+#include "base/memory/memory_coordinator_client.h"
+#include "base/memory/singleton.h"
+
+namespace base {
+
+// The proxy of MemoryCoordinator to be accessed from components that is not
haraken 2016/10/24 09:01:16 is => are
hajimehoshi 2016/10/24 10:56:52 ouch
+// in content/browser e.g. net.
+class BASE_EXPORT MemoryCoordinatorProxy {
+ public:
+ using GetCurrentMemoryStateCallback = base::Callback<MemoryState()>;
+
+ static MemoryCoordinatorProxy* GetInstance();
+
+ // Returns the current memory state.
+ MemoryState GetCurrentMemoryState() const;
+
+ // Sets state-getter callback.
+ void SetGetCurrentMemoryStateCallback(GetCurrentMemoryStateCallback callback);
+
+ private:
+ friend struct base::DefaultSingletonTraits<MemoryCoordinatorProxy>;
+
+ MemoryCoordinatorProxy();
+ virtual ~MemoryCoordinatorProxy();
+
+ GetCurrentMemoryStateCallback callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(MemoryCoordinatorProxy);
+};
+
+} // namespace base
+
+#endif // BASE_MEMORY_MEMORY_COORDINATOR_PROXY_H_

Powered by Google App Engine
This is Rietveld 408576698