Chromium Code Reviews| Index: cc/resources/resource_pool.cc |
| diff --git a/cc/resources/resource_pool.cc b/cc/resources/resource_pool.cc |
| index 5e6e426871cf63229841e7e75d4b94f731a39033..05591c3b3d7122ae740c2a64f34474b38b7beab9 100644 |
| --- a/cc/resources/resource_pool.cc |
| +++ b/cc/resources/resource_pool.cc |
| @@ -469,8 +469,15 @@ void ResourcePool::OnMemoryStateChange(base::MemoryState state) { |
| // save memory usage. |
| break; |
| case base::MemoryState::SUSPENDED: |
| - // TODO(tasak): free this component's caches as much as possible before |
| - // suspending renderer. |
| + // We are only ever SUSPENDED while in the background. While in the |
| + // background, ResourcePool already has zero memory limits and should not |
| + // be holding any resources that aren't actively in use. |
| + DCHECK_EQ(0, unused_resources_.size()); |
|
vmpstr
2016/09/23 20:59:10
Are we guaranteed that we receive this signal afte
ericrk
2016/09/23 21:26:15
My understanding was that we are only suspended wh
|
| + |
| + // The following call will drop additional busy resources. There is no |
| + // negative to this other than temporary incorrect accounting, and it |
| + // ensures the resource is freed as soon as possible. |
| + EvictResourcesNotUsedSince(base::TimeTicks() + base::TimeDelta::Max()); |
| break; |
| case base::MemoryState::UNKNOWN: |
| // NOT_REACHED. |