OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_MEMORY_COORDINATOR_BROWSER_MEMORY_COORDINATOR_H_ | 5 #ifndef CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_ |
6 #define COMPONENTS_MEMORY_COORDINATOR_BROWSER_MEMORY_COORDINATOR_H_ | 6 #define CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_ |
7 | 7 |
8 #include "base/memory/memory_coordinator_client_registry.h" | 8 #include "base/memory/memory_coordinator_client_registry.h" |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
11 #include "components/memory_coordinator/common/memory_coordinator_export.h" | 11 #include "content/common/content_export.h" |
12 #include "components/memory_coordinator/public/interfaces/memory_coordinator.moj
om.h" | 12 #include "content/common/memory_coordinator.mojom.h" |
13 #include "mojo/public/cpp/bindings/binding.h" | 13 #include "mojo/public/cpp/bindings/binding.h" |
14 | 14 |
15 namespace memory_coordinator { | 15 namespace content { |
16 | 16 |
17 class MemoryCoordinatorHandleImpl; | 17 class MemoryCoordinatorHandleImpl; |
18 | 18 |
19 // MemoryCoordinator is responsible for the whole memory management accross the | 19 // MemoryCoordinator is responsible for the whole memory management accross the |
20 // browser and child proceeses. It dispatches memory events to its clients and | 20 // browser and child proceeses. It dispatches memory events to its clients and |
21 // child processes based on its best knowledge of the memory usage. | 21 // child processes based on its best knowledge of the memory usage. |
22 class MEMORY_COORDINATOR_EXPORT MemoryCoordinator { | 22 class CONTENT_EXPORT MemoryCoordinator { |
23 public: | 23 public: |
24 ~MemoryCoordinator(); | 24 ~MemoryCoordinator(); |
25 | 25 |
26 // Singleton factory/accessor. | 26 // Singleton factory/accessor. |
27 static MemoryCoordinator* GetInstance(); | 27 static MemoryCoordinator* GetInstance(); |
28 | 28 |
29 // Creates a handle to the provided child process. | 29 // Creates a handle to the provided child process. |
30 void CreateHandle(int render_process_id, | 30 void CreateHandle(int render_process_id, |
31 mojom::MemoryCoordinatorHandleRequest request); | 31 mojom::MemoryCoordinatorHandleRequest request); |
32 | 32 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 using ChildInfoMap = std::map<int, ChildInfo>; | 79 using ChildInfoMap = std::map<int, ChildInfo>; |
80 | 80 |
81 // Tracks child processes. An entry is added when a renderer connects to | 81 // Tracks child processes. An entry is added when a renderer connects to |
82 // MemoryCoordinator and removed automatically when an underlying binding is | 82 // MemoryCoordinator and removed automatically when an underlying binding is |
83 // disconnected. | 83 // disconnected. |
84 ChildInfoMap children_; | 84 ChildInfoMap children_; |
85 | 85 |
86 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinator); | 86 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinator); |
87 }; | 87 }; |
88 | 88 |
89 } // memory_coordinator | 89 } // namespace content |
90 | 90 |
91 #endif // COMPONENTS_MEMORY_COORDINATOR_BROWSER_MEMORY_COORDINATOR_H_ | 91 #endif // CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_ |
OLD | NEW |