| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 activeTree()->set_needs_update_draw_properties(); | 1150 activeTree()->set_needs_update_draw_properties(); |
| 1151 } | 1151 } |
| 1152 | 1152 |
| 1153 void LayerTreeHostImpl::setNeedsRedraw() | 1153 void LayerTreeHostImpl::setNeedsRedraw() |
| 1154 { | 1154 { |
| 1155 m_client->setNeedsRedrawOnImplThread(); | 1155 m_client->setNeedsRedrawOnImplThread(); |
| 1156 } | 1156 } |
| 1157 | 1157 |
| 1158 bool LayerTreeHostImpl::ensureRenderSurfaceLayerList() | 1158 bool LayerTreeHostImpl::ensureRenderSurfaceLayerList() |
| 1159 { | 1159 { |
| 1160 activeTree()->UpdateDrawProperties(); | 1160 activeTree()->UpdateDrawProperties(LayerTreeImpl::UPDATE_ACTIVE_TREE); |
| 1161 return activeTree()->RenderSurfaceLayerList().size(); | 1161 return activeTree()->RenderSurfaceLayerList().size(); |
| 1162 } | 1162 } |
| 1163 | 1163 |
| 1164 InputHandlerClient::ScrollStatus LayerTreeHostImpl::scrollBegin(gfx::Point viewp
ortPoint, InputHandlerClient::ScrollInputType type) | 1164 InputHandlerClient::ScrollStatus LayerTreeHostImpl::scrollBegin(gfx::Point viewp
ortPoint, InputHandlerClient::ScrollInputType type) |
| 1165 { | 1165 { |
| 1166 TRACE_EVENT0("cc", "LayerTreeHostImpl::scrollBegin"); | 1166 TRACE_EVENT0("cc", "LayerTreeHostImpl::scrollBegin"); |
| 1167 | 1167 |
| 1168 if (m_topControlsManager) | 1168 if (m_topControlsManager) |
| 1169 m_topControlsManager->ScrollBegin(); | 1169 m_topControlsManager->ScrollBegin(); |
| 1170 | 1170 |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1709 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer()); | 1709 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer()); |
| 1710 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>(); | 1710 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>(); |
| 1711 } | 1711 } |
| 1712 | 1712 |
| 1713 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime) | 1713 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime) |
| 1714 { | 1714 { |
| 1715 m_paintTimeCounter->SavePaintTime(totalPaintTime); | 1715 m_paintTimeCounter->SavePaintTime(totalPaintTime); |
| 1716 } | 1716 } |
| 1717 | 1717 |
| 1718 } // namespace cc | 1718 } // namespace cc |
| OLD | NEW |