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

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

Issue 2689463002: Replace OnMemoryStateChange() with OnPurgeMemory() in blink (Closed)
Patch Set: Created 3 years, 10 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 8dd8a6572cbc586c17eef410f592877017b42426..c011a96309465cadcd7752a07be0ed54a0163747 100644
--- a/third_party/WebKit/Source/platform/MemoryCoordinator.cpp
+++ b/third_party/WebKit/Source/platform/MemoryCoordinator.cpp
@@ -65,19 +65,15 @@ void MemoryCoordinator::onMemoryPressure(WebMemoryPressureLevel level) {
void MemoryCoordinator::onMemoryStateChange(MemoryState state) {
for (auto& client : m_clients)
client->onMemoryStateChange(state);
- // Font cache invalidation always causes full layout. This increases
- // tab switching cost significantly (e.g. en.wikipedia.org/wiki/Wikipedia).
- // So we should not invalidate the font cache in purge+throttle. We should
- // invalidate the font cache only when receiving a critical memory pressure.
- if (state == MemoryState::SUSPENDED)
- ImageDecodingStore::instance().clear();
- WTF::Partitions::decommitFreeableMemory();
}
void MemoryCoordinator::onPurgeMemory() {
- // TODO(tasak|bashi): Move code from onMemoryStateChange(). Currently
- // onMemoryStateChange() is called when the purge+throttled experiment is
- // enabled.
+ // Don't call clearMemory() because font cache invalidation always causes full
+ // layout. This increases tab switching cost significantly (e.g.
+ // en.wikipedia.org/wiki/Wikipedia). So we should not invalidate the font
+ // cache in purge+throttle.
+ ImageDecodingStore::instance().clear();
+ WTF::Partitions::decommitFreeableMemory();
}
void MemoryCoordinator::clearMemory() {
« no previous file with comments | « third_party/WebKit/Source/platform/MemoryCoordinator.h ('k') | third_party/WebKit/Source/platform/loader/fetch/Resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698