| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/renderer/gpu/render_widget_compositor.h" | 5 #include "content/renderer/gpu/render_widget_compositor.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 void RenderWidgetCompositor::ApplyViewportDeltas( | 788 void RenderWidgetCompositor::ApplyViewportDeltas( |
| 789 const gfx::Vector2d& scroll_delta, | 789 const gfx::Vector2d& scroll_delta, |
| 790 float page_scale, | 790 float page_scale, |
| 791 float top_controls_delta) { | 791 float top_controls_delta) { |
| 792 widget_->webwidget()->applyViewportDeltas( | 792 widget_->webwidget()->applyViewportDeltas( |
| 793 scroll_delta, | 793 scroll_delta, |
| 794 page_scale, | 794 page_scale, |
| 795 top_controls_delta); | 795 top_controls_delta); |
| 796 } | 796 } |
| 797 | 797 |
| 798 static std::pair<int, double> TickToDouble( |
| 799 const std::pair<int, const base::TimeTicks>& tick) { |
| 800 return std::make_pair(tick.first, |
| 801 (tick.second - base::TimeTicks()).InSecondsF()); |
| 802 } |
| 803 |
| 804 void RenderWidgetCompositor::RecordCommitTiming( |
| 805 int64_t rect_id, |
| 806 const std::pair<int, base::TimeTicks>& commit) { |
| 807 std::vector<std::pair<int, double> > commitTiming(1); |
| 808 commitTiming[0] = TickToDouble(commit); |
| 809 widget_->webwidget()->recordSmoothnessTimingEvent( |
| 810 blink::WebWidget::CommitEvent, rect_id, commitTiming); |
| 811 } |
| 812 void RenderWidgetCompositor::RecordCompositeTiming( |
| 813 int64_t rect_id, |
| 814 const std::vector<std::pair<int, base::TimeTicks> >& composites) { |
| 815 std::vector<std::pair<int, double> > compositeTiming(composites.size()); |
| 816 std::transform(composites.begin(), |
| 817 composites.end(), |
| 818 compositeTiming.begin(), |
| 819 TickToDouble); |
| 820 widget_->webwidget()->recordSmoothnessTimingEvent( |
| 821 blink::WebWidget::CompositeEvent, rect_id, compositeTiming); |
| 822 } |
| 823 |
| 798 scoped_ptr<cc::OutputSurface> RenderWidgetCompositor::CreateOutputSurface( | 824 scoped_ptr<cc::OutputSurface> RenderWidgetCompositor::CreateOutputSurface( |
| 799 bool fallback) { | 825 bool fallback) { |
| 800 return widget_->CreateOutputSurface(fallback); | 826 return widget_->CreateOutputSurface(fallback); |
| 801 } | 827 } |
| 802 | 828 |
| 803 void RenderWidgetCompositor::DidInitializeOutputSurface() { | 829 void RenderWidgetCompositor::DidInitializeOutputSurface() { |
| 804 } | 830 } |
| 805 | 831 |
| 806 void RenderWidgetCompositor::WillCommit() { | 832 void RenderWidgetCompositor::WillCommit() { |
| 807 widget_->InstrumentWillComposite(); | 833 widget_->InstrumentWillComposite(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 widget_->OnSwapBuffersAborted(); | 873 widget_->OnSwapBuffersAborted(); |
| 848 } | 874 } |
| 849 | 875 |
| 850 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { | 876 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { |
| 851 cc::ContextProvider* provider = | 877 cc::ContextProvider* provider = |
| 852 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); | 878 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
| 853 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 879 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
| 854 } | 880 } |
| 855 | 881 |
| 856 } // namespace content | 882 } // namespace content |
| OLD | NEW |