Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(819)

Side by Side Diff: cc/layer_tree_host_impl.cc

Issue 11817011: cc: add RingBuffer class for timestamp storing in FrameRateCounter (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: added DCHECKS for wrong buffer reads and divide by 0 Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 778
779 void LayerTreeHostImpl::drawLayers(FrameData& frame) 779 void LayerTreeHostImpl::drawLayers(FrameData& frame)
780 { 780 {
781 TRACE_EVENT0("cc", "LayerTreeHostImpl::drawLayers"); 781 TRACE_EVENT0("cc", "LayerTreeHostImpl::drawLayers");
782 DCHECK(canDraw()); 782 DCHECK(canDraw());
783 DCHECK(!frame.renderPasses.empty()); 783 DCHECK(!frame.renderPasses.empty());
784 784
785 // FIXME: use the frame begin time from the overall compositor scheduler. 785 // FIXME: use the frame begin time from the overall compositor scheduler.
786 // This value is currently inaccessible because it is up in Chromium's 786 // This value is currently inaccessible because it is up in Chromium's
787 // RenderWidget. 787 // RenderWidget.
788 m_fpsCounter->markBeginningOfFrame(base::TimeTicks::Now()); 788 m_fpsCounter->saveTimeStamp(base::TimeTicks::Now());
789 789
790 if (m_debugState.showHudRects()) 790 if (m_debugState.showHudRects())
791 m_debugRectHistory->saveDebugRectsForCurrentFrame(rootLayer(), *frame.re nderSurfaceLayerList, frame.occludingScreenSpaceRects, frame.nonOccludingScreenS paceRects, m_debugState); 791 m_debugRectHistory->saveDebugRectsForCurrentFrame(rootLayer(), *frame.re nderSurfaceLayerList, frame.occludingScreenSpaceRects, frame.nonOccludingScreenS paceRects, m_debugState);
792 792
793 // Because the contents of the HUD depend on everything else in the frame, t he contents 793 // Because the contents of the HUD depend on everything else in the frame, t he contents
794 // of its texture are updated as the last thing before the frame is drawn. 794 // of its texture are updated as the last thing before the frame is drawn.
795 if (m_activeTree->hud_layer()) 795 if (m_activeTree->hud_layer())
796 m_activeTree->hud_layer()->updateHudTexture(m_resourceProvider.get()); 796 m_activeTree->hud_layer()->updateHudTexture(m_resourceProvider.get());
797 797
798 m_renderer->drawFrame(frame.renderPasses); 798 m_renderer->drawFrame(frame.renderPasses);
(...skipping 29 matching lines...) Expand all
828 } 828 }
829 829
830 const RendererCapabilities& LayerTreeHostImpl::rendererCapabilities() const 830 const RendererCapabilities& LayerTreeHostImpl::rendererCapabilities() const
831 { 831 {
832 return m_renderer->capabilities(); 832 return m_renderer->capabilities();
833 } 833 }
834 834
835 bool LayerTreeHostImpl::swapBuffers() 835 bool LayerTreeHostImpl::swapBuffers()
836 { 836 {
837 DCHECK(m_renderer); 837 DCHECK(m_renderer);
838
839 m_fpsCounter->markEndOfFrame();
840 return m_renderer->swapBuffers(); 838 return m_renderer->swapBuffers();
841 } 839 }
842 840
843 const gfx::Size& LayerTreeHostImpl::deviceViewportSize() const 841 const gfx::Size& LayerTreeHostImpl::deviceViewportSize() const
844 { 842 {
845 return m_deviceViewportSize; 843 return m_deviceViewportSize;
846 } 844 }
847 845
848 const LayerTreeSettings& LayerTreeHostImpl::settings() const 846 const LayerTreeSettings& LayerTreeHostImpl::settings() const
849 { 847 {
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
1631 } 1629 }
1632 1630
1633 skia::RefPtr<SkPicture> LayerTreeHostImpl::capturePicture() 1631 skia::RefPtr<SkPicture> LayerTreeHostImpl::capturePicture()
1634 { 1632 {
1635 LayerTreeImpl* tree = pendingTree() ? pendingTree() : activeTree(); 1633 LayerTreeImpl* tree = pendingTree() ? pendingTree() : activeTree();
1636 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer()); 1634 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer());
1637 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>(); 1635 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>();
1638 } 1636 }
1639 1637
1640 } // namespace cc 1638 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698