| 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..e447f077d49fbb344439728d0ac0e72c7b710a4e 100644
|
| --- a/third_party/WebKit/Source/platform/MemoryCoordinator.cpp
|
| +++ b/third_party/WebKit/Source/platform/MemoryCoordinator.cpp
|
| @@ -42,16 +42,27 @@ void MemoryCoordinator::onMemoryPressure(WebMemoryPressureLevel level) {
|
| TRACE_EVENT0("blink", "MemoryCoordinator::onMemoryPressure");
|
| for (auto& client : m_clients)
|
| client->onMemoryPressure(level);
|
| - if (level == WebMemoryPressureLevelCritical) {
|
| - // Clear the image cache.
|
| - // TODO(tasak|bashi): Make ImageDecodingStore and FontCache be
|
| - // MemoryCoordinatorClients rather than clearing caches here.
|
| - ImageDecodingStore::instance().clear();
|
| - FontCache::fontCache()->invalidate();
|
| - }
|
| + if (level == WebMemoryPressureLevelCritical)
|
| + clearMemory();
|
| WTF::Partitions::decommitFreeableMemory();
|
| }
|
|
|
| +void MemoryCoordinator::onMemoryStateChange(MemoryState state) {
|
| + for (auto& client : m_clients)
|
| + client->onMemoryStateChange(state);
|
| + if (state == MemoryState::SUSPENDED)
|
| + clearMemory();
|
| + WTF::Partitions::decommitFreeableMemory();
|
| +}
|
| +
|
| +void MemoryCoordinator::clearMemory() {
|
| + // Clear the image cache.
|
| + // TODO(tasak|bashi): Make ImageDecodingStore and FontCache be
|
| + // MemoryCoordinatorClients rather than clearing caches here.
|
| + ImageDecodingStore::instance().clear();
|
| + FontCache::fontCache()->invalidate();
|
| +}
|
| +
|
| DEFINE_TRACE(MemoryCoordinator) {
|
| visitor->trace(m_clients);
|
| }
|
|
|