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

Unified Diff: components/memory_coordinator/browser/memory_coordinator_impl.h

Issue 2094583002: Add MemoryCoordinator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 years, 5 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: components/memory_coordinator/browser/memory_coordinator_impl.h
diff --git a/components/memory_coordinator/browser/memory_coordinator_impl.h b/components/memory_coordinator/browser/memory_coordinator_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..224dae70ddf8765fd2b20734b205f97987d45f09
--- /dev/null
+++ b/components/memory_coordinator/browser/memory_coordinator_impl.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_IMPL_H_
+#define COMPONENTS_MEMORY_COORDINATOR_BROWSER_MEMORY_COORDINATOR_IMPL_H_
+
+#include "components/memory_coordinator/public/interfaces/memory_coordinator.mojom.h"
+#include "mojo/public/cpp/bindings/binding_set.h"
+#include "mojo/public/cpp/bindings/interface_ptr_set.h"
+#include "services/shell/public/cpp/interface_provider.h"
+
+namespace memory_coordinator {
+
+// The implementation of MemoryCoordinator. See memory_coordinator.mojom
+// for the role of this class.
+class MemoryCoordinatorImpl : public mojom::MemoryCoordinator {
+ public:
+ MemoryCoordinatorImpl();
+ ~MemoryCoordinatorImpl() override;
+
+ // Called when a renderer process is launched.
+ void RendererLaunched(shell::InterfaceProvider* remote_interfaces);
+
+ // Iterates all children synchronously.
+ template <typename FunctionType>
+ void IterateChildren(FunctionType function) {
haraken 2016/07/08 02:40:26 Is this only for testing? Or is it going to be use
bashi 2016/07/08 02:44:49 Yes. I don't have plans to use it outside tests.
haraken 2016/07/08 02:48:54 Then IterateChildrenForTesting?
bashi 2016/07/08 02:51:46 Will do.
+ children_.ForAllPtrs(function);
+ }
+
+ private:
+ mojo::InterfacePtrSet<mojom::ChildMemoryCoordinator> children_;
+
+ DISALLOW_COPY_AND_ASSIGN(MemoryCoordinatorImpl);
+};
+
+} // memory_coordinator
+
+#endif // COMPONENTS_MEMORY_COORDINATOR_BROWSER_MEMORY_COORDINATOR_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698