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

Side by Side Diff: cc/CCPrioritizedTexture.cpp

Issue 11048004: Only recycle and evict textures not in-use on the impl thread. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « cc/CCLayerTreeHost.cpp ('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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 void CCPrioritizedTexture::acquireBackingTexture(CCResourceProvider* resourcePro vider) 77 void CCPrioritizedTexture::acquireBackingTexture(CCResourceProvider* resourcePro vider)
78 { 78 {
79 ASSERT(m_isAbovePriorityCutoff); 79 ASSERT(m_isAbovePriorityCutoff);
80 if (m_isAbovePriorityCutoff) 80 if (m_isAbovePriorityCutoff)
81 m_manager->acquireBackingTextureIfNeeded(this, resourceProvider); 81 m_manager->acquireBackingTextureIfNeeded(this, resourceProvider);
82 } 82 }
83 83
84 CCResourceProvider::ResourceId CCPrioritizedTexture::resourceId() const 84 CCResourceProvider::ResourceId CCPrioritizedTexture::resourceId() const
85 { 85 {
86 if (m_backing) 86 // We want to save some memory to safely recycle. So don't push all textures to the impl side.
87 // FIXME: We should push even less memory than the priority cut-off so long as it isn't visible.
88 if (m_backing && m_backing->wasAbovePriorityCutoffAtLastPriorityUpdate())
87 return m_backing->id(); 89 return m_backing->id();
88 return 0; 90 return 0;
89 } 91 }
90 92
91 void CCPrioritizedTexture::upload(CCResourceProvider* resourceProvider, 93 void CCPrioritizedTexture::upload(CCResourceProvider* resourceProvider,
92 const uint8_t* image, const IntRect& imageRect , 94 const uint8_t* image, const IntRect& imageRect ,
93 const IntRect& sourceRect, const IntSize& dest Offset) 95 const IntRect& sourceRect, const IntSize& dest Offset)
94 { 96 {
95 ASSERT(m_isAbovePriorityCutoff); 97 ASSERT(m_isAbovePriorityCutoff);
96 if (m_isAbovePriorityCutoff) 98 if (m_isAbovePriorityCutoff)
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 m_priorityAtLastPriorityUpdate = m_owner->requestPriority(); 173 m_priorityAtLastPriorityUpdate = m_owner->requestPriority();
172 m_wasAbovePriorityCutoffAtLastPriorityUpdate = m_owner->isAbovePriorityC utoff(); 174 m_wasAbovePriorityCutoffAtLastPriorityUpdate = m_owner->isAbovePriorityC utoff();
173 } else { 175 } else {
174 m_ownerExistedAtLastPriorityUpdate = false; 176 m_ownerExistedAtLastPriorityUpdate = false;
175 m_priorityAtLastPriorityUpdate = CCPriorityCalculator::lowestPriority(); 177 m_priorityAtLastPriorityUpdate = CCPriorityCalculator::lowestPriority();
176 m_wasAbovePriorityCutoffAtLastPriorityUpdate = false; 178 m_wasAbovePriorityCutoffAtLastPriorityUpdate = false;
177 } 179 }
178 } 180 }
179 181
180 } // namespace cc 182 } // namespace cc
OLDNEW
« no previous file with comments | « cc/CCLayerTreeHost.cpp ('k') | cc/CCPrioritizedTextureManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698