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