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 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 | 796 |
797 void LayerTreeHostImpl::drawLayers(FrameData& frame) | 797 void LayerTreeHostImpl::drawLayers(FrameData& frame) |
798 { | 798 { |
799 TRACE_EVENT0("cc", "LayerTreeHostImpl::drawLayers"); | 799 TRACE_EVENT0("cc", "LayerTreeHostImpl::drawLayers"); |
800 DCHECK(canDraw()); | 800 DCHECK(canDraw()); |
801 DCHECK(!frame.renderPasses.empty()); | 801 DCHECK(!frame.renderPasses.empty()); |
802 | 802 |
803 // FIXME: use the frame begin time from the overall compositor scheduler. | 803 // FIXME: use the frame begin time from the overall compositor scheduler. |
804 // This value is currently inaccessible because it is up in Chromium's | 804 // This value is currently inaccessible because it is up in Chromium's |
805 // RenderWidget. | 805 // RenderWidget. |
806 m_fpsCounter->markBeginningOfFrame(base::TimeTicks::Now()); | 806 m_fpsCounter->saveTimeStamp(base::TimeTicks::Now()); |
807 | 807 |
808 if (m_debugState.showHudRects()) | 808 if (m_debugState.showHudRects()) |
809 m_debugRectHistory->saveDebugRectsForCurrentFrame(rootLayer(), *frame.re
nderSurfaceLayerList, frame.occludingScreenSpaceRects, frame.nonOccludingScreenS
paceRects, m_debugState); | 809 m_debugRectHistory->saveDebugRectsForCurrentFrame(rootLayer(), *frame.re
nderSurfaceLayerList, frame.occludingScreenSpaceRects, frame.nonOccludingScreenS
paceRects, m_debugState); |
810 | 810 |
811 // Because the contents of the HUD depend on everything else in the frame, t
he contents | 811 // Because the contents of the HUD depend on everything else in the frame, t
he contents |
812 // of its texture are updated as the last thing before the frame is drawn. | 812 // of its texture are updated as the last thing before the frame is drawn. |
813 if (m_activeTree->hud_layer()) | 813 if (m_activeTree->hud_layer()) |
814 m_activeTree->hud_layer()->updateHudTexture(m_resourceProvider.get()); | 814 m_activeTree->hud_layer()->updateHudTexture(m_resourceProvider.get()); |
815 | 815 |
816 m_renderer->drawFrame(frame.renderPasses); | 816 m_renderer->drawFrame(frame.renderPasses); |
(...skipping 29 matching lines...) Expand all Loading... |
846 } | 846 } |
847 | 847 |
848 const RendererCapabilities& LayerTreeHostImpl::rendererCapabilities() const | 848 const RendererCapabilities& LayerTreeHostImpl::rendererCapabilities() const |
849 { | 849 { |
850 return m_renderer->capabilities(); | 850 return m_renderer->capabilities(); |
851 } | 851 } |
852 | 852 |
853 bool LayerTreeHostImpl::swapBuffers() | 853 bool LayerTreeHostImpl::swapBuffers() |
854 { | 854 { |
855 DCHECK(m_renderer); | 855 DCHECK(m_renderer); |
856 | |
857 m_fpsCounter->markEndOfFrame(); | |
858 return m_renderer->swapBuffers(); | 856 return m_renderer->swapBuffers(); |
859 } | 857 } |
860 | 858 |
861 const gfx::Size& LayerTreeHostImpl::deviceViewportSize() const | 859 const gfx::Size& LayerTreeHostImpl::deviceViewportSize() const |
862 { | 860 { |
863 return m_deviceViewportSize; | 861 return m_deviceViewportSize; |
864 } | 862 } |
865 | 863 |
866 const LayerTreeSettings& LayerTreeHostImpl::settings() const | 864 const LayerTreeSettings& LayerTreeHostImpl::settings() const |
867 { | 865 { |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1649 } | 1647 } |
1650 | 1648 |
1651 skia::RefPtr<SkPicture> LayerTreeHostImpl::capturePicture() | 1649 skia::RefPtr<SkPicture> LayerTreeHostImpl::capturePicture() |
1652 { | 1650 { |
1653 LayerTreeImpl* tree = pendingTree() ? pendingTree() : activeTree(); | 1651 LayerTreeImpl* tree = pendingTree() ? pendingTree() : activeTree(); |
1654 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer()); | 1652 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer()); |
1655 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>(); | 1653 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>(); |
1656 } | 1654 } |
1657 | 1655 |
1658 } // namespace cc | 1656 } // namespace cc |
OLD | NEW |