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

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

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.h
diff --git a/content/browser/memory/memory_coordinator.h b/content/browser/memory/memory_coordinator.h
index 682f1ba628142c1a9a001c14a97179a1c8b5c3a9..0061b0d14f7e7dd541ec1b692bd95b9307b65183 100644
--- a/content/browser/memory/memory_coordinator.h
+++ b/content/browser/memory/memory_coordinator.h
@@ -48,6 +48,12 @@ class CONTENT_EXPORT MemoryCoordinator {
bool SetMemoryState(
int render_process_id, mojom::MemoryState memory_state);
+ // Dispatches a remaining global budget change to the provided process.
+ // Returns true if the process is tracked by this coordinator and successfully
+ // dispatches, false otherwise.
+ bool SetRemainingGlobalBudget(
+ int render_process_id, int64_t remaining_global_budget_mb);
+
// Returns the memory state of the specified render process. Returns UNKNOWN
// if the process is not tracked by this coordinator.
mojom::MemoryState GetMemoryState(int render_process_id) const;
@@ -58,6 +64,13 @@ class CONTENT_EXPORT MemoryCoordinator {
virtual base::MemoryState GetCurrentMemoryState() const;
virtual void SetCurrentMemoryStateForTesting(base::MemoryState memory_state);
+ // Returns the remaining global budget usable in aggregate by all Chrome
+ // processes. This indicates how many MB of memory are remaining for Chrome
+ // processes to use before the memory coordinator will take efforts to reclaim
+ // memory. A negative amount indicates that the coordinator is actively trying
+ // to reclaim that much memory.
+ virtual int64_t GetRemainingGlobalBudget() const;
+
protected:
// Constructor. Protected as this is a singleton, but accessible for
// unittests.

Powered by Google App Engine
This is Rietveld 408576698