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

Side by Side Diff: cc/layer_tree_host_impl.cc

Issue 11886091: cc: Fix resource eviction with impl-side painting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "cc/layer_tree_host_impl.h" 5 #include "cc/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 129 }
130 130
131 LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, LayerTre eHostImplClient* client, Proxy* proxy) 131 LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, LayerTre eHostImplClient* client, Proxy* proxy)
132 : m_client(client) 132 : m_client(client)
133 , m_proxy(proxy) 133 , m_proxy(proxy)
134 , m_scrollDeltaIsInViewportSpace(false) 134 , m_scrollDeltaIsInViewportSpace(false)
135 , m_settings(settings) 135 , m_settings(settings)
136 , m_debugState(settings.initialDebugState) 136 , m_debugState(settings.initialDebugState)
137 , m_deviceScaleFactor(1) 137 , m_deviceScaleFactor(1)
138 , m_visible(true) 138 , m_visible(true)
139 , m_contentsTexturesPurged(false)
140 , m_managedMemoryPolicy(PrioritizedResourceManager::defaultMemoryAllocationL imit(), 139 , m_managedMemoryPolicy(PrioritizedResourceManager::defaultMemoryAllocationL imit(),
141 ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING, 140 ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING,
142 0, 141 0,
143 ManagedMemoryPolicy::CUTOFF_ALLOW_NOTHING) 142 ManagedMemoryPolicy::CUTOFF_ALLOW_NOTHING)
144 , m_needsUpdateDrawProperties(false) 143 , m_needsUpdateDrawProperties(false)
145 , m_pinchGestureActive(false) 144 , m_pinchGestureActive(false)
146 , m_fpsCounter(FrameRateCounter::create(m_proxy->hasImplThread())) 145 , m_fpsCounter(FrameRateCounter::create(m_proxy->hasImplThread()))
147 , m_paintTimeCounter(PaintTimeCounter::create()) 146 , m_paintTimeCounter(PaintTimeCounter::create())
148 , m_debugRectHistory(DebugRectHistory::create()) 147 , m_debugRectHistory(DebugRectHistory::create())
149 , m_numImplThreadScrolls(0) 148 , m_numImplThreadScrolls(0)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 return false; 211 return false;
213 } 212 }
214 if (deviceViewportSize().IsEmpty()) { 213 if (deviceViewportSize().IsEmpty()) {
215 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw empty viewport"); 214 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw empty viewport");
216 return false; 215 return false;
217 } 216 }
218 if (!m_renderer) { 217 if (!m_renderer) {
219 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw no renderer"); 218 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw no renderer");
220 return false; 219 return false;
221 } 220 }
222 if (m_contentsTexturesPurged) { 221 if (m_activeTree->ContentsTexturesPurged()) {
223 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw contents textures purged"); 222 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw contents textures purged");
224 return false; 223 return false;
225 } 224 }
226 return true; 225 return true;
227 } 226 }
228 227
229 OutputSurface* LayerTreeHostImpl::outputSurface() const 228 OutputSurface* LayerTreeHostImpl::outputSurface() const
230 { 229 {
231 return m_outputSurface.get(); 230 return m_outputSurface.get();
232 } 231 }
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 return true; 690 return true;
692 } 691 }
693 692
694 void LayerTreeHostImpl::enforceManagedMemoryPolicy(const ManagedMemoryPolicy& po licy) 693 void LayerTreeHostImpl::enforceManagedMemoryPolicy(const ManagedMemoryPolicy& po licy)
695 { 694 {
696 bool evictedResources = m_client->reduceContentsTextureMemoryOnImplThread( 695 bool evictedResources = m_client->reduceContentsTextureMemoryOnImplThread(
697 m_visible ? policy.bytesLimitWhenVisible : policy.bytesLimitWhenNotVisib le, 696 m_visible ? policy.bytesLimitWhenVisible : policy.bytesLimitWhenNotVisib le,
698 ManagedMemoryPolicy::priorityCutoffToValue( 697 ManagedMemoryPolicy::priorityCutoffToValue(
699 m_visible ? policy.priorityCutoffWhenVisible : policy.priorityCutoff WhenNotVisible)); 698 m_visible ? policy.priorityCutoffWhenVisible : policy.priorityCutoff WhenNotVisible));
700 if (evictedResources) { 699 if (evictedResources) {
701 setContentsTexturesPurged(); 700 DCHECK(!m_pendingTree);
701 m_activeTree->SetContentsTexturesPurged();
702 m_client->setNeedsCommitOnImplThread(); 702 m_client->setNeedsCommitOnImplThread();
703 m_client->onCanDrawStateChanged(canDraw()); 703 m_client->onCanDrawStateChanged(canDraw());
704 } 704 }
705 m_client->sendManagedMemoryStats(); 705 m_client->sendManagedMemoryStats();
706 706
707 if (m_tileManager) { 707 if (m_tileManager) {
708 GlobalStateThatImpactsTilePriority new_state(m_tileManager->GlobalState()) ; 708 GlobalStateThatImpactsTilePriority new_state(m_tileManager->GlobalState()) ;
709 new_state.memory_limit_in_bytes = m_visible ? policy.bytesLimitWhenVisible : policy.bytesLimitWhenNotVisible; 709 new_state.memory_limit_in_bytes = m_visible ? policy.bytesLimitWhenVisible : policy.bytesLimitWhenNotVisible;
710 new_state.memory_limit_policy = ManagedMemoryPolicy::priorityCutoffToTileM emoryLimitPolicy( 710 new_state.memory_limit_policy = ManagedMemoryPolicy::priorityCutoffToTileM emoryLimitPolicy(
711 m_visible ? policy.priorityCutoffWhenVisible : policy.priorityCutoffWh enNotVisible); 711 m_visible ? policy.priorityCutoffWhenVisible : policy.priorityCutoffWh enNotVisible);
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 m_outputSurface = outputSurface.Pass(); 1021 m_outputSurface = outputSurface.Pass();
1022 1022
1023 if (!m_visible) 1023 if (!m_visible)
1024 m_renderer->setVisible(m_visible); 1024 m_renderer->setVisible(m_visible);
1025 1025
1026 m_client->onCanDrawStateChanged(canDraw()); 1026 m_client->onCanDrawStateChanged(canDraw());
1027 1027
1028 return true; 1028 return true;
1029 } 1029 }
1030 1030
1031 void LayerTreeHostImpl::setContentsTexturesPurged()
1032 {
1033 m_contentsTexturesPurged = true;
1034 m_client->onCanDrawStateChanged(canDraw());
1035 }
1036
1037 void LayerTreeHostImpl::resetContentsTexturesPurged()
1038 {
1039 m_contentsTexturesPurged = false;
1040 m_client->onCanDrawStateChanged(canDraw());
1041 }
1042
1043 void LayerTreeHostImpl::setViewportSize(const gfx::Size& layoutViewportSize, con st gfx::Size& deviceViewportSize) 1031 void LayerTreeHostImpl::setViewportSize(const gfx::Size& layoutViewportSize, con st gfx::Size& deviceViewportSize)
1044 { 1032 {
1045 if (layoutViewportSize == m_layoutViewportSize && deviceViewportSize == m_de viceViewportSize) 1033 if (layoutViewportSize == m_layoutViewportSize && deviceViewportSize == m_de viceViewportSize)
1046 return; 1034 return;
1047 1035
1048 m_layoutViewportSize = layoutViewportSize; 1036 m_layoutViewportSize = layoutViewportSize;
1049 m_deviceViewportSize = deviceViewportSize; 1037 m_deviceViewportSize = deviceViewportSize;
1050 1038
1051 m_pinchZoomViewport.set_layout_viewport_size(layoutViewportSize); 1039 m_pinchZoomViewport.set_layout_viewport_size(layoutViewportSize);
1052 1040
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1678 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer()); 1666 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer());
1679 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>(); 1667 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>();
1680 } 1668 }
1681 1669
1682 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime) 1670 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime)
1683 { 1671 {
1684 m_paintTimeCounter->SavePaintTime(totalPaintTime); 1672 m_paintTimeCounter->SavePaintTime(totalPaintTime);
1685 } 1673 }
1686 1674
1687 } // namespace cc 1675 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698