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 "CCPrioritizedTexture.h" | 7 #include "CCPrioritizedTexture.h" |
| 8 | 8 |
| 9 #include "CCPrioritizedTextureManager.h" | 9 #include "CCPrioritizedTextureManager.h" |
| 10 #include "CCPriorityCalculator.h" | 10 #include "CCPriorityCalculator.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 setIsSelfManaged(true); | 119 setIsSelfManaged(true); |
| 120 m_bytes = bytes; | 120 m_bytes = bytes; |
| 121 } | 121 } |
| 122 | 122 |
| 123 CCPrioritizedTexture::Backing::Backing(unsigned id, IntSize size, GC3Denum forma t) | 123 CCPrioritizedTexture::Backing::Backing(unsigned id, IntSize size, GC3Denum forma t) |
| 124 : CCTexture(id, size, format) | 124 : CCTexture(id, size, format) |
| 125 , m_owner(0) | 125 , m_owner(0) |
| 126 , m_priorityAtLastPriorityUpdate(CCPriorityCalculator::lowestPriority()) | 126 , m_priorityAtLastPriorityUpdate(CCPriorityCalculator::lowestPriority()) |
| 127 , m_ownerExistedAtLastPriorityUpdate(false) | 127 , m_ownerExistedAtLastPriorityUpdate(false) |
| 128 , m_wasAbovePriorityCutoffAtLastPriorityUpdate(false) | 128 , m_wasAbovePriorityCutoffAtLastPriorityUpdate(false) |
| 129 , m_resourceHasBeenDeleted(false) | |
| 129 { | 130 { |
| 130 } | 131 } |
| 131 | 132 |
| 132 CCPrioritizedTexture::Backing::~Backing() | 133 CCPrioritizedTexture::Backing::~Backing() |
| 133 { | 134 { |
| 134 ASSERT(!m_owner); | 135 ASSERT(!m_owner); |
| 136 ASSERT(m_resourceHasBeenDeleted); | |
| 137 } | |
| 138 | |
| 139 void CCPrioritizedTexture::Backing::deleteResource(CCResourceProvider* resourceP rovider) | |
|
jamesr
2012/09/19 18:56:37
could we at least in debug verify that the provide
ccameron
2012/09/19 20:52:02
Added.
| |
| 140 { | |
| 141 ASSERT(CCProxy::isImplThread()); | |
| 142 ASSERT(!m_resourceHasBeenDeleted); | |
| 143 | |
| 144 resourceProvider->deleteResource(id()); | |
| 145 setId(0); | |
| 146 m_resourceHasBeenDeleted = true; | |
| 147 } | |
| 148 | |
| 149 bool CCPrioritizedTexture::Backing::resourceHasBeenDeleted() const | |
| 150 { | |
| 151 ASSERT(CCProxy::isImplThread()); | |
| 152 return m_resourceHasBeenDeleted; | |
| 135 } | 153 } |
| 136 | 154 |
| 137 void CCPrioritizedTexture::Backing::updatePriority() | 155 void CCPrioritizedTexture::Backing::updatePriority() |
| 138 { | 156 { |
| 139 ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); | 157 ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); |
| 140 if (m_owner) { | 158 if (m_owner) { |
| 141 m_ownerExistedAtLastPriorityUpdate = true; | 159 m_ownerExistedAtLastPriorityUpdate = true; |
| 142 m_priorityAtLastPriorityUpdate = m_owner->requestPriority(); | 160 m_priorityAtLastPriorityUpdate = m_owner->requestPriority(); |
| 143 m_wasAbovePriorityCutoffAtLastPriorityUpdate = m_owner->isAbovePriorityC utoff(); | 161 m_wasAbovePriorityCutoffAtLastPriorityUpdate = m_owner->isAbovePriorityC utoff(); |
| 144 } else { | 162 } else { |
| 145 m_ownerExistedAtLastPriorityUpdate = false; | 163 m_ownerExistedAtLastPriorityUpdate = false; |
| 146 m_priorityAtLastPriorityUpdate = CCPriorityCalculator::lowestPriority(); | 164 m_priorityAtLastPriorityUpdate = CCPriorityCalculator::lowestPriority(); |
| 147 m_wasAbovePriorityCutoffAtLastPriorityUpdate = false; | 165 m_wasAbovePriorityCutoffAtLastPriorityUpdate = false; |
| 148 } | 166 } |
| 149 } | 167 } |
| 150 | 168 |
| 151 } // namespace cc | 169 } // namespace cc |
| OLD | NEW |