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

Unified Diff: cc/resources/resource_pool.cc

Issue 2664703002: Move purging from OnMemoryState to OnPurgeMemory() in cc/ (Closed)
Patch Set: Created 3 years, 11 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: cc/resources/resource_pool.cc
diff --git a/cc/resources/resource_pool.cc b/cc/resources/resource_pool.cc
index 61a7ae3f9fdc6519376a1b473631a73bc7cd3d40..54e33c5f5bbdab328b6e3f9606ca23ed12c2e0ef 100644
--- a/cc/resources/resource_pool.cc
+++ b/cc/resources/resource_pool.cc
@@ -481,22 +481,17 @@ bool ResourcePool::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
}
void ResourcePool::OnMemoryStateChange(base::MemoryState state) {
- switch (state) {
- case base::MemoryState::NORMAL:
- // TODO(tasak): go back to normal state.
- break;
- case base::MemoryState::THROTTLED:
- // TODO(tasak): make the limits of this component's caches smaller to
- // save memory usage.
- break;
- case base::MemoryState::SUSPENDED:
- // Release all resources, regardless of how recently they were used.
- EvictResourcesNotUsedSince(base::TimeTicks() + base::TimeDelta::Max());
- break;
- case base::MemoryState::UNKNOWN:
- // NOT_REACHED.
- break;
- }
+ // TODO(bashi): We are going to separate purging from state changes and we
+ // shouldn't purge memory here (crbug.com/684287). Tentatively call
+ // OnPurgeMemory() so that we don't break existing experiments.
+ // (i.e. purge+suspend experiment)
+ if (state == base::MemoryState::SUSPENDED)
+ OnPurgeMemory();
+}
+
+void ResourcePool::OnPurgeMemory() {
+ // Release all resources, regardless of how recently they were used.
+ EvictResourcesNotUsedSince(base::TimeTicks() + base::TimeDelta::Max());
}
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698