Chromium Code Reviews| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 bool SetMemoryState( | 45 bool SetMemoryState( |
| 46 int render_process_id, mojom::MemoryState memory_state); | 46 int render_process_id, mojom::MemoryState memory_state); |
| 47 | 47 |
| 48 // Returns the memory state of the specified render process. Returns UNKNOWN | 48 // Returns the memory state of the specified render process. Returns UNKNOWN |
| 49 // if the process is not tracked by this coordinator. | 49 // if the process is not tracked by this coordinator. |
| 50 mojom::MemoryState GetMemoryState(int render_process_id) const; | 50 mojom::MemoryState GetMemoryState(int render_process_id) const; |
| 51 | 51 |
| 52 // Called when ChildMemoryCoordinator calls AddChild(). | 52 // Called when ChildMemoryCoordinator calls AddChild(). |
| 53 virtual void OnChildAdded(int render_process_id) {} | 53 virtual void OnChildAdded(int render_process_id) {} |
| 54 | 54 |
| 55 virtual base::MemoryState GetCurrentState() const = 0; | |
|
haraken
2016/10/13 09:27:20
GetCurrentMemoryState
bashi
2016/10/13 23:16:34
nit: I'd prefer to return UNKNOWN so that TestMemo
hajimehoshi
2016/10/14 07:37:47
Done.
| |
| 56 | |
| 55 protected: | 57 protected: |
| 56 // Constructor. Protected as this is a singleton, but accessible for | 58 // Constructor. Protected as this is a singleton, but accessible for |
| 57 // unittests. | 59 // unittests. |
| 58 MemoryCoordinator(); | 60 MemoryCoordinator(); |
| 59 | 61 |
| 60 // Adds the given ChildMemoryCoordinator as a child of this coordinator. | 62 // Adds the given ChildMemoryCoordinator as a child of this coordinator. |
| 61 void AddChildForTesting(int dummy_render_process_id, | 63 void AddChildForTesting(int dummy_render_process_id, |
| 62 mojom::ChildMemoryCoordinatorPtr child); | 64 mojom::ChildMemoryCoordinatorPtr child); |
| 63 | 65 |
| 64 // Callback invoked by mojo when the child connection goes down. Exposed | 66 // Callback invoked by mojo when the child connection goes down. Exposed |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 91 // MemoryCoordinator and removed automatically when an underlying binding is | 93 // MemoryCoordinator and removed automatically when an underlying binding is |
| 92 // disconnected. | 94 // disconnected. |
| 93 ChildInfoMap children_; | 95 ChildInfoMap children_; |
| 94 | 96 |
| 95 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinator); | 97 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinator); |
| 96 }; | 98 }; |
| 97 | 99 |
| 98 } // namespace content | 100 } // namespace content |
| 99 | 101 |
| 100 #endif // CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_ | 102 #endif // CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_ |
| OLD | NEW |