Chromium Code Reviews| 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_texture.h" | 7 #include "cc/prioritized_texture.h" |
| 8 | 8 |
| 9 #include "cc/platform_color.h" | 9 #include "cc/platform_color.h" |
| 10 #include "cc/prioritized_texture_manager.h" | 10 #include "cc/prioritized_texture_manager.h" |
| 11 #include "cc/priority_calculator.h" | 11 #include "cc/priority_calculator.h" |
| 12 #include "cc/proxy.h" | |
| 13 #include <algorithm> | 12 #include <algorithm> |
| 14 | 13 |
| 15 using namespace std; | 14 using namespace std; |
| 16 | 15 |
| 17 namespace cc { | 16 namespace cc { |
| 18 | 17 |
| 19 PrioritizedTexture::PrioritizedTexture(PrioritizedTextureManager* manager, IntSi ze size, GLenum format) | 18 PrioritizedTexture::PrioritizedTexture(PrioritizedTextureManager* manager, IntSi ze size, GLenum format) |
| 20 : m_size(size) | 19 : m_size(size) |
| 21 , m_format(format) | 20 , m_format(format) |
| 22 , m_bytes(0) | 21 , m_bytes(0) |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 } | 145 } |
| 147 | 146 |
| 148 PrioritizedTexture::Backing::~Backing() | 147 PrioritizedTexture::Backing::~Backing() |
| 149 { | 148 { |
| 150 DCHECK(!m_owner); | 149 DCHECK(!m_owner); |
| 151 DCHECK(m_resourceHasBeenDeleted); | 150 DCHECK(m_resourceHasBeenDeleted); |
| 152 } | 151 } |
| 153 | 152 |
| 154 void PrioritizedTexture::Backing::deleteResource(ResourceProvider* resourceProvi der) | 153 void PrioritizedTexture::Backing::deleteResource(ResourceProvider* resourceProvi der) |
| 155 { | 154 { |
| 156 DCHECK(Proxy::isImplThread()); | 155 DCHECK(m_threadChecker.CalledOnValidThread()); |
| 157 DCHECK(!m_resourceHasBeenDeleted); | 156 DCHECK(!m_resourceHasBeenDeleted); |
| 158 #ifndef NDEBUG | 157 #ifndef NDEBUG |
| 159 DCHECK(resourceProvider == m_resourceProvider); | 158 DCHECK(resourceProvider == m_resourceProvider); |
| 160 #endif | 159 #endif |
| 161 | 160 |
| 162 resourceProvider->deleteResource(id()); | 161 resourceProvider->deleteResource(id()); |
| 163 setId(0); | 162 setId(0); |
| 164 m_resourceHasBeenDeleted = true; | 163 m_resourceHasBeenDeleted = true; |
| 165 } | 164 } |
| 166 | 165 |
| 167 bool PrioritizedTexture::Backing::resourceHasBeenDeleted() const | 166 bool PrioritizedTexture::Backing::resourceHasBeenDeleted() const |
| 168 { | 167 { |
| 169 DCHECK(Proxy::isImplThread()); | 168 DCHECK(m_threadChecker.CalledOnValidThread()); |
| 170 return m_resourceHasBeenDeleted; | 169 return m_resourceHasBeenDeleted; |
| 171 } | 170 } |
| 172 | 171 |
| 173 bool PrioritizedTexture::Backing::canBeRecycled() const | 172 bool PrioritizedTexture::Backing::canBeRecycled() const |
| 174 { | 173 { |
| 175 DCHECK(Proxy::isImplThread()); | 174 DCHECK(m_threadChecker.CalledOnValidThread()); |
| 176 return !m_wasAbovePriorityCutoffAtLastPriorityUpdate && !m_inDrawingImplTree ; | 175 return !m_wasAbovePriorityCutoffAtLastPriorityUpdate && !m_inDrawingImplTree ; |
| 177 } | 176 } |
| 178 | 177 |
| 179 void PrioritizedTexture::Backing::updatePriority() | 178 void PrioritizedTexture::Backing::updatePriority() |
| 180 { | 179 { |
| 181 DCHECK(Proxy::isImplThread() && Proxy::isMainThreadBlocked()); | 180 DCHECK(m_threadChecker.CalledOnValidThread()); |
|
danakj
2012/10/25 05:06:06
The main thread is blocked part here is kinda impo
| |
| 182 if (m_owner) { | 181 if (m_owner) { |
| 183 m_priorityAtLastPriorityUpdate = m_owner->requestPriority(); | 182 m_priorityAtLastPriorityUpdate = m_owner->requestPriority(); |
| 184 m_wasAbovePriorityCutoffAtLastPriorityUpdate = m_owner->isAbovePriorityC utoff(); | 183 m_wasAbovePriorityCutoffAtLastPriorityUpdate = m_owner->isAbovePriorityC utoff(); |
| 185 } else { | 184 } else { |
| 186 m_priorityAtLastPriorityUpdate = PriorityCalculator::lowestPriority(); | 185 m_priorityAtLastPriorityUpdate = PriorityCalculator::lowestPriority(); |
| 187 m_wasAbovePriorityCutoffAtLastPriorityUpdate = false; | 186 m_wasAbovePriorityCutoffAtLastPriorityUpdate = false; |
| 188 } | 187 } |
| 189 } | 188 } |
| 190 | 189 |
| 191 void PrioritizedTexture::Backing::updateInDrawingImplTree() | 190 void PrioritizedTexture::Backing::updateInDrawingImplTree() |
| 192 { | 191 { |
| 193 DCHECK(Proxy::isImplThread() && Proxy::isMainThreadBlocked()); | 192 DCHECK(m_threadChecker.CalledOnValidThread()); |
|
danakj
2012/10/25 05:06:06
ditto
| |
| 194 m_inDrawingImplTree = !!owner(); | 193 m_inDrawingImplTree = !!owner(); |
| 195 if (!m_inDrawingImplTree) | 194 if (!m_inDrawingImplTree) |
| 196 DCHECK(m_priorityAtLastPriorityUpdate == PriorityCalculator::lowestPrior ity()); | 195 DCHECK(m_priorityAtLastPriorityUpdate == PriorityCalculator::lowestPrior ity()); |
| 197 } | 196 } |
| 198 | 197 |
| 199 } // namespace cc | 198 } // namespace cc |
| OLD | NEW |