Chromium Code Reviews| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 , m_wheelScrolling(false) | 141 , m_wheelScrolling(false) |
| 142 , m_settings(settings) | 142 , m_settings(settings) |
| 143 , m_deviceScaleFactor(1) | 143 , m_deviceScaleFactor(1) |
| 144 , m_visible(true) | 144 , m_visible(true) |
| 145 , m_managedMemoryPolicy(PrioritizedResourceManager::defaultMemoryAllocationL imit(), | 145 , m_managedMemoryPolicy(PrioritizedResourceManager::defaultMemoryAllocationL imit(), |
| 146 ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING, | 146 ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING, |
| 147 0, | 147 0, |
| 148 ManagedMemoryPolicy::CUTOFF_ALLOW_NOTHING) | 148 ManagedMemoryPolicy::CUTOFF_ALLOW_NOTHING) |
| 149 , m_pinchGestureActive(false) | 149 , m_pinchGestureActive(false) |
| 150 , m_fpsCounter(FrameRateCounter::create(m_proxy->hasImplThread())) | 150 , m_fpsCounter(FrameRateCounter::create(m_proxy->hasImplThread())) |
| 151 , m_paintTimeCounter(PaintTimeCounter::create()) | |
|
nduca
2013/02/13 08:12:21
why do you defer the creation of the counter? It s
| |
| 152 , m_memoryHistory(MemoryHistory::create()) | 151 , m_memoryHistory(MemoryHistory::create()) |
| 153 , m_debugRectHistory(DebugRectHistory::create()) | 152 , m_debugRectHistory(DebugRectHistory::create()) |
| 154 , m_numImplThreadScrolls(0) | 153 , m_numImplThreadScrolls(0) |
| 155 , m_numMainThreadScrolls(0) | 154 , m_numMainThreadScrolls(0) |
| 156 , m_cumulativeNumLayersDrawn(0) | 155 , m_cumulativeNumLayersDrawn(0) |
| 157 , m_cumulativeNumMissingTiles(0) | 156 , m_cumulativeNumMissingTiles(0) |
| 158 , m_lastSentMemoryVisibleBytes(0) | 157 , m_lastSentMemoryVisibleBytes(0) |
| 159 , m_lastSentMemoryVisibleAndNearbyBytes(0) | 158 , m_lastSentMemoryVisibleAndNearbyBytes(0) |
| 160 , m_lastSentMemoryUseBytes(0) | 159 , m_lastSentMemoryUseBytes(0) |
| 161 , m_animationRegistrar(AnimationRegistrar::create()) | 160 , m_animationRegistrar(AnimationRegistrar::create()) |
| (...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1002 m_activeTree->DidBecomeActive(); | 1001 m_activeTree->DidBecomeActive(); |
| 1003 | 1002 |
| 1004 // Reduce wasted memory now that unlinked resources are guaranteed not | 1003 // Reduce wasted memory now that unlinked resources are guaranteed not |
| 1005 // to be used. | 1004 // to be used. |
| 1006 m_client->reduceWastedContentsTextureMemoryOnImplThread(); | 1005 m_client->reduceWastedContentsTextureMemoryOnImplThread(); |
| 1007 | 1006 |
| 1008 m_client->onCanDrawStateChanged(canDraw()); | 1007 m_client->onCanDrawStateChanged(canDraw()); |
| 1009 m_client->onHasPendingTreeStateChanged(pendingTree()); | 1008 m_client->onHasPendingTreeStateChanged(pendingTree()); |
| 1010 m_client->setNeedsRedrawOnImplThread(); | 1009 m_client->setNeedsRedrawOnImplThread(); |
| 1011 m_client->renewTreePriority(); | 1010 m_client->renewTreePriority(); |
| 1011 | |
| 1012 if (m_tileManager && m_debugState.continuousPainting) { | |
| 1013 DCHECK(m_paintTimeCounter.get()); | |
| 1014 RenderingStats stats; | |
| 1015 m_tileManager->GetRenderingStats(&stats); | |
| 1016 m_paintTimeCounter->SaveRasterizeTime(stats.totalRasterizeTimeForNowBins OnPendingTree, m_activeTree->source_frame_number()); | |
| 1017 } | |
| 1012 } | 1018 } |
| 1013 | 1019 |
| 1014 void LayerTreeHostImpl::setVisible(bool visible) | 1020 void LayerTreeHostImpl::setVisible(bool visible) |
| 1015 { | 1021 { |
| 1016 DCHECK(m_proxy->isImplThread()); | 1022 DCHECK(m_proxy->isImplThread()); |
| 1017 | 1023 |
| 1018 if (m_visible == visible) | 1024 if (m_visible == visible) |
| 1019 return; | 1025 return; |
| 1020 m_visible = visible; | 1026 m_visible = visible; |
| 1021 didVisibilityChange(this, m_visible); | 1027 didVisibilityChange(this, m_visible); |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1716 | 1722 |
| 1717 skia::RefPtr<SkPicture> LayerTreeHostImpl::capturePicture() | 1723 skia::RefPtr<SkPicture> LayerTreeHostImpl::capturePicture() |
| 1718 { | 1724 { |
| 1719 LayerTreeImpl* tree = pendingTree() ? pendingTree() : activeTree(); | 1725 LayerTreeImpl* tree = pendingTree() ? pendingTree() : activeTree(); |
| 1720 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer()); | 1726 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer()); |
| 1721 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>(); | 1727 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>(); |
| 1722 } | 1728 } |
| 1723 | 1729 |
| 1724 void LayerTreeHostImpl::setDebugState(const LayerTreeDebugState& debugState) | 1730 void LayerTreeHostImpl::setDebugState(const LayerTreeDebugState& debugState) |
| 1725 { | 1731 { |
| 1732 if (m_debugState.continuousPainting != debugState.continuousPainting) { | |
| 1733 if (!m_paintTimeCounter.get()) | |
| 1734 m_paintTimeCounter = PaintTimeCounter::create(); | |
| 1735 m_paintTimeCounter->ClearHistory(); | |
| 1736 } | |
| 1737 | |
| 1726 m_debugState = debugState; | 1738 m_debugState = debugState; |
| 1727 | 1739 |
| 1728 if (m_tileManager) | 1740 if (m_tileManager) |
| 1729 m_tileManager->SetRecordRenderingStats(m_debugState.recordRenderingStats ()); | 1741 m_tileManager->SetRecordRenderingStats(m_debugState.recordRenderingStats ()); |
| 1730 } | 1742 } |
| 1731 | 1743 |
| 1732 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime) | 1744 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime, con st int& frameNumber) |
| 1733 { | 1745 { |
| 1734 m_paintTimeCounter->SavePaintTime(totalPaintTime); | 1746 DCHECK(m_debugState.continuousPainting); |
| 1747 DCHECK(m_paintTimeCounter.get()); | |
| 1748 m_paintTimeCounter->SavePaintTime(totalPaintTime, frameNumber); | |
|
nduca
2013/02/13 08:12:21
maybe we should use the word commitNumber here and
| |
| 1735 } | 1749 } |
| 1736 | 1750 |
| 1737 } // namespace cc | 1751 } // namespace cc |
| OLD | NEW |