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