Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/resources/resource_pool.h" | 5 #include "cc/resources/resource_pool.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 462 void ResourcePool::OnMemoryStateChange(base::MemoryState state) { | 462 void ResourcePool::OnMemoryStateChange(base::MemoryState state) { |
| 463 switch (state) { | 463 switch (state) { |
| 464 case base::MemoryState::NORMAL: | 464 case base::MemoryState::NORMAL: |
| 465 // TODO(tasak): go back to normal state. | 465 // TODO(tasak): go back to normal state. |
| 466 break; | 466 break; |
| 467 case base::MemoryState::THROTTLED: | 467 case base::MemoryState::THROTTLED: |
| 468 // TODO(tasak): make the limits of this component's caches smaller to | 468 // TODO(tasak): make the limits of this component's caches smaller to |
| 469 // save memory usage. | 469 // save memory usage. |
| 470 break; | 470 break; |
| 471 case base::MemoryState::SUSPENDED: | 471 case base::MemoryState::SUSPENDED: |
| 472 // TODO(tasak): free this component's caches as much as possible before | 472 // We are only ever SUSPENDED while in the background. While in the |
| 473 // suspending renderer. | 473 // background, ResourcePool already has zero memory limits and should not |
| 474 // be holding any resources that aren't actively in use. | |
| 475 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
| |
| 476 | |
| 477 // The following call will drop additional busy resources. There is no | |
| 478 // negative to this other than temporary incorrect accounting, and it | |
| 479 // ensures the resource is freed as soon as possible. | |
| 480 EvictResourcesNotUsedSince(base::TimeTicks() + base::TimeDelta::Max()); | |
| 474 break; | 481 break; |
| 475 case base::MemoryState::UNKNOWN: | 482 case base::MemoryState::UNKNOWN: |
| 476 // NOT_REACHED. | 483 // NOT_REACHED. |
| 477 break; | 484 break; |
| 478 } | 485 } |
| 479 } | 486 } |
| 480 | 487 |
| 481 } // namespace cc | 488 } // namespace cc |
| OLD | NEW |