| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 return resource_has_been_deleted_; | 158 return resource_has_been_deleted_; |
| 159 } | 159 } |
| 160 | 160 |
| 161 bool PrioritizedResource::Backing::CanBeRecycled() const { | 161 bool PrioritizedResource::Backing::CanBeRecycled() const { |
| 162 DCHECK(!proxy() || proxy()->IsImplThread()); | 162 DCHECK(!proxy() || proxy()->IsImplThread()); |
| 163 return !was_above_priority_cutoff_at_last_priority_update_ && | 163 return !was_above_priority_cutoff_at_last_priority_update_ && |
| 164 !in_drawing_impl_tree_; | 164 !in_drawing_impl_tree_; |
| 165 } | 165 } |
| 166 | 166 |
| 167 void PrioritizedResource::Backing::UpdatePriority() { | 167 void PrioritizedResource::Backing::UpdatePriority() { |
| 168 DCHECK(!proxy() || proxy()->IsImplThread() && proxy()->IsMainThreadBlocked()); | 168 DCHECK(!proxy() || |
| 169 (proxy()->IsImplThread() && proxy()->IsMainThreadBlocked())); |
| 169 if (owner_) { | 170 if (owner_) { |
| 170 priority_at_last_priority_update_ = owner_->request_priority(); | 171 priority_at_last_priority_update_ = owner_->request_priority(); |
| 171 was_above_priority_cutoff_at_last_priority_update_ = | 172 was_above_priority_cutoff_at_last_priority_update_ = |
| 172 owner_->is_above_priority_cutoff(); | 173 owner_->is_above_priority_cutoff(); |
| 173 } else { | 174 } else { |
| 174 priority_at_last_priority_update_ = PriorityCalculator::LowestPriority(); | 175 priority_at_last_priority_update_ = PriorityCalculator::LowestPriority(); |
| 175 was_above_priority_cutoff_at_last_priority_update_ = false; | 176 was_above_priority_cutoff_at_last_priority_update_ = false; |
| 176 } | 177 } |
| 177 } | 178 } |
| 178 | 179 |
| 179 void PrioritizedResource::Backing::UpdateInDrawingImplTree() { | 180 void PrioritizedResource::Backing::UpdateInDrawingImplTree() { |
| 180 DCHECK(!proxy() || proxy()->IsImplThread() && proxy()->IsMainThreadBlocked()); | 181 DCHECK(!proxy() || |
| 182 (proxy()->IsImplThread() && proxy()->IsMainThreadBlocked())); |
| 181 in_drawing_impl_tree_ = !!owner(); | 183 in_drawing_impl_tree_ = !!owner(); |
| 182 if (!in_drawing_impl_tree_) { | 184 if (!in_drawing_impl_tree_) { |
| 183 DCHECK_EQ(priority_at_last_priority_update_, | 185 DCHECK_EQ(priority_at_last_priority_update_, |
| 184 PriorityCalculator::LowestPriority()); | 186 PriorityCalculator::LowestPriority()); |
| 185 } | 187 } |
| 186 } | 188 } |
| 187 | 189 |
| 188 void PrioritizedResource::ReturnBackingTexture() { | 190 void PrioritizedResource::ReturnBackingTexture() { |
| 189 DCHECK(manager_ || !backing_); | 191 DCHECK(manager_ || !backing_); |
| 190 if (manager_) | 192 if (manager_) |
| 191 manager_->ReturnBackingTexture(this); | 193 manager_->ReturnBackingTexture(this); |
| 192 } | 194 } |
| 193 | 195 |
| 194 const Proxy* PrioritizedResource::Backing::proxy() const { | 196 const Proxy* PrioritizedResource::Backing::proxy() const { |
| 195 if (!owner_ || !owner_->resource_manager()) | 197 if (!owner_ || !owner_->resource_manager()) |
| 196 return NULL; | 198 return NULL; |
| 197 return owner_->resource_manager()->ProxyForDebug(); | 199 return owner_->resource_manager()->ProxyForDebug(); |
| 198 } | 200 } |
| 199 | 201 |
| 200 } // namespace cc | 202 } // namespace cc |
| OLD | NEW |