| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 namespace cc { | 83 namespace cc { |
| 84 class Layer; | 84 class Layer; |
| 85 } | 85 } |
| 86 | 86 |
| 87 using blink::WebFloatPoint; | 87 using blink::WebFloatPoint; |
| 88 using blink::WebRect; | 88 using blink::WebRect; |
| 89 using blink::WebSelection; | 89 using blink::WebSelection; |
| 90 using blink::WebSize; | 90 using blink::WebSize; |
| 91 using blink::WebBrowserControlsState; | 91 using blink::WebBrowserControlsState; |
| 92 using blink::WebLayerTreeView; | 92 using blink::WebLayerTreeView; |
| 93 using blink::WebScrollBoundaryBehavior; |
| 93 | 94 |
| 94 namespace content { | 95 namespace content { |
| 95 namespace { | 96 namespace { |
| 96 | 97 |
| 97 using ReportTimeCallback = | 98 using ReportTimeCallback = |
| 98 base::Callback<void(WebLayerTreeView::SwapResult, double)>; | 99 base::Callback<void(WebLayerTreeView::SwapResult, double)>; |
| 99 | 100 |
| 100 double MonotonicallyIncreasingTime() { | 101 double MonotonicallyIncreasingTime() { |
| 101 return static_cast<double>(base::TimeTicks::Now().ToInternalValue()) / | 102 return static_cast<double>(base::TimeTicks::Now().ToInternalValue()) / |
| 102 base::Time::kMicrosecondsPerSecond; | 103 base::Time::kMicrosecondsPerSecond; |
| (...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1178 // fact that this would make layout tests slow and cause flakiness. However, | 1179 // fact that this would make layout tests slow and cause flakiness. However, |
| 1179 // in this case we actually need a commit to transfer the decode requests to | 1180 // in this case we actually need a commit to transfer the decode requests to |
| 1180 // the impl side. So, force a commit to happen. | 1181 // the impl side. So, force a commit to happen. |
| 1181 if (CompositeIsSynchronous()) { | 1182 if (CompositeIsSynchronous()) { |
| 1182 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1183 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1183 FROM_HERE, base::Bind(&RenderWidgetCompositor::SynchronouslyComposite, | 1184 FROM_HERE, base::Bind(&RenderWidgetCompositor::SynchronouslyComposite, |
| 1184 weak_factory_.GetWeakPtr())); | 1185 weak_factory_.GetWeakPtr())); |
| 1185 } | 1186 } |
| 1186 } | 1187 } |
| 1187 | 1188 |
| 1189 void RenderWidgetCompositor::SetScrollBoundaryBehavior( |
| 1190 const WebScrollBoundaryBehavior& behavior) { |
| 1191 layer_tree_host_->SetScrollBoundaryBehavior(behavior); |
| 1192 } |
| 1193 |
| 1188 void RenderWidgetCompositor::WillBeginMainFrame() { | 1194 void RenderWidgetCompositor::WillBeginMainFrame() { |
| 1189 delegate_->WillBeginCompositorFrame(); | 1195 delegate_->WillBeginCompositorFrame(); |
| 1190 } | 1196 } |
| 1191 | 1197 |
| 1192 void RenderWidgetCompositor::DidBeginMainFrame() {} | 1198 void RenderWidgetCompositor::DidBeginMainFrame() {} |
| 1193 | 1199 |
| 1194 void RenderWidgetCompositor::BeginMainFrame(const viz::BeginFrameArgs& args) { | 1200 void RenderWidgetCompositor::BeginMainFrame(const viz::BeginFrameArgs& args) { |
| 1195 compositor_deps_->GetRendererScheduler()->WillBeginFrame(args); | 1201 compositor_deps_->GetRendererScheduler()->WillBeginFrame(args); |
| 1196 double frame_time_sec = (args.frame_time - base::TimeTicks()).InSecondsF(); | 1202 double frame_time_sec = (args.frame_time - base::TimeTicks()).InSecondsF(); |
| 1197 delegate_->BeginMainFrame(frame_time_sec); | 1203 delegate_->BeginMainFrame(frame_time_sec); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1321 void RenderWidgetCompositor::NotifySwapTime(ReportTimeCallback callback) { | 1327 void RenderWidgetCompositor::NotifySwapTime(ReportTimeCallback callback) { |
| 1322 QueueSwapPromise(base::MakeUnique<ReportTimeSwapPromise>( | 1328 QueueSwapPromise(base::MakeUnique<ReportTimeSwapPromise>( |
| 1323 std::move(callback), base::ThreadTaskRunnerHandle::Get())); | 1329 std::move(callback), base::ThreadTaskRunnerHandle::Get())); |
| 1324 } | 1330 } |
| 1325 | 1331 |
| 1326 void RenderWidgetCompositor::RequestBeginMainFrameNotExpected(bool new_state) { | 1332 void RenderWidgetCompositor::RequestBeginMainFrameNotExpected(bool new_state) { |
| 1327 layer_tree_host_->RequestBeginMainFrameNotExpected(new_state); | 1333 layer_tree_host_->RequestBeginMainFrameNotExpected(new_state); |
| 1328 } | 1334 } |
| 1329 | 1335 |
| 1330 } // namespace content | 1336 } // namespace content |
| OLD | NEW |