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

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

Issue 2402643002: Make RenderThreadImpl a client of memory coordinator (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
Index: third_party/WebKit/Source/platform/MemoryCoordinator.cpp
diff --git a/third_party/WebKit/Source/platform/MemoryCoordinator.cpp b/third_party/WebKit/Source/platform/MemoryCoordinator.cpp
index 170232e7fb3dd5c50a4023178830e75651f262d5..640b7cd563bc721985cab0461023f92d4f0cabb4 100644
--- a/third_party/WebKit/Source/platform/MemoryCoordinator.cpp
+++ b/third_party/WebKit/Source/platform/MemoryCoordinator.cpp
@@ -42,7 +42,17 @@ void MemoryCoordinator::onMemoryPressure(WebMemoryPressureLevel level) {
TRACE_EVENT0("blink", "MemoryCoordinator::onMemoryPressure");
for (auto& client : m_clients)
client->onMemoryPressure(level);
- if (level == WebMemoryPressureLevelCritical) {
+ clearMemory(level == WebMemoryPressureLevelCritical);
+}
+
+void MemoryCoordinator::onMemoryStateChange(MemoryState state) {
+ for (auto& client : m_clients)
+ client->onMemoryStateChange(state);
+ clearMemory(state == MemoryState::SUSPENDED);
+}
+
+void MemoryCoordinator::clearMemory(bool critical) {
haraken 2016/10/07 11:45:30 I'd avoid introducing a boolean flag. See my below
hajimehoshi 2016/10/11 07:05:32 Done.
+ if (critical) {
// Clear the image cache.
// TODO(tasak|bashi): Make ImageDecodingStore and FontCache be
// MemoryCoordinatorClients rather than clearing caches here.

Powered by Google App Engine
This is Rietveld 408576698