Chromium Code Reviews| 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 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 877 void RenderWidgetCompositor::ApplyViewportDeltas( | 877 void RenderWidgetCompositor::ApplyViewportDeltas( |
| 878 const gfx::Vector2d& scroll_delta, | 878 const gfx::Vector2d& scroll_delta, |
| 879 float page_scale, | 879 float page_scale, |
| 880 float top_controls_delta) { | 880 float top_controls_delta) { |
| 881 widget_->webwidget()->applyViewportDeltas( | 881 widget_->webwidget()->applyViewportDeltas( |
| 882 scroll_delta, | 882 scroll_delta, |
| 883 page_scale, | 883 page_scale, |
| 884 top_controls_delta); | 884 top_controls_delta); |
| 885 } | 885 } |
| 886 | 886 |
| 887 static std::tuple<int, double, double> CompositeTimingEventToDouble( | |
|
vmpstr
2015/05/12 23:48:26
I don't think you can use a tuple unless we have f
MikeB
2015/05/21 21:53:08
Done.
| |
| 888 const cc::FrameTimingTracker::CompositeTimingEvent& event) { | |
| 889 return std::make_tuple(event.frame_id, | |
| 890 (event.timestamp - base::TimeTicks()).InSecondsF(), | |
| 891 0); | |
| 892 } | |
| 893 | |
| 894 void RenderWidgetCompositor::RecordCompositeTimings( | |
| 895 cc::FrameTimingTracker::CompositeTimingSet* composites) { | |
| 896 for (const auto& record : *composites ) { | |
|
vmpstr
2015/05/12 23:48:26
Can you give names (variables) to record.first and
MikeB
2015/05/21 21:53:08
Done.
| |
| 897 std::vector<std::tuple<int, double, double>> | |
| 898 compositeTiming(record.second.size()); | |
| 899 std::transform(record.second.begin(), record.second.end(), | |
| 900 compositeTiming.begin(), CompositeTimingEventToDouble); | |
| 901 widget_->webwidget()->recordFrameTimingEvent( | |
| 902 blink::WebWidget::CompositeEvent, record.first, compositeTiming); | |
| 903 } | |
| 904 } | |
| 905 | |
| 906 static std::tuple<int, double, double> MainFrameTimingEventToDouble( | |
| 907 const cc::FrameTimingTracker::MainFrameTimingEvent& event) { | |
| 908 return std::make_tuple(event.frame_id, | |
| 909 (event.timestamp - base::TimeTicks()).InSecondsF(), | |
| 910 (event.end_time - base::TimeTicks()).InSecondsF()); | |
| 911 } | |
| 912 | |
| 913 void RenderWidgetCompositor::RecordRenderTimings( | |
| 914 cc::FrameTimingTracker::MainFrameTimingSet* renders) { | |
| 915 for (const auto& record : *renders ) { | |
| 916 std::vector<std::tuple<int, double, double>> | |
| 917 renderTiming(record.second.size()); | |
| 918 std::transform(record.second.begin(), record.second.end(), | |
| 919 renderTiming.begin(), MainFrameTimingEventToDouble); | |
| 920 widget_->webwidget()->recordFrameTimingEvent( | |
| 921 blink::WebWidget::RenderEvent, record.first, renderTiming); | |
| 922 } | |
| 923 } | |
| 924 | |
| 887 void RenderWidgetCompositor::RequestNewOutputSurface() { | 925 void RenderWidgetCompositor::RequestNewOutputSurface() { |
| 888 // If the host is closing, then no more compositing is possible. This | 926 // If the host is closing, then no more compositing is possible. This |
| 889 // prevents shutdown races between handling the close message and | 927 // prevents shutdown races between handling the close message and |
| 890 // the CreateOutputSurface task. | 928 // the CreateOutputSurface task. |
| 891 if (widget_->host_closing()) | 929 if (widget_->host_closing()) |
| 892 return; | 930 return; |
| 893 | 931 |
| 894 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/466870 | 932 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/466870 |
| 895 // is fixed. | 933 // is fixed. |
| 896 tracked_objects::ScopedTracker tracking_profile( | 934 tracked_objects::ScopedTracker tracking_profile( |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 970 cc::ContextProvider* provider = | 1008 cc::ContextProvider* provider = |
| 971 compositor_deps_->GetSharedMainThreadContextProvider(); | 1009 compositor_deps_->GetSharedMainThreadContextProvider(); |
| 972 // provider can be NULL after the GPU process crashed enough times and we | 1010 // provider can be NULL after the GPU process crashed enough times and we |
| 973 // don't want to restart it any more (falling back to software). | 1011 // don't want to restart it any more (falling back to software). |
| 974 if (!provider) | 1012 if (!provider) |
| 975 return; | 1013 return; |
| 976 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 1014 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
| 977 } | 1015 } |
| 978 | 1016 |
| 979 } // namespace content | 1017 } // namespace content |
| OLD | NEW |