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 | |
34 // Starts monitoring memory usage. After calling this method, memory | 32 // Starts monitoring memory usage. After calling this method, memory |
35 // coordinator will start dispatching state changes. | 33 // coordinator will start dispatching state changes. |
36 virtual void Start() {} | 34 virtual void Start() {} |
37 | 35 |
38 // Creates a handle to the provided child process. | 36 // Creates a handle to the provided child process. |
39 void CreateHandle(int render_process_id, | 37 void CreateHandle(int render_process_id, |
40 mojom::MemoryCoordinatorHandleRequest request); | 38 mojom::MemoryCoordinatorHandleRequest request); |
41 | 39 |
42 // Returns number of children. Only used for testing. | 40 // Returns number of children. Only used for testing. |
43 size_t NumChildrenForTesting(); | 41 size_t NumChildrenForTesting(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 ChildInfoMap children_; | 103 ChildInfoMap children_; |
106 | 104 |
107 std::unique_ptr<MemoryCoordinatorDelegate> delegate_; | 105 std::unique_ptr<MemoryCoordinatorDelegate> delegate_; |
108 | 106 |
109 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinator); | 107 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinator); |
110 }; | 108 }; |
111 | 109 |
112 } // namespace content | 110 } // namespace content |
113 | 111 |
114 #endif // CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_ | 112 #endif // CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_ |
OLD | NEW |