Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: cc/CCPrioritizedTexture.cpp

Issue 11079007: Fix issue incremental upload can evict textures being drawn (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporate review feedback Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 { 122 {
123 setDimensions(IntSize(), GraphicsContext3D::RGBA); 123 setDimensions(IntSize(), GraphicsContext3D::RGBA);
124 setIsSelfManaged(true); 124 setIsSelfManaged(true);
125 m_bytes = bytes; 125 m_bytes = bytes;
126 } 126 }
127 127
128 CCPrioritizedTexture::Backing::Backing(unsigned id, CCResourceProvider* resource Provider, IntSize size, GC3Denum format) 128 CCPrioritizedTexture::Backing::Backing(unsigned id, CCResourceProvider* resource Provider, IntSize size, GC3Denum format)
129 : CCTexture(id, size, format) 129 : CCTexture(id, size, format)
130 , m_owner(0) 130 , m_owner(0)
131 , m_priorityAtLastPriorityUpdate(CCPriorityCalculator::lowestPriority()) 131 , m_priorityAtLastPriorityUpdate(CCPriorityCalculator::lowestPriority())
132 , m_ownerExistedAtLastPriorityUpdate(false)
133 , m_wasAbovePriorityCutoffAtLastPriorityUpdate(false) 132 , m_wasAbovePriorityCutoffAtLastPriorityUpdate(false)
133 , m_inDrawingImplTree(false)
134 , m_resourceHasBeenDeleted(false) 134 , m_resourceHasBeenDeleted(false)
135 #ifndef NDEBUG 135 #ifndef NDEBUG
136 , m_resourceProvider(resourceProvider) 136 , m_resourceProvider(resourceProvider)
137 #endif 137 #endif
138 { 138 {
139 } 139 }
140 140
141 CCPrioritizedTexture::Backing::~Backing() 141 CCPrioritizedTexture::Backing::~Backing()
142 { 142 {
143 ASSERT(!m_owner); 143 ASSERT(!m_owner);
(...skipping 12 matching lines...) Expand all
156 setId(0); 156 setId(0);
157 m_resourceHasBeenDeleted = true; 157 m_resourceHasBeenDeleted = true;
158 } 158 }
159 159
160 bool CCPrioritizedTexture::Backing::resourceHasBeenDeleted() const 160 bool CCPrioritizedTexture::Backing::resourceHasBeenDeleted() const
161 { 161 {
162 ASSERT(CCProxy::isImplThread()); 162 ASSERT(CCProxy::isImplThread());
163 return m_resourceHasBeenDeleted; 163 return m_resourceHasBeenDeleted;
164 } 164 }
165 165
166 bool CCPrioritizedTexture::Backing::canBeRecycled() const
167 {
168 ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
169 return !m_wasAbovePriorityCutoffAtLastPriorityUpdate && !m_inDrawingImplTree ;
170 }
171
166 void CCPrioritizedTexture::Backing::updatePriority() 172 void CCPrioritizedTexture::Backing::updatePriority()
167 { 173 {
168 ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); 174 ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
169 if (m_owner) { 175 if (m_owner) {
170 m_ownerExistedAtLastPriorityUpdate = true;
171 m_priorityAtLastPriorityUpdate = m_owner->requestPriority(); 176 m_priorityAtLastPriorityUpdate = m_owner->requestPriority();
172 m_wasAbovePriorityCutoffAtLastPriorityUpdate = m_owner->isAbovePriorityC utoff(); 177 m_wasAbovePriorityCutoffAtLastPriorityUpdate = m_owner->isAbovePriorityC utoff();
173 } else { 178 } else {
174 m_ownerExistedAtLastPriorityUpdate = false;
175 m_priorityAtLastPriorityUpdate = CCPriorityCalculator::lowestPriority(); 179 m_priorityAtLastPriorityUpdate = CCPriorityCalculator::lowestPriority();
176 m_wasAbovePriorityCutoffAtLastPriorityUpdate = false; 180 m_wasAbovePriorityCutoffAtLastPriorityUpdate = false;
177 } 181 }
178 } 182 }
179 183
184 void CCPrioritizedTexture::Backing::updateInDrawingImplTree()
185 {
186 ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
187 m_inDrawingImplTree = !!owner();
188 if (!m_inDrawingImplTree)
189 ASSERT(m_priorityAtLastPriorityUpdate == CCPriorityCalculator::lowestPri ority());
190 }
191
180 } // namespace cc 192 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698