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

Side by Side Diff: cc/CCPrioritizedTexture.cpp

Issue 10947017: Enable removing uploads to evicted textures from texture upload queues. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporate review feedback Created 8 years, 3 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
« no previous file with comments | « cc/CCPrioritizedTexture.h ('k') | cc/CCPrioritizedTextureManager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 62 }
63 } 63 }
64 64
65 bool CCPrioritizedTexture::requestLate() 65 bool CCPrioritizedTexture::requestLate()
66 { 66 {
67 if (!m_manager) 67 if (!m_manager)
68 return false; 68 return false;
69 return m_manager->requestLate(this); 69 return m_manager->requestLate(this);
70 } 70 }
71 71
72 bool CCPrioritizedTexture::backingResourceWasEvicted() const
73 {
74 return m_backing ? m_backing->resourceHasBeenDeleted() : false;
75 }
76
72 void CCPrioritizedTexture::acquireBackingTexture(CCResourceProvider* resourcePro vider) 77 void CCPrioritizedTexture::acquireBackingTexture(CCResourceProvider* resourcePro vider)
73 { 78 {
74 ASSERT(m_isAbovePriorityCutoff); 79 ASSERT(m_isAbovePriorityCutoff);
75 if (m_isAbovePriorityCutoff) 80 if (m_isAbovePriorityCutoff)
76 m_manager->acquireBackingTextureIfNeeded(this, resourceProvider); 81 m_manager->acquireBackingTextureIfNeeded(this, resourceProvider);
77 } 82 }
78 83
79 CCResourceProvider::ResourceId CCPrioritizedTexture::resourceId() const 84 CCResourceProvider::ResourceId CCPrioritizedTexture::resourceId() const
80 { 85 {
81 if (m_backing) 86 if (m_backing)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 m_backing = 0; 118 m_backing = 0;
114 } 119 }
115 120
116 void CCPrioritizedTexture::setToSelfManagedMemoryPlaceholder(size_t bytes) 121 void CCPrioritizedTexture::setToSelfManagedMemoryPlaceholder(size_t bytes)
117 { 122 {
118 setDimensions(IntSize(), GraphicsContext3D::RGBA); 123 setDimensions(IntSize(), GraphicsContext3D::RGBA);
119 setIsSelfManaged(true); 124 setIsSelfManaged(true);
120 m_bytes = bytes; 125 m_bytes = bytes;
121 } 126 }
122 127
123 CCPrioritizedTexture::Backing::Backing(unsigned id, IntSize size, GC3Denum forma t) 128 CCPrioritizedTexture::Backing::Backing(unsigned id, CCResourceProvider* resource Provider, IntSize size, GC3Denum format)
124 : CCTexture(id, size, format) 129 : CCTexture(id, size, format)
125 , m_owner(0) 130 , m_owner(0)
126 , m_priorityAtLastPriorityUpdate(CCPriorityCalculator::lowestPriority()) 131 , m_priorityAtLastPriorityUpdate(CCPriorityCalculator::lowestPriority())
127 , m_ownerExistedAtLastPriorityUpdate(false) 132 , m_ownerExistedAtLastPriorityUpdate(false)
128 , m_wasAbovePriorityCutoffAtLastPriorityUpdate(false) 133 , m_wasAbovePriorityCutoffAtLastPriorityUpdate(false)
134 , m_resourceHasBeenDeleted(false)
135 #ifndef NDEBUG
136 , m_resourceProvider(resourceProvider)
137 #endif
129 { 138 {
130 } 139 }
131 140
132 CCPrioritizedTexture::Backing::~Backing() 141 CCPrioritizedTexture::Backing::~Backing()
133 { 142 {
134 ASSERT(!m_owner); 143 ASSERT(!m_owner);
144 ASSERT(m_resourceHasBeenDeleted);
145 }
146
147 void CCPrioritizedTexture::Backing::deleteResource(CCResourceProvider* resourceP rovider)
148 {
149 ASSERT(CCProxy::isImplThread());
150 ASSERT(!m_resourceHasBeenDeleted);
151 #ifndef NDEBUG
152 ASSERT(resourceProvider == m_resourceProvider);
153 #endif
154
155 resourceProvider->deleteResource(id());
156 setId(0);
157 m_resourceHasBeenDeleted = true;
158 }
159
160 bool CCPrioritizedTexture::Backing::resourceHasBeenDeleted() const
161 {
162 ASSERT(CCProxy::isImplThread());
163 return m_resourceHasBeenDeleted;
135 } 164 }
136 165
137 void CCPrioritizedTexture::Backing::updatePriority() 166 void CCPrioritizedTexture::Backing::updatePriority()
138 { 167 {
139 ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); 168 ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
140 if (m_owner) { 169 if (m_owner) {
141 m_ownerExistedAtLastPriorityUpdate = true; 170 m_ownerExistedAtLastPriorityUpdate = true;
142 m_priorityAtLastPriorityUpdate = m_owner->requestPriority(); 171 m_priorityAtLastPriorityUpdate = m_owner->requestPriority();
143 m_wasAbovePriorityCutoffAtLastPriorityUpdate = m_owner->isAbovePriorityC utoff(); 172 m_wasAbovePriorityCutoffAtLastPriorityUpdate = m_owner->isAbovePriorityC utoff();
144 } else { 173 } else {
145 m_ownerExistedAtLastPriorityUpdate = false; 174 m_ownerExistedAtLastPriorityUpdate = false;
146 m_priorityAtLastPriorityUpdate = CCPriorityCalculator::lowestPriority(); 175 m_priorityAtLastPriorityUpdate = CCPriorityCalculator::lowestPriority();
147 m_wasAbovePriorityCutoffAtLastPriorityUpdate = false; 176 m_wasAbovePriorityCutoffAtLastPriorityUpdate = false;
148 } 177 }
149 } 178 }
150 179
151 } // namespace cc 180 } // namespace cc
OLDNEW
« no previous file with comments | « cc/CCPrioritizedTexture.h ('k') | cc/CCPrioritizedTextureManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698