Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Unified Diff: content/browser/memory/memory_coordinator.cc

Issue 2413643002: Add MemoryCoordinator::SetClientMemoryState and GetClientMemoryState (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/memory/memory_coordinator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/memory/memory_coordinator.cc
diff --git a/content/browser/memory/memory_coordinator.cc b/content/browser/memory/memory_coordinator.cc
index 52ee2ece71f8a47def79edd5401bd9c791680b49..e6d0a660c3547b2fc4d223651bc5796e1a741373 100644
--- a/content/browser/memory/memory_coordinator.cc
+++ b/content/browser/memory/memory_coordinator.cc
@@ -41,7 +41,8 @@ MemoryCoordinator* MemoryCoordinator::GetInstance() {
base::LeakySingletonTraits<MemoryCoordinator>>::get();
}
-MemoryCoordinator::MemoryCoordinator() {}
+MemoryCoordinator::MemoryCoordinator()
+ : client_memory_state_(base::MemoryState::NORMAL) {}
MemoryCoordinator::~MemoryCoordinator() {}
@@ -81,6 +82,11 @@ bool MemoryCoordinator::SetMemoryState(int render_process_id,
return true;
}
+void MemoryCoordinator::SetClientMemoryState(base::MemoryState memory_state) {
haraken 2016/10/12 08:11:45 Who are you assuming calls this method? Also Chri
+ client_memory_state_ = memory_state;
+ base::MemoryCoordinatorClientRegistry::GetInstance()->Notify(memory_state);
+}
+
mojom::MemoryState MemoryCoordinator::GetMemoryState(
int render_process_id) const {
auto iter = children_.find(render_process_id);
@@ -89,6 +95,10 @@ mojom::MemoryState MemoryCoordinator::GetMemoryState(
return iter->second.memory_state;
}
+base::MemoryState MemoryCoordinator::GetClientMemoryState() const {
+ return client_memory_state_;
+}
+
void MemoryCoordinator::AddChildForTesting(
int dummy_render_process_id, mojom::ChildMemoryCoordinatorPtr child) {
mojom::MemoryCoordinatorHandlePtr mch;
« no previous file with comments | « content/browser/memory/memory_coordinator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698