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. |