| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 78 |
| 79 namespace cc { | 79 namespace cc { |
| 80 class Layer; | 80 class Layer; |
| 81 } | 81 } |
| 82 | 82 |
| 83 using blink::WebFloatPoint; | 83 using blink::WebFloatPoint; |
| 84 using blink::WebRect; | 84 using blink::WebRect; |
| 85 using blink::WebSelection; | 85 using blink::WebSelection; |
| 86 using blink::WebSize; | 86 using blink::WebSize; |
| 87 using blink::WebBrowserControlsState; | 87 using blink::WebBrowserControlsState; |
| 88 using blink::WebScrollBoundaryBehavior; |
| 88 | 89 |
| 89 namespace content { | 90 namespace content { |
| 90 namespace { | 91 namespace { |
| 91 | 92 |
| 92 using ReportTimeCallback = base::Callback<void(bool, double)>; | 93 using ReportTimeCallback = base::Callback<void(bool, double)>; |
| 93 | 94 |
| 94 double MonotonicallyIncreasingTime() { | 95 double MonotonicallyIncreasingTime() { |
| 95 return static_cast<double>(base::TimeTicks::Now().ToInternalValue()) / | 96 return static_cast<double>(base::TimeTicks::Now().ToInternalValue()) / |
| 96 base::Time::kMicrosecondsPerSecond; | 97 base::Time::kMicrosecondsPerSecond; |
| 97 } | 98 } |
| (...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 // fact that this would make layout tests slow and cause flakiness. However, | 1107 // fact that this would make layout tests slow and cause flakiness. However, |
| 1107 // in this case we actually need a commit to transfer the decode requests to | 1108 // in this case we actually need a commit to transfer the decode requests to |
| 1108 // the impl side. So, force a commit to happen. | 1109 // the impl side. So, force a commit to happen. |
| 1109 if (CompositeIsSynchronous()) { | 1110 if (CompositeIsSynchronous()) { |
| 1110 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1111 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1111 FROM_HERE, base::Bind(&RenderWidgetCompositor::SynchronouslyComposite, | 1112 FROM_HERE, base::Bind(&RenderWidgetCompositor::SynchronouslyComposite, |
| 1112 weak_factory_.GetWeakPtr())); | 1113 weak_factory_.GetWeakPtr())); |
| 1113 } | 1114 } |
| 1114 } | 1115 } |
| 1115 | 1116 |
| 1117 void RenderWidgetCompositor::SetScrollBoundaryBehavior( |
| 1118 const WebScrollBoundaryBehavior& behavior) { |
| 1119 layer_tree_host_->SetScrollBoundaryBehavior(behavior); |
| 1120 } |
| 1121 |
| 1116 void RenderWidgetCompositor::WillBeginMainFrame() { | 1122 void RenderWidgetCompositor::WillBeginMainFrame() { |
| 1117 delegate_->WillBeginCompositorFrame(); | 1123 delegate_->WillBeginCompositorFrame(); |
| 1118 } | 1124 } |
| 1119 | 1125 |
| 1120 void RenderWidgetCompositor::DidBeginMainFrame() {} | 1126 void RenderWidgetCompositor::DidBeginMainFrame() {} |
| 1121 | 1127 |
| 1122 void RenderWidgetCompositor::BeginMainFrame(const cc::BeginFrameArgs& args) { | 1128 void RenderWidgetCompositor::BeginMainFrame(const cc::BeginFrameArgs& args) { |
| 1123 compositor_deps_->GetRendererScheduler()->WillBeginFrame(args); | 1129 compositor_deps_->GetRendererScheduler()->WillBeginFrame(args); |
| 1124 double frame_time_sec = (args.frame_time - base::TimeTicks()).InSecondsF(); | 1130 double frame_time_sec = (args.frame_time - base::TimeTicks()).InSecondsF(); |
| 1125 delegate_->BeginMainFrame(frame_time_sec); | 1131 delegate_->BeginMainFrame(frame_time_sec); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1254 const cc::LocalSurfaceId& local_surface_id) { | 1260 const cc::LocalSurfaceId& local_surface_id) { |
| 1255 layer_tree_host_->SetLocalSurfaceId(local_surface_id); | 1261 layer_tree_host_->SetLocalSurfaceId(local_surface_id); |
| 1256 } | 1262 } |
| 1257 | 1263 |
| 1258 void RenderWidgetCompositor::NotifySwapTime(ReportTimeCallback callback) { | 1264 void RenderWidgetCompositor::NotifySwapTime(ReportTimeCallback callback) { |
| 1259 QueueSwapPromise(base::MakeUnique<ReportTimeSwapPromise>( | 1265 QueueSwapPromise(base::MakeUnique<ReportTimeSwapPromise>( |
| 1260 std::move(callback), base::ThreadTaskRunnerHandle::Get())); | 1266 std::move(callback), base::ThreadTaskRunnerHandle::Get())); |
| 1261 } | 1267 } |
| 1262 | 1268 |
| 1263 } // namespace content | 1269 } // namespace content |
| OLD | NEW |