| 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 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1147 // fact that this would make layout tests slow and cause flakiness. However, | 1148 // fact that this would make layout tests slow and cause flakiness. However, |
| 1148 // in this case we actually need a commit to transfer the decode requests to | 1149 // in this case we actually need a commit to transfer the decode requests to |
| 1149 // the impl side. So, force a commit to happen. | 1150 // the impl side. So, force a commit to happen. |
| 1150 if (CompositeIsSynchronous()) { | 1151 if (CompositeIsSynchronous()) { |
| 1151 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1152 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1152 FROM_HERE, base::Bind(&RenderWidgetCompositor::SynchronouslyComposite, | 1153 FROM_HERE, base::Bind(&RenderWidgetCompositor::SynchronouslyComposite, |
| 1153 weak_factory_.GetWeakPtr())); | 1154 weak_factory_.GetWeakPtr())); |
| 1154 } | 1155 } |
| 1155 } | 1156 } |
| 1156 | 1157 |
| 1158 void RenderWidgetCompositor::SetScrollBoundaryBehavior( |
| 1159 const WebScrollBoundaryBehavior& behavior) { |
| 1160 layer_tree_host_->SetScrollBoundaryBehavior(behavior); |
| 1161 } |
| 1162 |
| 1157 void RenderWidgetCompositor::WillBeginMainFrame() { | 1163 void RenderWidgetCompositor::WillBeginMainFrame() { |
| 1158 delegate_->WillBeginCompositorFrame(); | 1164 delegate_->WillBeginCompositorFrame(); |
| 1159 } | 1165 } |
| 1160 | 1166 |
| 1161 void RenderWidgetCompositor::DidBeginMainFrame() {} | 1167 void RenderWidgetCompositor::DidBeginMainFrame() {} |
| 1162 | 1168 |
| 1163 void RenderWidgetCompositor::BeginMainFrame(const viz::BeginFrameArgs& args) { | 1169 void RenderWidgetCompositor::BeginMainFrame(const viz::BeginFrameArgs& args) { |
| 1164 compositor_deps_->GetRendererScheduler()->WillBeginFrame(args); | 1170 compositor_deps_->GetRendererScheduler()->WillBeginFrame(args); |
| 1165 double frame_time_sec = (args.frame_time - base::TimeTicks()).InSecondsF(); | 1171 double frame_time_sec = (args.frame_time - base::TimeTicks()).InSecondsF(); |
| 1166 delegate_->BeginMainFrame(frame_time_sec); | 1172 delegate_->BeginMainFrame(frame_time_sec); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1290 void RenderWidgetCompositor::NotifySwapTime(ReportTimeCallback callback) { | 1296 void RenderWidgetCompositor::NotifySwapTime(ReportTimeCallback callback) { |
| 1291 QueueSwapPromise(base::MakeUnique<ReportTimeSwapPromise>( | 1297 QueueSwapPromise(base::MakeUnique<ReportTimeSwapPromise>( |
| 1292 std::move(callback), base::ThreadTaskRunnerHandle::Get())); | 1298 std::move(callback), base::ThreadTaskRunnerHandle::Get())); |
| 1293 } | 1299 } |
| 1294 | 1300 |
| 1295 void RenderWidgetCompositor::RequestBeginMainFrameNotExpected(bool new_state) { | 1301 void RenderWidgetCompositor::RequestBeginMainFrameNotExpected(bool new_state) { |
| 1296 layer_tree_host_->RequestBeginMainFrameNotExpected(new_state); | 1302 layer_tree_host_->RequestBeginMainFrameNotExpected(new_state); |
| 1297 } | 1303 } |
| 1298 | 1304 |
| 1299 } // namespace content | 1305 } // namespace content |
| OLD | NEW |