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

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

Issue 2479673002: Expose MemoryCoordinator's global budget information. (Closed)
Patch Set: Small cleanup. Created 4 years, 1 month 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
Index: content/browser/memory/memory_coordinator.cc
diff --git a/content/browser/memory/memory_coordinator.cc b/content/browser/memory/memory_coordinator.cc
index 517aaedc34a1a13f696d9e0532c5c4c9117458a1..2f8b906f7906c4e710b08b9c064414cdef2976dc 100644
--- a/content/browser/memory/memory_coordinator.cc
+++ b/content/browser/memory/memory_coordinator.cc
@@ -112,6 +112,24 @@ bool MemoryCoordinator::SetMemoryState(int render_process_id,
return true;
}
+bool MemoryCoordinator::SetRemainingGlobalBudget(
+ int render_process_id, int64_t remaining_global_budget_mb) {
+ // Can't send a message to a child that doesn't exist.
+ auto iter = children_.find(render_process_id);
+ if (iter == children_.end())
+ return false;
+
+ // Can't send a message to a child that isn't bound.
+ if (!iter->second.handle->child().is_bound())
+ return false;
+
+ // Send the new budget.
+ iter->second.handle->child()->SetRemainingGlobalBudget(
+ remaining_global_budget_mb);
+
+ return true;
+}
+
mojom::MemoryState MemoryCoordinator::GetMemoryState(
int render_process_id) const {
auto iter = children_.find(render_process_id);
@@ -136,6 +154,10 @@ void MemoryCoordinator::SetCurrentMemoryStateForTesting(
base::MemoryState memory_state) {
}
+int64_t MemoryCoordinator::GetRemainingGlobalBudget() const {
+ return 0;
+}
+
void MemoryCoordinator::AddChildForTesting(
int dummy_render_process_id, mojom::ChildMemoryCoordinatorPtr child) {
mojom::MemoryCoordinatorHandlePtr mch;

Powered by Google App Engine
This is Rietveld 408576698