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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/prioritized_resource.h" | 7 #include "cc/prioritized_resource.h" |
8 | 8 |
9 #include "cc/platform_color.h" | 9 #include "cc/platform_color.h" |
10 #include "cc/prioritized_resource_manager.h" | 10 #include "cc/prioritized_resource_manager.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 } | 146 } |
147 | 147 |
148 PrioritizedResource::Backing::~Backing() | 148 PrioritizedResource::Backing::~Backing() |
149 { | 149 { |
150 DCHECK(!m_owner); | 150 DCHECK(!m_owner); |
151 DCHECK(m_resourceHasBeenDeleted); | 151 DCHECK(m_resourceHasBeenDeleted); |
152 } | 152 } |
153 | 153 |
154 void PrioritizedResource::Backing::deleteResource(ResourceProvider* resourceProv
ider) | 154 void PrioritizedResource::Backing::deleteResource(ResourceProvider* resourceProv
ider) |
155 { | 155 { |
156 DCHECK(Proxy::isImplThread()); | 156 DCHECK(!proxy() || proxy()->isImplThread()); |
157 DCHECK(!m_resourceHasBeenDeleted); | 157 DCHECK(!m_resourceHasBeenDeleted); |
158 #ifndef NDEBUG | 158 #ifndef NDEBUG |
159 DCHECK(resourceProvider == m_resourceProvider); | 159 DCHECK(resourceProvider == m_resourceProvider); |
160 #endif | 160 #endif |
161 | 161 |
162 resourceProvider->deleteResource(id()); | 162 resourceProvider->deleteResource(id()); |
163 setId(0); | 163 setId(0); |
164 m_resourceHasBeenDeleted = true; | 164 m_resourceHasBeenDeleted = true; |
165 } | 165 } |
166 | 166 |
167 bool PrioritizedResource::Backing::resourceHasBeenDeleted() const | 167 bool PrioritizedResource::Backing::resourceHasBeenDeleted() const |
168 { | 168 { |
169 DCHECK(Proxy::isImplThread()); | 169 DCHECK(!proxy() || proxy()->isImplThread()); |
170 return m_resourceHasBeenDeleted; | 170 return m_resourceHasBeenDeleted; |
171 } | 171 } |
172 | 172 |
173 bool PrioritizedResource::Backing::canBeRecycled() const | 173 bool PrioritizedResource::Backing::canBeRecycled() const |
174 { | 174 { |
175 DCHECK(Proxy::isImplThread()); | 175 DCHECK(!proxy() || proxy()->isImplThread()); |
176 return !m_wasAbovePriorityCutoffAtLastPriorityUpdate && !m_inDrawingImplTree
; | 176 return !m_wasAbovePriorityCutoffAtLastPriorityUpdate && !m_inDrawingImplTree
; |
177 } | 177 } |
178 | 178 |
179 void PrioritizedResource::Backing::updatePriority() | 179 void PrioritizedResource::Backing::updatePriority() |
180 { | 180 { |
181 DCHECK(Proxy::isImplThread() && Proxy::isMainThreadBlocked()); | 181 DCHECK(!proxy() || proxy()->isImplThread() && proxy()->isMainThreadBlocked()
); |
182 if (m_owner) { | 182 if (m_owner) { |
183 m_priorityAtLastPriorityUpdate = m_owner->requestPriority(); | 183 m_priorityAtLastPriorityUpdate = m_owner->requestPriority(); |
184 m_wasAbovePriorityCutoffAtLastPriorityUpdate = m_owner->isAbovePriorityC
utoff(); | 184 m_wasAbovePriorityCutoffAtLastPriorityUpdate = m_owner->isAbovePriorityC
utoff(); |
185 } else { | 185 } else { |
186 m_priorityAtLastPriorityUpdate = PriorityCalculator::lowestPriority(); | 186 m_priorityAtLastPriorityUpdate = PriorityCalculator::lowestPriority(); |
187 m_wasAbovePriorityCutoffAtLastPriorityUpdate = false; | 187 m_wasAbovePriorityCutoffAtLastPriorityUpdate = false; |
188 } | 188 } |
189 } | 189 } |
190 | 190 |
191 void PrioritizedResource::Backing::updateInDrawingImplTree() | 191 void PrioritizedResource::Backing::updateInDrawingImplTree() |
192 { | 192 { |
193 DCHECK(Proxy::isImplThread() && Proxy::isMainThreadBlocked()); | 193 DCHECK(!proxy() || proxy()->isImplThread() && proxy()->isMainThreadBlocked()
); |
194 m_inDrawingImplTree = !!owner(); | 194 m_inDrawingImplTree = !!owner(); |
195 if (!m_inDrawingImplTree) | 195 if (!m_inDrawingImplTree) |
196 DCHECK(m_priorityAtLastPriorityUpdate == PriorityCalculator::lowestPrior
ity()); | 196 DCHECK(m_priorityAtLastPriorityUpdate == PriorityCalculator::lowestPrior
ity()); |
197 } | 197 } |
198 | 198 |
199 void PrioritizedResource::returnBackingTexture() | 199 void PrioritizedResource::returnBackingTexture() |
200 { | 200 { |
201 DCHECK(m_manager || !m_backing); | 201 DCHECK(m_manager || !m_backing); |
202 if (m_manager) | 202 if (m_manager) |
203 m_manager->returnBackingTexture(this); | 203 m_manager->returnBackingTexture(this); |
204 } | 204 } |
205 | 205 |
| 206 const Proxy* PrioritizedResource::Backing::proxy() const |
| 207 { |
| 208 if (!m_owner || !m_owner->resourceManager()) |
| 209 return 0; |
| 210 return m_owner->resourceManager()->proxyForDebug(); |
| 211 } |
| 212 |
206 } // namespace cc | 213 } // namespace cc |
OLD | NEW |