| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 namespace cc { | 82 namespace cc { |
| 83 class Layer; | 83 class Layer; |
| 84 } | 84 } |
| 85 | 85 |
| 86 using blink::WebFloatPoint; | 86 using blink::WebFloatPoint; |
| 87 using blink::WebRect; | 87 using blink::WebRect; |
| 88 using blink::WebSelection; | 88 using blink::WebSelection; |
| 89 using blink::WebSize; | 89 using blink::WebSize; |
| 90 using blink::WebBrowserControlsState; | 90 using blink::WebBrowserControlsState; |
| 91 using blink::WebScrollBoundaryBehavior; |
| 91 | 92 |
| 92 namespace content { | 93 namespace content { |
| 93 namespace { | 94 namespace { |
| 94 | 95 |
| 95 using ReportTimeCallback = base::Callback<void(bool, double)>; | 96 using ReportTimeCallback = base::Callback<void(bool, double)>; |
| 96 | 97 |
| 97 double MonotonicallyIncreasingTime() { | 98 double MonotonicallyIncreasingTime() { |
| 98 return static_cast<double>(base::TimeTicks::Now().ToInternalValue()) / | 99 return static_cast<double>(base::TimeTicks::Now().ToInternalValue()) / |
| 99 base::Time::kMicrosecondsPerSecond; | 100 base::Time::kMicrosecondsPerSecond; |
| 100 } | 101 } |
| (...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 // fact that this would make layout tests slow and cause flakiness. However, | 1125 // fact that this would make layout tests slow and cause flakiness. However, |
| 1125 // in this case we actually need a commit to transfer the decode requests to | 1126 // in this case we actually need a commit to transfer the decode requests to |
| 1126 // the impl side. So, force a commit to happen. | 1127 // the impl side. So, force a commit to happen. |
| 1127 if (CompositeIsSynchronous()) { | 1128 if (CompositeIsSynchronous()) { |
| 1128 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1129 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1129 FROM_HERE, base::Bind(&RenderWidgetCompositor::SynchronouslyComposite, | 1130 FROM_HERE, base::Bind(&RenderWidgetCompositor::SynchronouslyComposite, |
| 1130 weak_factory_.GetWeakPtr())); | 1131 weak_factory_.GetWeakPtr())); |
| 1131 } | 1132 } |
| 1132 } | 1133 } |
| 1133 | 1134 |
| 1135 void RenderWidgetCompositor::SetScrollBoundaryBehavior( |
| 1136 const WebScrollBoundaryBehavior& behavior) { |
| 1137 layer_tree_host_->SetScrollBoundaryBehavior(behavior); |
| 1138 } |
| 1139 |
| 1134 void RenderWidgetCompositor::WillBeginMainFrame() { | 1140 void RenderWidgetCompositor::WillBeginMainFrame() { |
| 1135 delegate_->WillBeginCompositorFrame(); | 1141 delegate_->WillBeginCompositorFrame(); |
| 1136 } | 1142 } |
| 1137 | 1143 |
| 1138 void RenderWidgetCompositor::DidBeginMainFrame() {} | 1144 void RenderWidgetCompositor::DidBeginMainFrame() {} |
| 1139 | 1145 |
| 1140 void RenderWidgetCompositor::BeginMainFrame(const viz::BeginFrameArgs& args) { | 1146 void RenderWidgetCompositor::BeginMainFrame(const viz::BeginFrameArgs& args) { |
| 1141 compositor_deps_->GetRendererScheduler()->WillBeginFrame(args); | 1147 compositor_deps_->GetRendererScheduler()->WillBeginFrame(args); |
| 1142 double frame_time_sec = (args.frame_time - base::TimeTicks()).InSecondsF(); | 1148 double frame_time_sec = (args.frame_time - base::TimeTicks()).InSecondsF(); |
| 1143 delegate_->BeginMainFrame(frame_time_sec); | 1149 delegate_->BeginMainFrame(frame_time_sec); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1272 void RenderWidgetCompositor::NotifySwapTime(ReportTimeCallback callback) { | 1278 void RenderWidgetCompositor::NotifySwapTime(ReportTimeCallback callback) { |
| 1273 QueueSwapPromise(base::MakeUnique<ReportTimeSwapPromise>( | 1279 QueueSwapPromise(base::MakeUnique<ReportTimeSwapPromise>( |
| 1274 std::move(callback), base::ThreadTaskRunnerHandle::Get())); | 1280 std::move(callback), base::ThreadTaskRunnerHandle::Get())); |
| 1275 } | 1281 } |
| 1276 | 1282 |
| 1277 void RenderWidgetCompositor::RequestBeginMainFrameNotExpected(bool new_state) { | 1283 void RenderWidgetCompositor::RequestBeginMainFrameNotExpected(bool new_state) { |
| 1278 layer_tree_host_->RequestBeginMainFrameNotExpected(new_state); | 1284 layer_tree_host_->RequestBeginMainFrameNotExpected(new_state); |
| 1279 } | 1285 } |
| 1280 | 1286 |
| 1281 } // namespace content | 1287 } // namespace content |
| OLD | NEW |