| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 max_resource_count_(0), | 62 max_resource_count_(0), |
| 63 in_use_memory_usage_bytes_(0), | 63 in_use_memory_usage_bytes_(0), |
| 64 total_memory_usage_bytes_(0), | 64 total_memory_usage_bytes_(0), |
| 65 total_resource_count_(0), | 65 total_resource_count_(0), |
| 66 task_runner_(task_runner), | 66 task_runner_(task_runner), |
| 67 evict_expired_resources_pending_(false), | 67 evict_expired_resources_pending_(false), |
| 68 resource_expiration_delay_( | 68 resource_expiration_delay_( |
| 69 base::TimeDelta::FromMilliseconds(kResourceExpirationDelayMs)), | 69 base::TimeDelta::FromMilliseconds(kResourceExpirationDelayMs)), |
| 70 weak_ptr_factory_(this) { | 70 weak_ptr_factory_(this) { |
| 71 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 71 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
| 72 this, task_runner_.get()); | 72 this, "cc::ResourcePool", task_runner_.get()); |
| 73 } | 73 } |
| 74 | 74 |
| 75 ResourcePool::~ResourcePool() { | 75 ResourcePool::~ResourcePool() { |
| 76 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( | 76 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( |
| 77 this); | 77 this); |
| 78 | 78 |
| 79 DCHECK_EQ(0u, in_use_resources_.size()); | 79 DCHECK_EQ(0u, in_use_resources_.size()); |
| 80 | 80 |
| 81 while (!busy_resources_.empty()) { | 81 while (!busy_resources_.empty()) { |
| 82 DidFinishUsingResource(busy_resources_.take_front()); | 82 DidFinishUsingResource(busy_resources_.take_front()); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 for (const auto& resource : busy_resources_) { | 296 for (const auto& resource : busy_resources_) { |
| 297 resource->OnMemoryDump(pmd, resource_provider_, false /* is_free */); | 297 resource->OnMemoryDump(pmd, resource_provider_, false /* is_free */); |
| 298 } | 298 } |
| 299 for (const auto& entry : in_use_resources_) { | 299 for (const auto& entry : in_use_resources_) { |
| 300 entry.second->OnMemoryDump(pmd, resource_provider_, false /* is_free */); | 300 entry.second->OnMemoryDump(pmd, resource_provider_, false /* is_free */); |
| 301 } | 301 } |
| 302 return true; | 302 return true; |
| 303 } | 303 } |
| 304 | 304 |
| 305 } // namespace cc | 305 } // namespace cc |
| OLD | NEW |