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 CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_ | 5 #ifndef CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_ |
6 #define CONTENT_BROWSER_MEMORY_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/memory_pressure_monitor.h" | 9 #include "base/memory/memory_pressure_monitor.h" |
10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 // MemoryCoordinator is responsible for the whole memory management accross the | 23 // MemoryCoordinator is responsible for the whole memory management accross the |
24 // browser and child proceeses. It dispatches memory events to its clients and | 24 // browser and child proceeses. It dispatches memory events to its clients and |
25 // child processes based on its best knowledge of the memory usage. | 25 // child processes based on its best knowledge of the memory usage. |
26 class CONTENT_EXPORT MemoryCoordinator { | 26 class CONTENT_EXPORT MemoryCoordinator { |
27 public: | 27 public: |
28 virtual ~MemoryCoordinator(); | 28 virtual ~MemoryCoordinator(); |
29 | 29 |
30 // Singleton factory/accessor. | 30 // Singleton factory/accessor. |
31 static MemoryCoordinator* GetInstance(); | 31 static MemoryCoordinator* GetInstance(); |
32 | 32 |
33 static void EnableFeaturesForTesting(); | |
34 | |
35 // Starts monitoring memory usage. After calling this method, memory | 33 // Starts monitoring memory usage. After calling this method, memory |
36 // coordinator will start dispatching state changes. | 34 // coordinator will start dispatching state changes. |
37 virtual void Start() {} | 35 virtual void Start() {} |
38 | 36 |
39 // Creates a handle to the provided child process. | 37 // Creates a handle to the provided child process. |
40 void CreateHandle(int render_process_id, | 38 void CreateHandle(int render_process_id, |
41 mojom::MemoryCoordinatorHandleRequest request); | 39 mojom::MemoryCoordinatorHandleRequest request); |
42 | 40 |
43 // Returns number of children. Only used for testing. | 41 // Returns number of children. Only used for testing. |
44 size_t NumChildrenForTesting(); | 42 size_t NumChildrenForTesting(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 ChildInfoMap children_; | 109 ChildInfoMap children_; |
112 | 110 |
113 std::unique_ptr<MemoryCoordinatorDelegate> delegate_; | 111 std::unique_ptr<MemoryCoordinatorDelegate> delegate_; |
114 | 112 |
115 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinator); | 113 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinator); |
116 }; | 114 }; |
117 | 115 |
118 } // namespace content | 116 } // namespace content |
119 | 117 |
120 #endif // CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_ | 118 #endif // CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_ |
OLD | NEW |