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 render_process_id, | |
24 mojom::MemoryCoordinatorHandleRequest request); | |
25 | |
26 // Returns number of children. Only used for testing. | |
27 size_t NumChildrenForTesting(); | |
28 | |
29 private: | |
30 void OnConnectionError(int render_process_id); | |
31 | |
32 // Mappings of RenderProcessHost::GetID() -> MemoryCoordinatorHandleImpl. | |
33 // A mapping is added when a renderer connects to MemoryCoordinator and | |
34 // removed automatically when a underlying binding is disconnected. | |
35 std::map<int, std::unique_ptr<MemoryCoordinatorHandleImpl>> children_; | |
36 | |
37 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinator); | |
38 }; | |
39 | |
40 } // memory_coordinator | |
41 | |
42 #endif // COMPONENTS_MEMORY_COORDINATOR_BROWSER_MEMORY_COORDINATOR_H_ | |
OLD | NEW |