0

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: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821459}
This commit is contained in:
Dave Tapuska
2020-10-27 21:55:08 +00:00
committed by Commit Bot
parent 8e146ee71c
commit a858ebf1ba
5 changed files with 18 additions and 29 deletions

@ -184,11 +184,6 @@ void RenderWidget::SetPendingWindowRect(const gfx::Rect& rect) {
GetWebWidget()->SetPendingWindowRect(rect);
}
void RenderWidget::RequestPresentation(PresentationTimeCallback callback) {
layer_tree_host_->RequestPresentationTimeForNextFrame(std::move(callback));
layer_tree_host_->SetNeedsCommitWithForcedRedraw();
}
void RenderWidget::ScheduleAnimation() {
// 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

@ -63,10 +63,6 @@ class WebFrameWidget;
class WebPagePopup;
} // namespace blink
namespace gfx {
struct PresentationFeedback;
} // namespace gfx
namespace content {
class AgentSchedulingGroup;
class CompositorDependencies;
@ -205,12 +201,6 @@ class CONTENT_EXPORT RenderWidget
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:
// Destroy the RenderWidget. The |widget| is the owning pointer of |this|.
virtual void Close(std::unique_ptr<RenderWidget> widget);

@ -1829,22 +1829,17 @@ void TestRunnerBindings::RemoveWebPageOverlay() {
void TestRunnerBindings::UpdateAllLifecyclePhasesAndComposite() {
if (invalid_)
return;
frame_->GetLocalRootRenderWidget()->RequestPresentation(base::DoNothing());
}
static void UpdateAllLifecyclePhasesAndCompositeThenReply(
base::OnceClosure callback,
const gfx::PresentationFeedback& feedback) {
std::move(callback).Run();
static_cast<WebWidgetTestProxy*>(frame_->GetLocalRootRenderWidget())
->UpdateAllLifecyclePhasesAndComposite(base::DoNothing());
}
void TestRunnerBindings::UpdateAllLifecyclePhasesAndCompositeThen(
v8::Local<v8::Function> v8_callback) {
if (invalid_)
return;
frame_->GetLocalRootRenderWidget()->RequestPresentation(
base::BindOnce(&UpdateAllLifecyclePhasesAndCompositeThenReply,
WrapV8Closure(std::move(v8_callback))));
static_cast<WebWidgetTestProxy*>(frame_->GetLocalRootRenderWidget())
->UpdateAllLifecyclePhasesAndComposite(
WrapV8Closure(std::move(v8_callback)));
}
void TestRunnerBindings::SetAnimationRequiresRaster(bool do_raster) {

@ -47,9 +47,14 @@ void WebWidgetTestProxy::ScheduleAnimationForWebTests() {
ScheduleAnimationInternal(/*do_raster=*/true);
}
void WebWidgetTestProxy::RequestPresentation(
PresentationTimeCallback callback) {
RenderWidget::RequestPresentation(std::move(callback));
void WebWidgetTestProxy::UpdateAllLifecyclePhasesAndComposite(
base::OnceClosure 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();
}

@ -56,7 +56,6 @@ class WebWidgetTestProxy : public RenderWidget {
// RenderWidget overrides.
void WillBeginMainFrame() override;
void RequestPresentation(PresentationTimeCallback callback) override;
// WebWidgetClient implementation.
void ScheduleAnimation() override;
@ -80,6 +79,11 @@ class WebWidgetTestProxy : public RenderWidget {
void Reset();
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
// 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