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

Unified Diff: third_party/WebKit/Source/platform/MemoryCoordinator.h

Issue 2860093003: Implement device-ram client hints header (Closed)
Patch Set: Rebase UseCounter.h Created 3 years, 7 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
Index: third_party/WebKit/Source/platform/MemoryCoordinator.h
diff --git a/third_party/WebKit/Source/platform/MemoryCoordinator.h b/third_party/WebKit/Source/platform/MemoryCoordinator.h
index 087eb5343ab76cdfffec30950dc765878b25b534..c8e137b01507cb8905aa481c3084201cb5ad6995 100644
--- a/third_party/WebKit/Source/platform/MemoryCoordinator.h
+++ b/third_party/WebKit/Source/platform/MemoryCoordinator.h
@@ -39,9 +39,16 @@ class PLATFORM_EXPORT MemoryCoordinator final
// Can be overridden in layout tests via internals.
static bool IsLowEndDevice();
- // Caches whether this device is a low-end device in a static member.
- // instance() is not used as it's a heap allocated object - meaning it's not
- // thread-safe as well as might break tests counting the heap size.
+ // Returns the amount of physical memory in megabytes on the device.
+ static int64_t GetPhysicalMemoryMB();
+
+ // Override the value of the physical memory for testing.
+ static void SetPhysicalMemoryMBForTesting(int64_t);
+
+ // Caches whether this device is a low-end device and the device physical
+ // memory in static members. instance() is not used as it's a heap allocated
+ // object - meaning it's not thread-safe as well as might break tests counting
+ // the heap size.
static void Initialize();
void RegisterClient(MemoryCoordinatorClient*);
@@ -67,6 +74,7 @@ class PLATFORM_EXPORT MemoryCoordinator final
void ClearMemory();
static bool is_low_end_device_;
+ static int64_t physical_memory_mb_;
HeapHashSet<WeakMember<MemoryCoordinatorClient>> clients_;
};

Powered by Google App Engine
This is Rietveld 408576698