| 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/prioritized_resource.h" | 5 #include "cc/resources/prioritized_resource.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "cc/resources/platform_color.h" | 9 #include "cc/resources/platform_color.h" |
| 10 #include "cc/resources/prioritized_resource_manager.h" | 10 #include "cc/resources/prioritized_resource_manager.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 PrioritizedResource::Backing::Backing(unsigned id, | 119 PrioritizedResource::Backing::Backing(unsigned id, |
| 120 ResourceProvider* resource_provider, | 120 ResourceProvider* resource_provider, |
| 121 const gfx::Size& size, | 121 const gfx::Size& size, |
| 122 ResourceFormat format) | 122 ResourceFormat format) |
| 123 : Resource(id, size, format), | 123 : Resource(id, size, format), |
| 124 owner_(NULL), | 124 owner_(NULL), |
| 125 priority_at_last_priority_update_(PriorityCalculator::LowestPriority()), | 125 priority_at_last_priority_update_(PriorityCalculator::LowestPriority()), |
| 126 was_above_priority_cutoff_at_last_priority_update_(false), | 126 was_above_priority_cutoff_at_last_priority_update_(false), |
| 127 in_drawing_impl_tree_(false), | 127 in_drawing_impl_tree_(false), |
| 128 in_parent_compositor_(false), | 128 in_parent_compositor_(false), |
| 129 #if !DCHECK_IS_ON | 129 #if !DCHECK_IS_ON() |
| 130 resource_has_been_deleted_(false) { | 130 resource_has_been_deleted_(false) { |
| 131 #else | 131 #else |
| 132 resource_has_been_deleted_(false), | 132 resource_has_been_deleted_(false), |
| 133 resource_provider_(resource_provider) { | 133 resource_provider_(resource_provider) { |
| 134 #endif | 134 #endif |
| 135 } | 135 } |
| 136 | 136 |
| 137 PrioritizedResource::Backing::~Backing() { | 137 PrioritizedResource::Backing::~Backing() { |
| 138 DCHECK(!owner_); | 138 DCHECK(!owner_); |
| 139 DCHECK(resource_has_been_deleted_); | 139 DCHECK(resource_has_been_deleted_); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void PrioritizedResource::Backing::DeleteResource( | 142 void PrioritizedResource::Backing::DeleteResource( |
| 143 ResourceProvider* resource_provider) { | 143 ResourceProvider* resource_provider) { |
| 144 DCHECK(!proxy() || proxy()->IsImplThread()); | 144 DCHECK(!proxy() || proxy()->IsImplThread()); |
| 145 DCHECK(!resource_has_been_deleted_); | 145 DCHECK(!resource_has_been_deleted_); |
| 146 #if DCHECK_IS_ON | 146 #if DCHECK_IS_ON() |
| 147 DCHECK(resource_provider == resource_provider_); | 147 DCHECK(resource_provider == resource_provider_); |
| 148 #endif | 148 #endif |
| 149 | 149 |
| 150 resource_provider->DeleteResource(id()); | 150 resource_provider->DeleteResource(id()); |
| 151 set_id(0); | 151 set_id(0); |
| 152 resource_has_been_deleted_ = true; | 152 resource_has_been_deleted_ = true; |
| 153 } | 153 } |
| 154 | 154 |
| 155 bool PrioritizedResource::Backing::ResourceHasBeenDeleted() const { | 155 bool PrioritizedResource::Backing::ResourceHasBeenDeleted() const { |
| 156 DCHECK(!proxy() || proxy()->IsImplThread()); | 156 DCHECK(!proxy() || proxy()->IsImplThread()); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 manager_->ReturnBackingTexture(this); | 194 manager_->ReturnBackingTexture(this); |
| 195 } | 195 } |
| 196 | 196 |
| 197 const Proxy* PrioritizedResource::Backing::proxy() const { | 197 const Proxy* PrioritizedResource::Backing::proxy() const { |
| 198 if (!owner_ || !owner_->resource_manager()) | 198 if (!owner_ || !owner_->resource_manager()) |
| 199 return NULL; | 199 return NULL; |
| 200 return owner_->resource_manager()->ProxyForDebug(); | 200 return owner_->resource_manager()->ProxyForDebug(); |
| 201 } | 201 } |
| 202 | 202 |
| 203 } // namespace cc | 203 } // namespace cc |
| OLD | NEW |