| 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 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 "PendingTree", m_pendingTree.get(), "waiting"); | 948 "PendingTree", m_pendingTree.get(), "waiting"); |
| 949 } | 949 } |
| 950 | 950 |
| 951 void LayerTreeHostImpl::checkForCompletedTileUploads() | 951 void LayerTreeHostImpl::checkForCompletedTileUploads() |
| 952 { | 952 { |
| 953 DCHECK(!m_client->isInsideDraw()) << "Checking for completed uploads within
a draw may trigger spurious redraws."; | 953 DCHECK(!m_client->isInsideDraw()) << "Checking for completed uploads within
a draw may trigger spurious redraws."; |
| 954 if (m_tileManager) | 954 if (m_tileManager) |
| 955 m_tileManager->CheckForCompletedTileUploads(); | 955 m_tileManager->CheckForCompletedTileUploads(); |
| 956 } | 956 } |
| 957 | 957 |
| 958 void LayerTreeHostImpl::activatePendingTreeIfNeeded() | 958 bool LayerTreeHostImpl::activatePendingTreeIfNeeded() |
| 959 { | 959 { |
| 960 if (!pendingTree()) | 960 if (!pendingTree()) |
| 961 return; | 961 return false; |
| 962 | 962 |
| 963 CHECK(m_tileManager); | 963 CHECK(m_tileManager); |
| 964 | 964 |
| 965 pendingTree()->UpdateDrawProperties(LayerTreeImpl::UPDATE_PENDING_TREE); | 965 pendingTree()->UpdateDrawProperties(LayerTreeImpl::UPDATE_PENDING_TREE); |
| 966 | 966 |
| 967 TRACE_EVENT_ASYNC_STEP1("cc", | 967 TRACE_EVENT_ASYNC_STEP1("cc", |
| 968 "PendingTree", m_pendingTree.get(), "activate", | 968 "PendingTree", m_pendingTree.get(), "activate", |
| 969 "state", ValueToString(activationStateAsValue())); | 969 "state", ValueToString(activationStateAsValue())); |
| 970 | 970 |
| 971 // It's always fine to activate to an empty tree. Otherwise, only | 971 // It's always fine to activate to an empty tree. Otherwise, only |
| 972 // activate once all visible resources in pending tree are ready | 972 // activate once all visible resources in pending tree are ready |
| 973 // or tile manager has no work scheduled for pending tree. | 973 // or tile manager has no work scheduled for pending tree. |
| 974 if (activeTree()->RootLayer() && | 974 if (activeTree()->RootLayer() && |
| 975 !pendingTree()->AreVisibleResourcesReady()) { | 975 !pendingTree()->AreVisibleResourcesReady()) { |
| 976 // In smoothness takes priority mode, the pending tree's priorities are | 976 // In smoothness takes priority mode, the pending tree's priorities are |
| 977 // ignored, so the tile manager may not have work for it even though it | 977 // ignored, so the tile manager may not have work for it even though it |
| 978 // is simultaneously not ready to be activated. | 978 // is simultaneously not ready to be activated. |
| 979 if (m_tileManager->GlobalState().tree_priority == | 979 if (m_tileManager->GlobalState().tree_priority == |
| 980 SMOOTHNESS_TAKES_PRIORITY || | 980 SMOOTHNESS_TAKES_PRIORITY || |
| 981 m_tileManager->HasPendingWorkScheduled(PENDING_TREE)) { | 981 m_tileManager->HasPendingWorkScheduled(PENDING_TREE)) { |
| 982 TRACE_EVENT_ASYNC_STEP0("cc", | 982 TRACE_EVENT_ASYNC_STEP0("cc", |
| 983 "PendingTree", | 983 "PendingTree", |
| 984 m_pendingTree.get(), | 984 m_pendingTree.get(), |
| 985 "waiting"); | 985 "waiting"); |
| 986 return; | 986 return false; |
| 987 } | 987 } |
| 988 } | 988 } |
| 989 | 989 |
| 990 activatePendingTree(); | 990 activatePendingTree(); |
| 991 return true; |
| 991 } | 992 } |
| 992 | 993 |
| 993 void LayerTreeHostImpl::activatePendingTree() | 994 void LayerTreeHostImpl::activatePendingTree() |
| 994 { | 995 { |
| 995 CHECK(m_pendingTree); | 996 CHECK(m_pendingTree); |
| 996 TRACE_EVENT_ASYNC_END0("cc", "PendingTree", m_pendingTree.get()); | 997 TRACE_EVENT_ASYNC_END0("cc", "PendingTree", m_pendingTree.get()); |
| 997 | 998 |
| 998 m_activeTree->PushPersistedState(m_pendingTree.get()); | 999 m_activeTree->PushPersistedState(m_pendingTree.get()); |
| 999 if (m_pendingTree->needs_full_tree_sync()) | 1000 if (m_pendingTree->needs_full_tree_sync()) |
| 1000 m_activeTree->SetRootLayer(TreeSynchronizer::synchronizeTrees(m_pendingT
ree->RootLayer(), m_activeTree->DetachLayerTree(), m_activeTree.get())); | 1001 m_activeTree->SetRootLayer(TreeSynchronizer::synchronizeTrees(m_pendingT
ree->RootLayer(), m_activeTree->DetachLayerTree(), m_activeTree.get())); |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1720 m_tileManager->SetRecordRenderingStats(m_debugState.recordRenderingStats
()); | 1721 m_tileManager->SetRecordRenderingStats(m_debugState.recordRenderingStats
()); |
| 1721 } | 1722 } |
| 1722 | 1723 |
| 1723 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime, int
commitNumber) | 1724 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime, int
commitNumber) |
| 1724 { | 1725 { |
| 1725 DCHECK(m_debugState.continuousPainting); | 1726 DCHECK(m_debugState.continuousPainting); |
| 1726 m_paintTimeCounter->SavePaintTime(totalPaintTime, commitNumber); | 1727 m_paintTimeCounter->SavePaintTime(totalPaintTime, commitNumber); |
| 1727 } | 1728 } |
| 1728 | 1729 |
| 1729 } // namespace cc | 1730 } // namespace cc |
| OLD | NEW |