| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 namespace cc { | 80 namespace cc { |
| 81 class Layer; | 81 class Layer; |
| 82 } | 82 } |
| 83 | 83 |
| 84 using blink::WebFloatPoint; | 84 using blink::WebFloatPoint; |
| 85 using blink::WebRect; | 85 using blink::WebRect; |
| 86 using blink::WebSelection; | 86 using blink::WebSelection; |
| 87 using blink::WebSize; | 87 using blink::WebSize; |
| 88 using blink::WebBrowserControlsState; | 88 using blink::WebBrowserControlsState; |
| 89 using blink::WebScrollBoundaryBehavior; |
| 89 | 90 |
| 90 namespace content { | 91 namespace content { |
| 91 namespace { | 92 namespace { |
| 92 | 93 |
| 93 using ReportTimeCallback = base::Callback<void(bool, double)>; | 94 using ReportTimeCallback = base::Callback<void(bool, double)>; |
| 94 | 95 |
| 95 double MonotonicallyIncreasingTime() { | 96 double MonotonicallyIncreasingTime() { |
| 96 return static_cast<double>(base::TimeTicks::Now().ToInternalValue()) / | 97 return static_cast<double>(base::TimeTicks::Now().ToInternalValue()) / |
| 97 base::Time::kMicrosecondsPerSecond; | 98 base::Time::kMicrosecondsPerSecond; |
| 98 } | 99 } |
| (...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1115 // fact that this would make layout tests slow and cause flakiness. However, | 1116 // fact that this would make layout tests slow and cause flakiness. However, |
| 1116 // in this case we actually need a commit to transfer the decode requests to | 1117 // in this case we actually need a commit to transfer the decode requests to |
| 1117 // the impl side. So, force a commit to happen. | 1118 // the impl side. So, force a commit to happen. |
| 1118 if (CompositeIsSynchronous()) { | 1119 if (CompositeIsSynchronous()) { |
| 1119 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1120 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1120 FROM_HERE, base::Bind(&RenderWidgetCompositor::SynchronouslyComposite, | 1121 FROM_HERE, base::Bind(&RenderWidgetCompositor::SynchronouslyComposite, |
| 1121 weak_factory_.GetWeakPtr())); | 1122 weak_factory_.GetWeakPtr())); |
| 1122 } | 1123 } |
| 1123 } | 1124 } |
| 1124 | 1125 |
| 1126 void RenderWidgetCompositor::SetScrollBoundaryBehavior( |
| 1127 const WebScrollBoundaryBehavior& behavior) { |
| 1128 layer_tree_host_->SetScrollBoundaryBehavior(behavior); |
| 1129 } |
| 1130 |
| 1125 void RenderWidgetCompositor::WillBeginMainFrame() { | 1131 void RenderWidgetCompositor::WillBeginMainFrame() { |
| 1126 delegate_->WillBeginCompositorFrame(); | 1132 delegate_->WillBeginCompositorFrame(); |
| 1127 } | 1133 } |
| 1128 | 1134 |
| 1129 void RenderWidgetCompositor::DidBeginMainFrame() {} | 1135 void RenderWidgetCompositor::DidBeginMainFrame() {} |
| 1130 | 1136 |
| 1131 void RenderWidgetCompositor::BeginMainFrame(const viz::BeginFrameArgs& args) { | 1137 void RenderWidgetCompositor::BeginMainFrame(const viz::BeginFrameArgs& args) { |
| 1132 compositor_deps_->GetRendererScheduler()->WillBeginFrame(args); | 1138 compositor_deps_->GetRendererScheduler()->WillBeginFrame(args); |
| 1133 double frame_time_sec = (args.frame_time - base::TimeTicks()).InSecondsF(); | 1139 double frame_time_sec = (args.frame_time - base::TimeTicks()).InSecondsF(); |
| 1134 delegate_->BeginMainFrame(frame_time_sec); | 1140 delegate_->BeginMainFrame(frame_time_sec); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1263 void RenderWidgetCompositor::NotifySwapTime(ReportTimeCallback callback) { | 1269 void RenderWidgetCompositor::NotifySwapTime(ReportTimeCallback callback) { |
| 1264 QueueSwapPromise(base::MakeUnique<ReportTimeSwapPromise>( | 1270 QueueSwapPromise(base::MakeUnique<ReportTimeSwapPromise>( |
| 1265 std::move(callback), base::ThreadTaskRunnerHandle::Get())); | 1271 std::move(callback), base::ThreadTaskRunnerHandle::Get())); |
| 1266 } | 1272 } |
| 1267 | 1273 |
| 1268 void RenderWidgetCompositor::RequestBeginMainFrameNotExpected(bool new_state) { | 1274 void RenderWidgetCompositor::RequestBeginMainFrameNotExpected(bool new_state) { |
| 1269 layer_tree_host_->RequestBeginMainFrameNotExpected(new_state); | 1275 layer_tree_host_->RequestBeginMainFrameNotExpected(new_state); |
| 1270 } | 1276 } |
| 1271 | 1277 |
| 1272 } // namespace content | 1278 } // namespace content |
| OLD | NEW |