Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_MEMORY_COORDINATOR_BROWSER_MEMORY_COORDINATOR_H_ | |
| 6 #define COMPONENTS_MEMORY_COORDINATOR_BROWSER_MEMORY_COORDINATOR_H_ | |
| 7 | |
| 8 #include "components/memory_coordinator/public/interfaces/memory_coordinator.moj om.h" | |
| 9 #include "mojo/public/cpp/bindings/binding.h" | |
| 10 | |
| 11 namespace memory_coordinator { | |
| 12 | |
| 13 class MemoryCoordinatorHandleImpl; | |
| 14 | |
| 15 // MemoryCoordinator is responsible for the whole memory management accross the | |
| 16 // browser and child proceeses. It will dispatch memory events to its clients | |
| 17 // and child processes based on its best knowledge of the memory usage. | |
| 18 class MemoryCoordinator { | |
| 19 public: | |
| 20 MemoryCoordinator(); | |
| 21 ~MemoryCoordinator(); | |
| 22 | |
| 23 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.
| |
| 24 | |
| 25 // Iterates all children synchronously. | |
| 26 using IterateCallback = base::Callback<void(mojom::ChildMemoryCoordinator*)>; | |
| 27 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
| |
| 28 | |
| 29 private: | |
| 30 void OnConnectionError(int id); | |
| 31 | |
| 32 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.
| |
| 33 | |
| 34 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinator); | |
| 35 }; | |
| 36 | |
| 37 } // memory_coordinator | |
| 38 | |
| 39 #endif // COMPONENTS_MEMORY_COORDINATOR_BROWSER_MEMORY_COORDINATOR_H_ | |
| OLD | NEW |