Index: components/memory_coordinator/browser/memory_coordinator.h |
diff --git a/components/memory_coordinator/browser/memory_coordinator.h b/components/memory_coordinator/browser/memory_coordinator.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f6e16578bd694b528d4fbda9a78f5532b20a8d0a |
--- /dev/null |
+++ b/components/memory_coordinator/browser/memory_coordinator.h |
@@ -0,0 +1,39 @@ |
+// 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 COMPONENTS_MEMORY_COORDINATOR_BROWSER_MEMORY_COORDINATOR_H_ |
+#define COMPONENTS_MEMORY_COORDINATOR_BROWSER_MEMORY_COORDINATOR_H_ |
+ |
+#include "components/memory_coordinator/public/interfaces/memory_coordinator.mojom.h" |
+#include "mojo/public/cpp/bindings/binding.h" |
+ |
+namespace memory_coordinator { |
+ |
+class MemoryCoordinatorHandleImpl; |
+ |
+// MemoryCoordinator is responsible for the whole memory management accross the |
+// browser and child proceeses. It will dispatch memory events to its clients |
+// and child processes based on its best knowledge of the memory usage. |
+class MemoryCoordinator { |
+ public: |
+ MemoryCoordinator(); |
+ ~MemoryCoordinator(); |
+ |
+ void CreateHandle(int id, mojom::MemoryCoordinatorHandleRequest request); |
dcheng
2016/07/12 05:20:28
Nit: please call this rph_id or something so it's
bashi
2016/07/12 05:51:46
Done.
|
+ |
+ // Iterates all children synchronously. |
+ using IterateCallback = base::Callback<void(mojom::ChildMemoryCoordinator*)>; |
+ void IterateChildrenForTesting(IterateCallback callback); |
dcheng
2016/07/12 05:20:28
Nit: pass callbacks by const ref. But rather than
bashi
2016/07/12 05:51:46
Hmm, can we make the test helper a friend of this
|
+ |
+ private: |
+ void OnConnectionError(int id); |
+ |
+ std::map<int, std::unique_ptr<MemoryCoordinatorHandleImpl>> children_; |
dcheng
2016/07/12 05:20:28
And please add a comment here =)
bashi
2016/07/12 05:51:46
Done.
|
+ |
+ DISALLOW_COPY_AND_ASSIGN(MemoryCoordinator); |
+}; |
+ |
+} // memory_coordinator |
+ |
+#endif // COMPONENTS_MEMORY_COORDINATOR_BROWSER_MEMORY_COORDINATOR_H_ |