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

Side by Side Diff: content/renderer/gpu/render_widget_compositor.cc

Issue 1137823002: Pass collected frame timing events to Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Some code review cleanup. Created 5 years, 7 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 (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 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 void RenderWidgetCompositor::ApplyViewportDeltas( 870 void RenderWidgetCompositor::ApplyViewportDeltas(
871 const gfx::Vector2d& scroll_delta, 871 const gfx::Vector2d& scroll_delta,
872 float page_scale, 872 float page_scale,
873 float top_controls_delta) { 873 float top_controls_delta) {
874 widget_->webwidget()->applyViewportDeltas( 874 widget_->webwidget()->applyViewportDeltas(
875 scroll_delta, 875 scroll_delta,
876 page_scale, 876 page_scale,
877 top_controls_delta); 877 top_controls_delta);
878 } 878 }
879 879
880 namespace {
881
882 blink::WebFrameTimingEvent CompositeTimingEventToDouble(
883 const cc::FrameTimingTracker::CompositeTimingEvent& event) {
884 return blink::WebFrameTimingEvent(event.frame_id,
885 (event.timestamp - base::TimeTicks()).InSecondsF());
886 }
887
888 blink::WebFrameTimingEvent MainFrameTimingEventToDouble(
889 const cc::FrameTimingTracker::MainFrameTimingEvent& event) {
890 return blink::WebFrameTimingEvent(event.frame_id,
891 (event.timestamp - base::TimeTicks()).InSecondsF(),
892 (event.end_time - base::TimeTicks()).InSecondsF());
893 }
894
895 } // namespace
896
897 void RenderWidgetCompositor::RecordCompositeTimings(
898 cc::FrameTimingTracker::CompositeTimingSet* composites) {
899 for (const auto& record : *composites ) {
900 int64_t frameId = record.first;
901 const std::vector<cc::FrameTimingTracker::CompositeTimingEvent>& events =
902 record.second;
903 std::vector<blink::WebFrameTimingEvent> webEvents(events.size());
904 std::transform(events.begin(), events.end(), webEvents.begin(),
905 CompositeTimingEventToDouble);
906 widget_->webwidget()->recordFrameTimingEvent(
907 blink::WebWidget::CompositeEvent, frameId, webEvents);
908 }
909 }
910
911 void RenderWidgetCompositor::RecordRenderTimings(
912 cc::FrameTimingTracker::MainFrameTimingSet* renders) {
913 for (const auto& record : *renders ) {
914 int64_t frameId = record.first;
915 const std::vector<cc::FrameTimingTracker::MainFrameTimingEvent>& events =
916 record.second;
917 std::vector<blink::WebFrameTimingEvent> webEvents(events.size());
918 std::transform(events.begin(), events.end(), webEvents.begin(),
919 MainFrameTimingEventToDouble);
920 widget_->webwidget()->recordFrameTimingEvent(
921 blink::WebWidget::RenderEvent, frameId, webEvents);
922 }
923 }
924
880 void RenderWidgetCompositor::RequestNewOutputSurface() { 925 void RenderWidgetCompositor::RequestNewOutputSurface() {
881 // 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
882 // prevents shutdown races between handling the close message and 927 // prevents shutdown races between handling the close message and
883 // the CreateOutputSurface task. 928 // the CreateOutputSurface task.
884 if (widget_->host_closing()) 929 if (widget_->host_closing())
885 return; 930 return;
886 931
887 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/466870 932 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/466870
888 // is fixed. 933 // is fixed.
889 tracked_objects::ScopedTracker tracking_profile( 934 tracked_objects::ScopedTracker tracking_profile(
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 return; 1013 return;
969 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); 1014 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM();
970 } 1015 }
971 1016
972 void RenderWidgetCompositor::SetSurfaceIdNamespace( 1017 void RenderWidgetCompositor::SetSurfaceIdNamespace(
973 uint32_t surface_id_namespace) { 1018 uint32_t surface_id_namespace) {
974 layer_tree_host_->set_surface_id_namespace(surface_id_namespace); 1019 layer_tree_host_->set_surface_id_namespace(surface_id_namespace);
975 } 1020 }
976 1021
977 } // namespace content 1022 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/gpu/render_widget_compositor.h ('k') | content/test/web_layer_tree_view_impl_for_testing.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698