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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 for (const auto& resource : busy_resources_) { | 300 for (const auto& resource : busy_resources_) { |
301 resource->OnMemoryDump(pmd, resource_provider_, false /* is_free */); | 301 resource->OnMemoryDump(pmd, resource_provider_, false /* is_free */); |
302 } | 302 } |
303 for (const auto& entry : in_use_resources_) { | 303 for (const auto& entry : in_use_resources_) { |
304 entry.second->OnMemoryDump(pmd, resource_provider_, false /* is_free */); | 304 entry.second->OnMemoryDump(pmd, resource_provider_, false /* is_free */); |
305 } | 305 } |
306 return true; | 306 return true; |
307 } | 307 } |
308 | 308 |
309 } // namespace cc | 309 } // namespace cc |
OLD | NEW |