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