Chromium Code Reviews| 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 |