| 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 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 // fact that this would make layout tests slow and cause flakiness. However, | 1115 // fact that this would make layout tests slow and cause flakiness. However, |
| 1115 // in this case we actually need a commit to transfer the decode requests to | 1116 // in this case we actually need a commit to transfer the decode requests to |
| 1116 // the impl side. So, force a commit to happen. | 1117 // the impl side. So, force a commit to happen. |
| 1117 if (CompositeIsSynchronous()) { | 1118 if (CompositeIsSynchronous()) { |
| 1118 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1119 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1119 FROM_HERE, base::Bind(&RenderWidgetCompositor::SynchronouslyComposite, | 1120 FROM_HERE, base::Bind(&RenderWidgetCompositor::SynchronouslyComposite, |
| 1120 weak_factory_.GetWeakPtr())); | 1121 weak_factory_.GetWeakPtr())); |
| 1121 } | 1122 } |
| 1122 } | 1123 } |
| 1123 | 1124 |
| 1125 void RenderWidgetCompositor::SetScrollBoundaryBehavior( |
| 1126 const WebScrollBoundaryBehavior& behavior) { |
| 1127 layer_tree_host_->SetScrollBoundaryBehavior(behavior); |
| 1128 } |
| 1129 |
| 1124 void RenderWidgetCompositor::WillBeginMainFrame() { | 1130 void RenderWidgetCompositor::WillBeginMainFrame() { |
| 1125 delegate_->WillBeginCompositorFrame(); | 1131 delegate_->WillBeginCompositorFrame(); |
| 1126 } | 1132 } |
| 1127 | 1133 |
| 1128 void RenderWidgetCompositor::DidBeginMainFrame() {} | 1134 void RenderWidgetCompositor::DidBeginMainFrame() {} |
| 1129 | 1135 |
| 1130 void RenderWidgetCompositor::BeginMainFrame(const cc::BeginFrameArgs& args) { | 1136 void RenderWidgetCompositor::BeginMainFrame(const cc::BeginFrameArgs& args) { |
| 1131 compositor_deps_->GetRendererScheduler()->WillBeginFrame(args); | 1137 compositor_deps_->GetRendererScheduler()->WillBeginFrame(args); |
| 1132 double frame_time_sec = (args.frame_time - base::TimeTicks()).InSecondsF(); | 1138 double frame_time_sec = (args.frame_time - base::TimeTicks()).InSecondsF(); |
| 1133 delegate_->BeginMainFrame(frame_time_sec); | 1139 delegate_->BeginMainFrame(frame_time_sec); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1262 void RenderWidgetCompositor::NotifySwapTime(ReportTimeCallback callback) { | 1268 void RenderWidgetCompositor::NotifySwapTime(ReportTimeCallback callback) { |
| 1263 QueueSwapPromise(base::MakeUnique<ReportTimeSwapPromise>( | 1269 QueueSwapPromise(base::MakeUnique<ReportTimeSwapPromise>( |
| 1264 std::move(callback), base::ThreadTaskRunnerHandle::Get())); | 1270 std::move(callback), base::ThreadTaskRunnerHandle::Get())); |
| 1265 } | 1271 } |
| 1266 | 1272 |
| 1267 void RenderWidgetCompositor::RequestBeginMainFrameNotExpected(bool new_state) { | 1273 void RenderWidgetCompositor::RequestBeginMainFrameNotExpected(bool new_state) { |
| 1268 layer_tree_host_->RequestBeginMainFrameNotExpected(new_state); | 1274 layer_tree_host_->RequestBeginMainFrameNotExpected(new_state); |
| 1269 } | 1275 } |
| 1270 | 1276 |
| 1271 } // namespace content | 1277 } // namespace content |
| OLD | NEW |