Commit a858ebf1 authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Move RequestPresentation into WebWidgetTestProxy

In anticipation of the RenderWidget removal, move RequestPresentation
into WebWidgetTestProxy and rename it to match the bindings name.

BUG=1097816

Change-Id: I1fa060ee6d3c788bb519830ae61a0e01bebcb859
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2499741
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821459}
parent 8e146ee7
...@@ -184,11 +184,6 @@ void RenderWidget::SetPendingWindowRect(const gfx::Rect& rect) { ...@@ -184,11 +184,6 @@ void RenderWidget::SetPendingWindowRect(const gfx::Rect& rect) {
GetWebWidget()->SetPendingWindowRect(rect); GetWebWidget()->SetPendingWindowRect(rect);
} }
void RenderWidget::RequestPresentation(PresentationTimeCallback callback) {
layer_tree_host_->RequestPresentationTimeForNextFrame(std::move(callback));
layer_tree_host_->SetNeedsCommitWithForcedRedraw();
}
void RenderWidget::ScheduleAnimation() { void RenderWidget::ScheduleAnimation() {
// This call is not needed in single thread mode for tests without a // This call is not needed in single thread mode for tests without a
// scheduler, but they override this method in order to schedule a synchronous // scheduler, but they override this method in order to schedule a synchronous
......
...@@ -63,10 +63,6 @@ class WebFrameWidget; ...@@ -63,10 +63,6 @@ class WebFrameWidget;
class WebPagePopup; class WebPagePopup;
} // namespace blink } // namespace blink
namespace gfx {
struct PresentationFeedback;
} // namespace gfx
namespace content { namespace content {
class AgentSchedulingGroup; class AgentSchedulingGroup;
class CompositorDependencies; class CompositorDependencies;
...@@ -205,12 +201,6 @@ class CONTENT_EXPORT RenderWidget ...@@ -205,12 +201,6 @@ class CONTENT_EXPORT RenderWidget
void DidNavigate(ukm::SourceId source_id, const GURL& url); void DidNavigate(ukm::SourceId source_id, const GURL& url);
// Forces a redraw and invokes the callback once the frame's been displayed
// to the user in the display compositor.
using PresentationTimeCallback =
base::OnceCallback<void(const gfx::PresentationFeedback&)>;
virtual void RequestPresentation(PresentationTimeCallback callback);
protected: protected:
// Destroy the RenderWidget. The |widget| is the owning pointer of |this|. // Destroy the RenderWidget. The |widget| is the owning pointer of |this|.
virtual void Close(std::unique_ptr<RenderWidget> widget); virtual void Close(std::unique_ptr<RenderWidget> widget);
......
...@@ -1829,22 +1829,17 @@ void TestRunnerBindings::RemoveWebPageOverlay() { ...@@ -1829,22 +1829,17 @@ void TestRunnerBindings::RemoveWebPageOverlay() {
void TestRunnerBindings::UpdateAllLifecyclePhasesAndComposite() { void TestRunnerBindings::UpdateAllLifecyclePhasesAndComposite() {
if (invalid_) if (invalid_)
return; return;
frame_->GetLocalRootRenderWidget()->RequestPresentation(base::DoNothing()); static_cast<WebWidgetTestProxy*>(frame_->GetLocalRootRenderWidget())
} ->UpdateAllLifecyclePhasesAndComposite(base::DoNothing());
static void UpdateAllLifecyclePhasesAndCompositeThenReply(
base::OnceClosure callback,
const gfx::PresentationFeedback& feedback) {
std::move(callback).Run();
} }
void TestRunnerBindings::UpdateAllLifecyclePhasesAndCompositeThen( void TestRunnerBindings::UpdateAllLifecyclePhasesAndCompositeThen(
v8::Local<v8::Function> v8_callback) { v8::Local<v8::Function> v8_callback) {
if (invalid_) if (invalid_)
return; return;
frame_->GetLocalRootRenderWidget()->RequestPresentation( static_cast<WebWidgetTestProxy*>(frame_->GetLocalRootRenderWidget())
base::BindOnce(&UpdateAllLifecyclePhasesAndCompositeThenReply, ->UpdateAllLifecyclePhasesAndComposite(
WrapV8Closure(std::move(v8_callback)))); WrapV8Closure(std::move(v8_callback)));
} }
void TestRunnerBindings::SetAnimationRequiresRaster(bool do_raster) { void TestRunnerBindings::SetAnimationRequiresRaster(bool do_raster) {
......
...@@ -47,9 +47,14 @@ void WebWidgetTestProxy::ScheduleAnimationForWebTests() { ...@@ -47,9 +47,14 @@ void WebWidgetTestProxy::ScheduleAnimationForWebTests() {
ScheduleAnimationInternal(/*do_raster=*/true); ScheduleAnimationInternal(/*do_raster=*/true);
} }
void WebWidgetTestProxy::RequestPresentation( void WebWidgetTestProxy::UpdateAllLifecyclePhasesAndComposite(
PresentationTimeCallback callback) { base::OnceClosure callback) {
RenderWidget::RequestPresentation(std::move(callback)); layer_tree_host()->RequestPresentationTimeForNextFrame(base::BindOnce(
[](base::OnceClosure callback, const gfx::PresentationFeedback&) {
std::move(callback).Run();
},
std::move(callback)));
layer_tree_host()->SetNeedsCommitWithForcedRedraw();
ScheduleAnimationForWebTests(); ScheduleAnimationForWebTests();
} }
......
...@@ -56,7 +56,6 @@ class WebWidgetTestProxy : public RenderWidget { ...@@ -56,7 +56,6 @@ class WebWidgetTestProxy : public RenderWidget {
// RenderWidget overrides. // RenderWidget overrides.
void WillBeginMainFrame() override; void WillBeginMainFrame() override;
void RequestPresentation(PresentationTimeCallback callback) override;
// WebWidgetClient implementation. // WebWidgetClient implementation.
void ScheduleAnimation() override; void ScheduleAnimation() override;
...@@ -80,6 +79,11 @@ class WebWidgetTestProxy : public RenderWidget { ...@@ -80,6 +79,11 @@ class WebWidgetTestProxy : public RenderWidget {
void Reset(); void Reset();
void Install(blink::WebLocalFrame* frame); void Install(blink::WebLocalFrame* frame);
// Forces a redraw and invokes the callback once the frame's been displayed
// to the user in the display compositor.
void UpdateAllLifecyclePhasesAndComposite(
base::OnceClosure completion_callback);
// Called to composite when the test has ended, in order to ensure the test // Called to composite when the test has ended, in order to ensure the test
// produces up-to-date pixel output. This is a separate path as most // produces up-to-date pixel output. This is a separate path as most
// compositing paths stop running when the test ends, to avoid tests running // compositing paths stop running when the test ends, to avoid tests running
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment