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

Unified Diff: cc/tiles/gpu_image_decode_cache.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/tiles/gpu_image_decode_cache.cc
diff --git a/cc/tiles/gpu_image_decode_cache.cc b/cc/tiles/gpu_image_decode_cache.cc
index 93cdd29158fe5a0c356f3f1782ef576a57e75254..d7bedad94c866c6586864d11361ad640f8240f78 100644
--- a/cc/tiles/gpu_image_decode_cache.cc
+++ b/cc/tiles/gpu_image_decode_cache.cc
@@ -1268,24 +1268,19 @@ bool GpuImageDecodeCache::IsInInUseCacheForTesting(
}
void GpuImageDecodeCache::OnMemoryStateChange(base::MemoryState state) {
- switch (state) {
- case base::MemoryState::NORMAL:
- memory_state_ = state;
- break;
- case base::MemoryState::THROTTLED:
- case base::MemoryState::SUSPENDED: {
- memory_state_ = state;
-
- // We've just changed our memory state to a (potentially) more
- // restrictive one. Re-enforce cache limits.
- base::AutoLock lock(lock_);
- EnsureCapacity(0);
- break;
- }
- case base::MemoryState::UNKNOWN:
- // NOT_REACHED.
- break;
- }
+ memory_state_ = state;
+
+ // 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)
ericrk 2017/01/30 15:58:56 The previous logic handled THROTTLED as well, with
bashi 2017/01/31 19:30:56 The purpose of this CL is to separate purging cach
+ OnPurgeMemory();
+}
+
+void GpuImageDecodeCache::OnPurgeMemory() {
+ base::AutoLock lock(lock_);
+ EnsureCapacity(0);
}
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698