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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 int render_process_id, mojom::MemoryState memory_state); | 49 int render_process_id, mojom::MemoryState memory_state); |
50 | 50 |
51 // Returns the memory state of the specified render process. Returns UNKNOWN | 51 // Returns the memory state of the specified render process. Returns UNKNOWN |
52 // if the process is not tracked by this coordinator. | 52 // if the process is not tracked by this coordinator. |
53 mojom::MemoryState GetMemoryState(int render_process_id) const; | 53 mojom::MemoryState GetMemoryState(int render_process_id) const; |
54 | 54 |
55 // Called when ChildMemoryCoordinator calls AddChild(). | 55 // Called when ChildMemoryCoordinator calls AddChild(). |
56 virtual void OnChildAdded(int render_process_id) {} | 56 virtual void OnChildAdded(int render_process_id) {} |
57 | 57 |
58 virtual base::MemoryState GetCurrentMemoryState() const; | 58 virtual base::MemoryState GetCurrentMemoryState() const; |
| 59 virtual void SetCurrentMemoryStateForTesting(base::MemoryState memory_state); |
59 | 60 |
60 protected: | 61 protected: |
61 // Constructor. Protected as this is a singleton, but accessible for | 62 // Constructor. Protected as this is a singleton, but accessible for |
62 // unittests. | 63 // unittests. |
63 MemoryCoordinator(); | 64 MemoryCoordinator(); |
64 | 65 |
65 // Adds the given ChildMemoryCoordinator as a child of this coordinator. | 66 // Adds the given ChildMemoryCoordinator as a child of this coordinator. |
66 void AddChildForTesting(int dummy_render_process_id, | 67 void AddChildForTesting(int dummy_render_process_id, |
67 mojom::ChildMemoryCoordinatorPtr child); | 68 mojom::ChildMemoryCoordinatorPtr child); |
68 | 69 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 ChildInfoMap children_; | 105 ChildInfoMap children_; |
105 | 106 |
106 std::unique_ptr<MemoryCoordinatorDelegate> delegate_; | 107 std::unique_ptr<MemoryCoordinatorDelegate> delegate_; |
107 | 108 |
108 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinator); | 109 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinator); |
109 }; | 110 }; |
110 | 111 |
111 } // namespace content | 112 } // namespace content |
112 | 113 |
113 #endif // CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_ | 114 #endif // CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_ |
OLD | NEW |