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() || | 168 DCHECK(!proxy() || proxy()->IsImplThread() && proxy()->IsMainThreadBlocked()); |
169 (proxy()->IsImplThread() && proxy()->IsMainThreadBlocked())); | |
170 if (owner_) { | 169 if (owner_) { |
171 priority_at_last_priority_update_ = owner_->request_priority(); | 170 priority_at_last_priority_update_ = owner_->request_priority(); |
172 was_above_priority_cutoff_at_last_priority_update_ = | 171 was_above_priority_cutoff_at_last_priority_update_ = |
173 owner_->is_above_priority_cutoff(); | 172 owner_->is_above_priority_cutoff(); |
174 } else { | 173 } else { |
175 priority_at_last_priority_update_ = PriorityCalculator::LowestPriority(); | 174 priority_at_last_priority_update_ = PriorityCalculator::LowestPriority(); |
176 was_above_priority_cutoff_at_last_priority_update_ = false; | 175 was_above_priority_cutoff_at_last_priority_update_ = false; |
177 } | 176 } |
178 } | 177 } |
179 | 178 |
180 void PrioritizedResource::Backing::UpdateInDrawingImplTree() { | 179 void PrioritizedResource::Backing::UpdateInDrawingImplTree() { |
181 DCHECK(!proxy() || | 180 DCHECK(!proxy() || proxy()->IsImplThread() && proxy()->IsMainThreadBlocked()); |
182 (proxy()->IsImplThread() && proxy()->IsMainThreadBlocked())); | |
183 in_drawing_impl_tree_ = !!owner(); | 181 in_drawing_impl_tree_ = !!owner(); |
184 if (!in_drawing_impl_tree_) { | 182 if (!in_drawing_impl_tree_) { |
185 DCHECK_EQ(priority_at_last_priority_update_, | 183 DCHECK_EQ(priority_at_last_priority_update_, |
186 PriorityCalculator::LowestPriority()); | 184 PriorityCalculator::LowestPriority()); |
187 } | 185 } |
188 } | 186 } |
189 | 187 |
190 void PrioritizedResource::ReturnBackingTexture() { | 188 void PrioritizedResource::ReturnBackingTexture() { |
191 DCHECK(manager_ || !backing_); | 189 DCHECK(manager_ || !backing_); |
192 if (manager_) | 190 if (manager_) |
193 manager_->ReturnBackingTexture(this); | 191 manager_->ReturnBackingTexture(this); |
194 } | 192 } |
195 | 193 |
196 const Proxy* PrioritizedResource::Backing::proxy() const { | 194 const Proxy* PrioritizedResource::Backing::proxy() const { |
197 if (!owner_ || !owner_->resource_manager()) | 195 if (!owner_ || !owner_->resource_manager()) |
198 return NULL; | 196 return NULL; |
199 return owner_->resource_manager()->ProxyForDebug(); | 197 return owner_->resource_manager()->ProxyForDebug(); |
200 } | 198 } |
201 | 199 |
202 } // namespace cc | 200 } // namespace cc |
OLD | NEW |