OLD | NEW |
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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 186 |
187 void LayerTreeHostImpl::commitComplete() | 187 void LayerTreeHostImpl::commitComplete() |
188 { | 188 { |
189 TRACE_EVENT0("cc", "LayerTreeHostImpl::commitComplete"); | 189 TRACE_EVENT0("cc", "LayerTreeHostImpl::commitComplete"); |
190 | 190 |
191 // Impl-side painting needs an update immediately post-commit to have the | 191 // Impl-side painting needs an update immediately post-commit to have the |
192 // opportunity to create tilings. Other paths can call updateDrawProperties | 192 // opportunity to create tilings. Other paths can call updateDrawProperties |
193 // more lazily when needed prior to drawing. | 193 // more lazily when needed prior to drawing. |
194 if (m_settings.implSidePainting) { | 194 if (m_settings.implSidePainting) { |
195 pendingTree()->set_needs_update_draw_properties(); | 195 pendingTree()->set_needs_update_draw_properties(); |
196 pendingTree()->UpdateDrawProperties(); | 196 pendingTree()->UpdateDrawProperties(LayerTreeImpl::UPDATE_PENDING_TREE); |
197 } else { | 197 } else { |
198 activeTree()->set_needs_update_draw_properties(); | 198 activeTree()->set_needs_update_draw_properties(); |
199 } | 199 } |
200 | 200 |
201 m_client->sendManagedMemoryStats(); | 201 m_client->sendManagedMemoryStats(); |
202 } | 202 } |
203 | 203 |
204 bool LayerTreeHostImpl::canDraw() | 204 bool LayerTreeHostImpl::canDraw() |
205 { | 205 { |
206 // Note: If you are changing this function or any other function that might | 206 // Note: If you are changing this function or any other function that might |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 } | 643 } |
644 } | 644 } |
645 } | 645 } |
646 | 646 |
647 bool LayerTreeHostImpl::prepareToDraw(FrameData& frame) | 647 bool LayerTreeHostImpl::prepareToDraw(FrameData& frame) |
648 { | 648 { |
649 TRACE_EVENT0("cc", "LayerTreeHostImpl::prepareToDraw"); | 649 TRACE_EVENT0("cc", "LayerTreeHostImpl::prepareToDraw"); |
650 | 650 |
651 if (m_topControlsManager) | 651 if (m_topControlsManager) |
652 m_topControlsManager->UpdateDrawPositions(); | 652 m_topControlsManager->UpdateDrawPositions(); |
653 activeTree()->UpdateDrawProperties(); | 653 activeTree()->UpdateDrawProperties(LayerTreeImpl::UPDATE_ACTIVE_TREE_FOR_DRA
W); |
654 | 654 |
655 frame.renderSurfaceLayerList = &activeTree()->RenderSurfaceLayerList(); | 655 frame.renderSurfaceLayerList = &activeTree()->RenderSurfaceLayerList(); |
656 frame.renderPasses.clear(); | 656 frame.renderPasses.clear(); |
657 frame.renderPassesById.clear(); | 657 frame.renderPassesById.clear(); |
658 frame.willDrawLayers.clear(); | 658 frame.willDrawLayers.clear(); |
659 | 659 |
660 if (!calculateRenderPasses(frame)) | 660 if (!calculateRenderPasses(frame)) |
661 return false; | 661 return false; |
662 | 662 |
663 // If we return true, then we expect drawLayers() to be called before this f
unction is called again. | 663 // If we return true, then we expect drawLayers() to be called before this f
unction is called again. |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 DCHECK(!m_client->isInsideDraw()) << "Checking for completed uploads within
a draw may trigger spurious redraws."; | 927 DCHECK(!m_client->isInsideDraw()) << "Checking for completed uploads within
a draw may trigger spurious redraws."; |
928 if (m_tileManager) | 928 if (m_tileManager) |
929 m_tileManager->CheckForCompletedTileUploads(); | 929 m_tileManager->CheckForCompletedTileUploads(); |
930 } | 930 } |
931 | 931 |
932 void LayerTreeHostImpl::activatePendingTreeIfNeeded() | 932 void LayerTreeHostImpl::activatePendingTreeIfNeeded() |
933 { | 933 { |
934 if (!pendingTree()) | 934 if (!pendingTree()) |
935 return; | 935 return; |
936 | 936 |
937 pendingTree()->UpdateDrawProperties(); | 937 pendingTree()->UpdateDrawProperties(LayerTreeImpl::UPDATE_PENDING_TREE); |
938 | 938 |
939 // It's always fine to activate to an empty tree. Otherwise, only | 939 // It's always fine to activate to an empty tree. Otherwise, only |
940 // activate once all visible resources in pending tree are ready. | 940 // activate once all visible resources in pending tree are ready. |
941 if (activeTree()->RootLayer() && | 941 if (activeTree()->RootLayer() && |
942 !pendingTree()->AreVisibleResourcesReady()) | 942 !pendingTree()->AreVisibleResourcesReady()) |
943 return; | 943 return; |
944 | 944 |
945 activatePendingTree(); | 945 activatePendingTree(); |
946 } | 946 } |
947 | 947 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 activeTree()->set_needs_update_draw_properties(); | 1154 activeTree()->set_needs_update_draw_properties(); |
1155 } | 1155 } |
1156 | 1156 |
1157 void LayerTreeHostImpl::setNeedsRedraw() | 1157 void LayerTreeHostImpl::setNeedsRedraw() |
1158 { | 1158 { |
1159 m_client->setNeedsRedrawOnImplThread(); | 1159 m_client->setNeedsRedrawOnImplThread(); |
1160 } | 1160 } |
1161 | 1161 |
1162 bool LayerTreeHostImpl::ensureRenderSurfaceLayerList() | 1162 bool LayerTreeHostImpl::ensureRenderSurfaceLayerList() |
1163 { | 1163 { |
1164 activeTree()->UpdateDrawProperties(); | 1164 activeTree()->UpdateDrawProperties(LayerTreeImpl::UPDATE_ACTIVE_TREE); |
1165 return activeTree()->RenderSurfaceLayerList().size(); | 1165 return activeTree()->RenderSurfaceLayerList().size(); |
1166 } | 1166 } |
1167 | 1167 |
1168 InputHandlerClient::ScrollStatus LayerTreeHostImpl::scrollBegin(gfx::Point viewp
ortPoint, InputHandlerClient::ScrollInputType type) | 1168 InputHandlerClient::ScrollStatus LayerTreeHostImpl::scrollBegin(gfx::Point viewp
ortPoint, InputHandlerClient::ScrollInputType type) |
1169 { | 1169 { |
1170 TRACE_EVENT0("cc", "LayerTreeHostImpl::scrollBegin"); | 1170 TRACE_EVENT0("cc", "LayerTreeHostImpl::scrollBegin"); |
1171 | 1171 |
1172 if (m_topControlsManager) | 1172 if (m_topControlsManager) |
1173 m_topControlsManager->ScrollBegin(); | 1173 m_topControlsManager->ScrollBegin(); |
1174 | 1174 |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1713 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer()); | 1713 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer()); |
1714 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>(); | 1714 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>(); |
1715 } | 1715 } |
1716 | 1716 |
1717 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime) | 1717 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime) |
1718 { | 1718 { |
1719 m_paintTimeCounter->SavePaintTime(totalPaintTime); | 1719 m_paintTimeCounter->SavePaintTime(totalPaintTime); |
1720 } | 1720 } |
1721 | 1721 |
1722 } // namespace cc | 1722 } // namespace cc |
OLD | NEW |