| 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 m_client->sendManagedMemoryStats(); | 220 m_client->sendManagedMemoryStats(); |
| 221 } | 221 } |
| 222 | 222 |
| 223 bool LayerTreeHostImpl::canDraw() | 223 bool LayerTreeHostImpl::canDraw() |
| 224 { | 224 { |
| 225 // Note: If you are changing this function or any other function that might | 225 // Note: If you are changing this function or any other function that might |
| 226 // affect the result of canDraw, make sure to call m_client->onCanDrawStateC
hanged | 226 // affect the result of canDraw, make sure to call m_client->onCanDrawStateC
hanged |
| 227 // in the proper places and update the notifyIfCanDrawChanged test. | 227 // in the proper places and update the notifyIfCanDrawChanged test. |
| 228 | 228 |
| 229 if (!rootLayer()) { | 229 if (!rootLayer()) { |
| 230 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw no root layer"); | 230 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw no root layer", |
| 231 TRACE_EVENT_SCOPE_THREAD); |
| 231 return false; | 232 return false; |
| 232 } | 233 } |
| 233 if (deviceViewportSize().IsEmpty()) { | 234 if (deviceViewportSize().IsEmpty()) { |
| 234 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw empty viewport"); | 235 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw empty viewport", |
| 236 TRACE_EVENT_SCOPE_THREAD); |
| 235 return false; | 237 return false; |
| 236 } | 238 } |
| 237 if (m_activeTree->ViewportSizeInvalid()) { | 239 if (m_activeTree->ViewportSizeInvalid()) { |
| 238 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw viewport size rec
ently changed"); | 240 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw viewport size rec
ently changed", |
| 241 TRACE_EVENT_SCOPE_THREAD); |
| 239 return false; | 242 return false; |
| 240 } | 243 } |
| 241 if (!m_renderer) { | 244 if (!m_renderer) { |
| 242 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw no renderer"); | 245 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw no renderer", |
| 246 TRACE_EVENT_SCOPE_THREAD); |
| 243 return false; | 247 return false; |
| 244 } | 248 } |
| 245 if (m_activeTree->ContentsTexturesPurged()) { | 249 if (m_activeTree->ContentsTexturesPurged()) { |
| 246 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw contents textures
purged"); | 250 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw contents textures
purged", |
| 251 TRACE_EVENT_SCOPE_THREAD); |
| 247 return false; | 252 return false; |
| 248 } | 253 } |
| 249 return true; | 254 return true; |
| 250 } | 255 } |
| 251 | 256 |
| 252 OutputSurface* LayerTreeHostImpl::outputSurface() const | 257 OutputSurface* LayerTreeHostImpl::outputSurface() const |
| 253 { | 258 { |
| 254 return m_outputSurface.get(); | 259 return m_outputSurface.get(); |
| 255 } | 260 } |
| 256 | 261 |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 | 815 |
| 811 if (m_tileManager) { | 816 if (m_tileManager) { |
| 812 m_memoryHistory->SaveEntry( | 817 m_memoryHistory->SaveEntry( |
| 813 m_tileManager->memory_stats_from_last_assign()); | 818 m_tileManager->memory_stats_from_last_assign()); |
| 814 } | 819 } |
| 815 | 820 |
| 816 if (m_debugState.showHudRects()) | 821 if (m_debugState.showHudRects()) |
| 817 m_debugRectHistory->saveDebugRectsForCurrentFrame(rootLayer(), *frame.re
nderSurfaceLayerList, frame.occludingScreenSpaceRects, frame.nonOccludingScreenS
paceRects, m_debugState); | 822 m_debugRectHistory->saveDebugRectsForCurrentFrame(rootLayer(), *frame.re
nderSurfaceLayerList, frame.occludingScreenSpaceRects, frame.nonOccludingScreenS
paceRects, m_debugState); |
| 818 | 823 |
| 819 if (m_debugState.traceAllRenderedFrames) { | 824 if (m_debugState.traceAllRenderedFrames) { |
| 820 TRACE_EVENT_INSTANT1("cc.debug", "Frame", | 825 TRACE_EVENT_INSTANT1("cc.debug", "Frame", TRACE_EVENT_SCOPE_THREAD, |
| 821 "frame", ValueToString(frameStateAsValue())); | 826 "frame", ValueToString(frameStateAsValue())); |
| 822 } | 827 } |
| 823 | 828 |
| 824 // Because the contents of the HUD depend on everything else in the frame, t
he contents | 829 // Because the contents of the HUD depend on everything else in the frame, t
he contents |
| 825 // of its texture are updated as the last thing before the frame is drawn. | 830 // of its texture are updated as the last thing before the frame is drawn. |
| 826 if (m_activeTree->hud_layer()) | 831 if (m_activeTree->hud_layer()) |
| 827 m_activeTree->hud_layer()->updateHudTexture(m_resourceProvider.get()); | 832 m_activeTree->hud_layer()->updateHudTexture(m_resourceProvider.get()); |
| 828 | 833 |
| 829 m_renderer->drawFrame(frame.renderPasses); | 834 m_renderer->drawFrame(frame.renderPasses); |
| 830 // The render passes should be consumed by the renderer. | 835 // The render passes should be consumed by the renderer. |
| (...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1791 m_tileManager->SetRecordRenderingStats(m_debugState.recordRenderingStats
()); | 1796 m_tileManager->SetRecordRenderingStats(m_debugState.recordRenderingStats
()); |
| 1792 } | 1797 } |
| 1793 | 1798 |
| 1794 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime, int
commitNumber) | 1799 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime, int
commitNumber) |
| 1795 { | 1800 { |
| 1796 DCHECK(m_debugState.continuousPainting); | 1801 DCHECK(m_debugState.continuousPainting); |
| 1797 m_paintTimeCounter->SavePaintTime(totalPaintTime, commitNumber); | 1802 m_paintTimeCounter->SavePaintTime(totalPaintTime, commitNumber); |
| 1798 } | 1803 } |
| 1799 | 1804 |
| 1800 } // namespace cc | 1805 } // namespace cc |
| OLD | NEW |