Commit b0855622 authored by Mason Freed's avatar Mason Freed Committed by Commit Bot

[CI] Adding full lifecycle/raster during autoscroll/animation tests

Previous to this CL, these autoscroll/animation tests passed only because there
is a default surface deadline (typically 4 frames) in place. Surface activation
does not happen automatically, because in layout test mode, rasterization is not
performed until the very end of the test, for image capture. For the tests in
question, that deadline was previously always being hit, causing the surface to
be activated, triggering the monitored scroll events and passing the test.

When the --enable-display-compositor-pixel-dump flag is enabled, however, the
default surface activation deadline is changed to be infinite (no deadline). As
a result, all such autoscroll/animation tests fail.

With this CL, those tests that looked at animation behavior have been modified
to call a new continuouslyRunAnimations() javascript method, which sets a flag
that causes full rasterization to be included in the lifecycle update that was
already taking place. This triggers surface activation, and runs the
animations, allowing these tests to pass even with an infinite deadline.

Bug: 883547, 874162
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I0d9e1ae7d10fab186207cdfbc8e2f85f60d99f35
Reviewed-on: https://chromium-review.googlesource.com/c/1229354
Commit-Queue: Mason Freed <masonfreed@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Reviewed-by: default avatarTimothy Dresser <tdresser@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595898}
parent 5232b51c
......@@ -479,12 +479,9 @@ void LayerTreeView::CompositeAndReadbackAsync(
}
}
void LayerTreeView::SynchronouslyCompositeNoRasterForTesting() {
SynchronouslyComposite(false /* raster */, nullptr /* swap_promise */);
}
void LayerTreeView::CompositeWithRasterForTesting() {
SynchronouslyComposite(true /* raster */, nullptr /* swap_promise */);
void LayerTreeView::UpdateAllLifecyclePhasesAndCompositeForTesting(
bool do_raster) {
SynchronouslyComposite(do_raster, nullptr /* swap_promise */);
}
void LayerTreeView::SynchronouslyComposite(
......
......@@ -137,8 +137,10 @@ class CONTENT_EXPORT LayerTreeView
void LayoutAndPaintAsync(base::OnceClosure callback) override;
void CompositeAndReadbackAsync(
base::OnceCallback<void(const SkBitmap&)> callback) override;
void SynchronouslyCompositeNoRasterForTesting() override;
void CompositeWithRasterForTesting() override;
// Synchronously performs the complete set of document lifecycle phases,
// including updates to the compositor state, optionally including
// rasterization.
void UpdateAllLifecyclePhasesAndCompositeForTesting(bool do_raster) override;
std::unique_ptr<cc::ScopedDeferCommits> DeferCommits() override;
void RegisterViewportLayers(const ViewportLayers& viewport_layers) override;
void ClearViewportLayers() override;
......
......@@ -56,15 +56,9 @@ void LayoutTestRenderFrameObserver::CompositeWithRaster(
CompositeWithRasterCallback callback) {
blink::WebWidget* widget = render_frame()->GetWebFrame()->FrameWidget();
if (widget) {
widget->CompositeWithRasterForTesting();
// TODO(vmpstr): This doesn't embed the popup frame into the browser. We
// likely need to manually readback the pixels here and return them via the
// callback, so that the browser can embed it into the final screenshot. If
// we do this without using WebPagePopup::CompositeWithRasterForTesting(),
// then we can put CompositeWithRasterForTesting() on WebFrameWidgetBase
// instead, and remove the overrides from a bunch of places.
widget->UpdateAllLifecyclePhasesAndCompositeForTesting(/*do_raster=*/true);
if (blink::WebPagePopup* popup = widget->GetPagePopup())
popup->CompositeWithRasterForTesting();
popup->UpdateAllLifecyclePhasesAndCompositeForTesting(/*do_raster=*/true);
}
std::move(callback).Run();
}
......
......@@ -201,6 +201,10 @@ class TestRunnerBindings : public gin::Wrappable<TestRunnerBindings> {
void GetBluetoothManualChooserEvents(v8::Local<v8::Function> callback);
void GetManifestThen(v8::Local<v8::Function> callback);
void InsertStyleSheet(const std::string& source_code);
void UpdateAllLifecyclePhasesAndComposite();
void UpdateAllLifecyclePhasesAndCompositeThen(
v8::Local<v8::Function> callback);
void SetAnimationRequiresRaster(bool do_raster);
void LayoutAndPaintAsync();
void LayoutAndPaintAsyncThen(v8::Local<v8::Function> callback);
void LogToStderr(const std::string& output);
......@@ -488,6 +492,12 @@ gin::ObjectTemplateBuilder TestRunnerBindings::GetObjectTemplateBuilder(
.SetMethod("isChooserShown", &TestRunnerBindings::IsChooserShown)
.SetMethod("isCommandEnabled", &TestRunnerBindings::IsCommandEnabled)
.SetMethod("keepWebHistory", &TestRunnerBindings::NotImplemented)
.SetMethod("updateAllLifecyclePhasesAndComposite",
&TestRunnerBindings::UpdateAllLifecyclePhasesAndComposite)
.SetMethod("updateAllLifecyclePhasesAndCompositeThen",
&TestRunnerBindings::UpdateAllLifecyclePhasesAndCompositeThen)
.SetMethod("setAnimationRequiresRaster",
&TestRunnerBindings::SetAnimationRequiresRaster)
.SetMethod("layoutAndPaintAsync",
&TestRunnerBindings::LayoutAndPaintAsync)
.SetMethod("layoutAndPaintAsyncThen",
......@@ -1343,6 +1353,23 @@ void TestRunnerBindings::RemoveWebPageOverlay() {
view_runner_->RemoveWebPageOverlay();
}
void TestRunnerBindings::UpdateAllLifecyclePhasesAndComposite() {
if (view_runner_)
view_runner_->UpdateAllLifecyclePhasesAndComposite();
}
void TestRunnerBindings::UpdateAllLifecyclePhasesAndCompositeThen(
v8::Local<v8::Function> callback) {
if (view_runner_)
view_runner_->UpdateAllLifecyclePhasesAndCompositeThen(callback);
}
void TestRunnerBindings::SetAnimationRequiresRaster(bool do_raster) {
if (!runner_)
return;
runner_->SetAnimationRequiresRaster(do_raster);
}
void TestRunnerBindings::LayoutAndPaintAsync() {
if (view_runner_)
view_runner_->LayoutAndPaintAsync();
......@@ -1518,6 +1545,7 @@ TestRunner::TestRunner(TestInterfaces* interfaces)
chooser_count_(0),
previously_focused_view_(nullptr),
is_web_platform_tests_mode_(false),
animation_requires_raster_(false),
effective_connection_type_(
blink::WebEffectiveConnectionType::kTypeUnknown),
weak_factory_(this) {}
......@@ -1579,6 +1607,7 @@ void TestRunner::Reset() {
test_repaint_ = false;
sweep_horizontally_ = false;
midi_accessor_result_ = midi::mojom::Result::OK;
animation_requires_raster_ = false;
http_headers_to_clear_.clear();
......@@ -2562,6 +2591,10 @@ void TestRunner::SimulateWebNotificationClose(const std::string& title,
delegate_->SimulateWebNotificationClose(title, by_user);
}
void TestRunner::SetAnimationRequiresRaster(bool do_raster) {
animation_requires_raster_ = do_raster;
}
void TestRunner::OnLayoutTestRuntimeFlagsChanged() {
if (layout_test_runtime_flags_.tracked_dictionary().changed_values().empty())
return;
......
......@@ -136,6 +136,8 @@ class TestRunner : public WebTestRunner {
const base::Optional<std::vector<std::string>>& file_chooser_paths() const {
return file_chooser_paths_;
}
bool animation_requires_raster() const { return animation_requires_raster_; }
void SetAnimationRequiresRaster(bool do_raster);
// To be called when |frame| starts loading - TestRunner will check if
// there is currently no top-loading-frame being tracked and if so, then it
......@@ -593,6 +595,11 @@ class TestRunner : public WebTestRunner {
// True when running a test in LayoutTests/external/wpt/.
bool is_web_platform_tests_mode_;
// True if rasterization should be performed during tests that examine
// fling-style animations. This includes middle-click auto-scroll behaviors.
// This does not include most "ordinary" animations, such as CSS animations.
bool animation_requires_raster_;
// An effective connection type settable by layout tests.
blink::WebEffectiveConnectionType effective_connection_type_;
......
......@@ -193,6 +193,23 @@ base::OnceClosure TestRunnerForSpecificView::CreateClosureThatPostsV8Callback(
blink::MainThreadIsolate(), callback)));
}
void TestRunnerForSpecificView::UpdateAllLifecyclePhasesAndComposite() {
// Note, this is executed synchronously. Wrap in setTimeout() to run
// asynchronously.
blink::WebWidget* widget =
web_view()->MainFrame()->ToWebLocalFrame()->FrameWidget();
widget->UpdateAllLifecyclePhasesAndCompositeForTesting(/* raster = */ true);
}
void TestRunnerForSpecificView::UpdateAllLifecyclePhasesAndCompositeThen(
v8::Local<v8::Function> callback) {
// Note, this is executed synchronously. Wrap in setTimeout() to run
// asynchronously.
TestRunnerForSpecificView::UpdateAllLifecyclePhasesAndComposite();
InvokeV8Callback(
v8::UniquePersistent<v8::Function>(blink::MainThreadIsolate(), callback));
}
void TestRunnerForSpecificView::LayoutAndPaintAsync() {
// TODO(lfg, lukasza): TestRunnerForSpecificView assumes that there's a single
// WebWidget for the entire view, but with out-of-process iframes there may be
......
......@@ -72,6 +72,10 @@ class TestRunnerForSpecificView {
base::OnceClosure CreateClosureThatPostsV8Callback(
const v8::Local<v8::Function>& callback);
void UpdateAllLifecyclePhasesAndComposite();
void UpdateAllLifecyclePhasesAndCompositeThen(
v8::Local<v8::Function> callback);
void LayoutAndPaintAsync();
void LayoutAndPaintAsyncThen(v8::Local<v8::Function> callback);
......
......@@ -49,10 +49,13 @@ void WebWidgetTestClient::AnimateNow() {
return;
animation_scheduled_ = false;
bool animation_requires_raster = test_runner()->animation_requires_raster();
blink::WebWidget* web_widget = web_widget_test_proxy_base_->web_widget();
web_widget->UpdateAllLifecyclePhasesAndCompositeForTesting();
web_widget->UpdateAllLifecyclePhasesAndCompositeForTesting(
animation_requires_raster);
if (blink::WebPagePopup* popup = web_widget->GetPagePopup())
popup->UpdateAllLifecyclePhasesAndCompositeForTesting();
popup->UpdateAllLifecyclePhasesAndCompositeForTesting(
animation_requires_raster);
}
blink::WebScreenInfo WebWidgetTestClient::GetScreenInfo() {
......
......@@ -491,6 +491,18 @@ There is also a library at
[third_party/WebKit/LayoutTests/paint/invalidation/resources/text-based-repaint.js](../../third_party/WebKit/LayoutTests/paint/invalidation/resources/text-based-repaint.js)
to help with writing paint invalidation and repaint tests.
### Tests for scrolling animations
Some layout tests need to ensure animations such as middle-click auto-scroll,
fling, etc. get performed properly. When testing in display compositor pixel
dump mode (now the standard), the standard behavior for tests is to
synchronously composite without rastering (to save time). However, animations
run upon surface activation, which only happens once rasterization is performed.
Therefore, for these tests, an additional setting needs to be set. Near the
beginning of these tests, call `continuouslyRunAnimations()` defined in
[third_party/WebKit/LayoutTests/resources/compositor-controls.js](../../third_party/WebKit/LayoutTests/resources/compositor-controls.js)
which will enable full rasterization during the test.
## Layout tree tests
A layout tree test renders a web page and produces up to two results, which
......
......@@ -9,7 +9,9 @@
</style>
This box should be located in the center of the page.
<div id="target"></div>
<script src="../../resources/compositor-controls.js"></script>
<script>
setAnimationRequiresRaster();
if (window.testRunner) {
testRunner.useUnfortunateSynchronousResizeMode();
testRunner.waitUntilDone();
......
<!DOCTYPE HTML>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/compositor-controls.js"></script>
<style>
body {
margin: 0px;
......@@ -48,6 +49,7 @@
"></iframe>
<script>
setAnimationRequiresRaster();
var scrollable = document.getElementById('scrollable');
function autoScroll(start_x, start_y, end_x, end_y) {
......
<!DOCTYPE HTML>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/compositor-controls.js"></script>
<style>
body {
margin: 0px;
......@@ -24,6 +25,7 @@
</div>
<script>
setAnimationRequiresRaster();
var scrollable = document.getElementById('scrollable');
function autoScroll(start_x, start_y, end_x, end_y) {
return new Promise((resolve, reject) => {
......
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script src="../../resources/compositor-controls.js"></script>
<script>
window.jsTestIsAsync = true;
if (window.testRunner)
......@@ -33,6 +34,7 @@ function runTest()
{
if (!window.eventSender)
return;
setAnimationRequiresRaster();
eventSender.mouseMoveTo(testContainer.offsetLeft + 10, testContainer.offsetTop + 10);
eventSender.mouseDown(MiddleMouseButton);
......
......@@ -9,6 +9,7 @@
}
</style>
<script src="../../resources/js-test.js"></script>
<script src="../../resources/compositor-controls.js"></script>
<script src="./resources/middleClickAutoscroll.js"></script>
<script>
function start()
......
......@@ -9,6 +9,7 @@
}
</style>
<script src="../../resources/js-test.js"></script>
<script src="../../resources/compositor-controls.js"></script>
<script src="./resources/middleClickAutoscroll.js"></script>
<script>
function start()
......
......@@ -9,6 +9,7 @@
}
</style>
<script src="../../resources/js-test.js"></script>
<script src="../../resources/compositor-controls.js"></script>
<script src="./resources/middleClickAutoscroll.js"></script>
<script>
window.addEventListener('mousedown', function(event) {
......
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script src="../../resources/compositor-controls.js"></script>
<script src="./resources/middleClickAutoscroll.js"></script>
<script>
function start() {
......
<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/compositor-controls.js"></script>
<div id = "div" style="overflow: auto; width: 1400px">
<table style="height:2000px; width: 1800px">
<tbody>
......@@ -14,6 +15,7 @@
</table>
</div>
<script>
setAnimationRequiresRaster();
var testBubble = async_test("Tests that middleClickAutoscroll finds the correct ancestor layoutobject when starting in an unscrollable direction.")
testBubble.step(function() {
if (!window.eventSender)
......@@ -26,12 +28,14 @@ testBubble.step(function() {
var endx = startx;
var endy = starty + 100;
var scrolledY = false;
// Middle-mouse drag down, from start to end.
eventSender.mouseMoveTo(startx, starty);
eventSender.mouseDown(1);
eventSender.mouseDown(1 /* WebMouseEvent::Button::kMiddle */);
eventSender.mouseMoveTo(endx, endy);
window.onscroll = function() {
if (!scrolledY) {
// First time we scroll, make sure it is downward.
assert_not_equals(window.scrollY, 0);
scrolledY = true;
// Change the direction of the middle-click-autoscroll to rightward.
......@@ -43,6 +47,8 @@ testBubble.step(function() {
assert_equals(div.scrollLeft, 0);
eventSender.mouseUp(1);
testBubble.done();
// TODO(crbug.com/888571): This call to testIFrame doesn't get hit after
// testBubble.done() gets called.
testIFrame();
}
}
......@@ -74,4 +80,4 @@ testIFrame.step(function() {
};
});
}
</script>
\ No newline at end of file
</script>
......@@ -17,6 +17,7 @@ div {
}
</style>
<script src="../../resources/js-test.js"></script>
<script src="../../resources/compositor-controls.js"></script>
<script src="./resources/middleClickAutoscroll.js"></script>
<script>
function start()
......
......@@ -6,10 +6,11 @@
height:300px;
overflow:auto;
border:2px solid red;
padding:10px";
padding:10px;
}
</style>
<script src="../../resources/js-test.js"></script>
<script src="../../resources/compositor-controls.js"></script>
<script src="./resources/middleClickAutoscroll.js"></script>
<script>
function start()
......
......@@ -11,6 +11,9 @@ function $(id)
function testPanScroll(param)
{
// Make sure animations run. This requires compositor-controls.js.
setAnimationRequiresRaster();
function finishTest()
{
if ($('container'))
......@@ -36,23 +39,19 @@ function testPanScroll(param)
}
}
var noModeScroll = false;
var scrolled = false;
var scrollStarted = false;
var scrollEnded = false;
scrolledObject.onscroll = function() {
if (noModeScroll) {
testFailed('still autoscroll');
finishTest();
return;
}
if (scrolled)
if (scrollStarted)
return;
scrolled = true;
scrollStarted = true;
scrollEnded = false;
testPassed('autoscroll started');
var cursorInfo = internals.getCurrentCursorInfo();
debug("Mouse cursor shape: " + cursorInfo);
// Stop scrolling now
if (window.eventSender) {
if (param.clickOrDrag == 'click')
eventSender.mouseDown(middleButton);
......@@ -61,18 +60,28 @@ function testPanScroll(param)
};
scrollable.ownerDocument.onmouseup = function(e) {
if (!scrolled || e.button != middleButton)
// If we haven't started scrolling yet, do nothing.
if (!scrollStarted || e.button != middleButton)
return;
noMoreScroll = true;
// Wait a while, then set scrollEnded to true
window.setTimeout(function() {
testPassed('autoscroll stopped');
var cursorInfo = internals.getCurrentCursorInfo();
if (cursorInfo == "type=Pointer hotSpot=0,0" || cursorInfo == "type=IBeam hotSpot=0,0")
testPassed('Mouse cursor cleared');
else
testFailed('Mouse cursor shape: ' + cursorInfo);
scrollEnded = true;
// Wait a bit more and make sure it's still true (we didn't keep
// scrolling).
window.setTimeout(function() {
if (scrollEnded) {
testPassed('autoscroll stopped');
} else {
testFailed('autoscroll still scrolling');
}
var cursorInfo = internals.getCurrentCursorInfo();
if (cursorInfo == "type=Pointer hotSpot=0,0" || cursorInfo == "type=IBeam hotSpot=0,0")
testPassed('Mouse cursor cleared');
else
testFailed('Mouse cursor shape: ' + cursorInfo);
finishTest();
finishTest();
}, autoscrollInterval * 2);
}, autoscrollInterval * 2);
};
......
<!DOCTYPE html>
<script src="../../../../resources/testharness.js"></script>
<script src="../../../../resources/testharnessreport.js"></script>
<script src="../../../../resources/compositor-controls.js"></script>
<script src="../../../../resources/gesture-util.js"></script>
<!-- This tests that the scrollbar thumb is deselected on a fling start -->
......@@ -44,6 +45,7 @@
</div>
<script type="text/javascript">
setAnimationRequiresRaster();
internals.settings.setMockScrollbarsEnabled(true);
promise_test (async () => {
......
<!DOCTYPE html>
<script src="../../../../resources/testharness.js"></script>
<script src="../../../../resources/testharnessreport.js"></script>
<script src="../../../../resources/compositor-controls.js"></script>
<script src="../../../../resources/gesture-util.js"></script>
<!-- This tests that the scrollbar thumb is deselected on a fling start -->
......@@ -44,6 +45,7 @@
</div>
<script type="text/javascript">
setAnimationRequiresRaster();
internals.settings.setMockScrollbarsEnabled(true);
promise_test (async () => {
......
<!DOCTYPE html>
<script src="../../../../resources/testharness.js"></script>
<script src="../../../../resources/testharnessreport.js"></script>
<script src="../../../../resources/compositor-controls.js"></script>
<script src="../../../../resources/gesture-util.js"></script>
<body style="margin:0">
<div id="container" style="width: 500px; height: 200px; overflow-y: scroll; overflow-x: scroll">
......@@ -12,6 +13,7 @@
</body>
<script type="text/javascript">
setAnimationRequiresRaster();
var gestureX = 100;
var gestureY = 50;
var box = document.getElementById("box");
......@@ -21,7 +23,7 @@ var fullyScrolled;
function calculateFullScroll() {
fullyScrolled = box.scrollWidth - box.clientWidth;
// FIXME: Mac has a quirk where the text box text can actually be scrolled a little bit
// FIXME: Mac has a quirk where the text box text can actually be scrolled a little bit
// past the end. That is, scrollLeft = (scrollWidth - clientWidth) + 2 on Mac. Once
// this is fixed we can remove this adjustment.
box.scrollLeft = 100000;
......
......@@ -9,8 +9,8 @@ if (window.testRunner) {
window.onload = function() {
if (!window.testRunner)
return;
// Force a pixel dump to cover raterization issues if any.
testRunner.capturePixelsAsyncThen(function() {
// Force a full lifecycle update to cover rasterization issues if any.
testRunner.updateAllLifecyclePhasesAndCompositeThen(function() {
testRunner.notifyDone();
});
};
......
......@@ -27,7 +27,7 @@ function test() {
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.capturePixelsAsyncThen(test);
testRunner.updateAllLifecyclePhasesAndCompositeThen(test);
} else {
setTimeout(test, 500);
}
......
......@@ -10,7 +10,7 @@ function repaintTest()
{
if (window.testRunner) {
// This ensures finish of image decoding before running the test.
testRunner.capturePixelsAsyncThen(doTest);
testRunner.updateAllLifecyclePhasesAndCompositeThen(doTest);
} else {
doTest();
}
......
......@@ -72,7 +72,7 @@
return;
// Ensure the deferred decoder has decoded ../resources/apple.jpg.
testRunner.capturePixelsAsyncThen(function() {
testRunner.updateAllLifecyclePhasesAndCompositeThen(function() {
internals.advanceImageAnimation(imgForAdvanceImageAnimation);
testRunner.layoutAndPaintAsyncThen(function() {
internals.startTrackingRepaints(document);
......
......@@ -19,9 +19,9 @@ if (!window.testRunner) {
testRunner.setPrinting();
testRunner.waitUntilDone();
testRunner.capturePixelsAsyncThen(function() {
testRunner.clearPrinting();
testPassed("Printed without crashing.");
testRunner.notifyDone();
testRunner.clearPrinting();
testPassed("Printed without crashing.");
testRunner.notifyDone();
});
}
</script>
......
// To make sure animation events get processed, periodic lifecycle phase runs
// will include rasterization. See
// https://chromium.googlesource.com/chromium/src/+/master/docs/testing/writing_layout_tests.md
// for more information.
function setAnimationRequiresRaster() {
if (window.testRunner) {
testRunner.setAnimationRequiresRaster(true);
}
}
function updateAllLifecyclePhasesAndCompositeAsyncThen(callback) {
setTimeout(function() {
if (!window.testRunner) {
callback();
} else {
testRunner.updateAllLifecyclePhasesAndCompositeThen(callback);
}
},0);
}
function waitForCompositorCommit() {
return new Promise((resolve) => {
// For now, we just rAF twice. It would be nice to have a proper mechanism
// for this.
window.requestAnimationFrame(() => {
window.requestAnimationFrame(resolve);
});
if (window.testRunner) {
testRunner.capturePixelsAsyncThen(resolve);
} else {
// Fall back to just rAF twice.
window.requestAnimationFrame(() => {
window.requestAnimationFrame(resolve);
});
}
});
}
......
......@@ -152,13 +152,10 @@ class WebLayerTreeView {
virtual void CompositeAndReadbackAsync(
base::OnceCallback<void(const SkBitmap&)> callback) {}
// Synchronously run all lifecycle phases and compositor update with no
// raster. Should only be called by layout tests running in synchronous
// single-threaded mode.
virtual void SynchronouslyCompositeNoRasterForTesting() {}
// Synchronously rasterizes and composites a frame.
virtual void CompositeWithRasterForTesting() {}
// Synchronously performs the complete set of document lifecycle phases,
// including updates to the compositor state, optionally including
// rasterization.
virtual void UpdateAllLifecyclePhasesAndCompositeForTesting(bool do_raster) {}
// Prevents updates to layer tree from becoming visible.
virtual std::unique_ptr<cc::ScopedDeferCommits> DeferCommits() {
......
......@@ -103,12 +103,10 @@ class WebWidget {
virtual void UpdateLifecycle(
LifecycleUpdate requested_update = LifecycleUpdate::kAll) {}
// Performs the complete set of document lifecycle phases, including updates
// to the compositor state except rasterization.
virtual void UpdateAllLifecyclePhasesAndCompositeForTesting() {}
// Synchronously rasterizes and composites a frame.
virtual void CompositeWithRasterForTesting() {}
// Synchronously performs the complete set of document lifecycle phases,
// including updates to the compositor state, optionally including
// rasterization.
virtual void UpdateAllLifecyclePhasesAndCompositeForTesting(bool do_raster) {}
// Called to paint the rectangular region within the WebWidget
// onto the specified canvas at (viewPort.x,viewPort.y).
......
......@@ -411,14 +411,11 @@ void WebPagePopupImpl::UpdateLifecycle(LifecycleUpdate requested_update) {
*page_, *page_->DeprecatedLocalMainFrame(), requested_update);
}
void WebPagePopupImpl::UpdateAllLifecyclePhasesAndCompositeForTesting() {
if (layer_tree_view_)
layer_tree_view_->SynchronouslyCompositeNoRasterForTesting();
}
void WebPagePopupImpl::CompositeWithRasterForTesting() {
if (layer_tree_view_)
layer_tree_view_->CompositeWithRasterForTesting();
void WebPagePopupImpl::UpdateAllLifecyclePhasesAndCompositeForTesting(
bool do_raster) {
if (layer_tree_view_) {
layer_tree_view_->UpdateAllLifecyclePhasesAndCompositeForTesting(do_raster);
}
}
void WebPagePopupImpl::PaintContent(cc::PaintCanvas* canvas,
......
......@@ -85,8 +85,7 @@ class CORE_EXPORT WebPagePopupImpl final : public WebPagePopup,
void SetSuppressFrameRequestsWorkaroundFor704763Only(bool) final;
void BeginFrame(base::TimeTicks last_frame_time) override;
void UpdateLifecycle(LifecycleUpdate requested_update) override;
void UpdateAllLifecyclePhasesAndCompositeForTesting() override;
void CompositeWithRasterForTesting() override;
void UpdateAllLifecyclePhasesAndCompositeForTesting(bool do_raster) override;
void WillCloseLayerTreeView() override;
void PaintContent(cc::PaintCanvas*, const WebRect&) override;
void Resize(const WebSize&) override;
......
......@@ -1623,14 +1623,11 @@ void WebViewImpl::UpdateLifecycle(LifecycleUpdate requested_update) {
}
}
void WebViewImpl::UpdateAllLifecyclePhasesAndCompositeForTesting() {
if (layer_tree_view_)
layer_tree_view_->SynchronouslyCompositeNoRasterForTesting();
}
void WebViewImpl::CompositeWithRasterForTesting() {
// This should not be called directly on WebViewImpl.
NOTREACHED();
void WebViewImpl::UpdateAllLifecyclePhasesAndCompositeForTesting(
bool do_raster) {
if (layer_tree_view_) {
layer_tree_view_->UpdateAllLifecyclePhasesAndCompositeForTesting(do_raster);
}
}
void WebViewImpl::PaintContent(cc::PaintCanvas* canvas, const WebRect& rect) {
......
......@@ -119,8 +119,7 @@ class CORE_EXPORT WebViewImpl final : public WebView,
void RecordEndOfFrameMetrics(base::TimeTicks frame_begin_time) override;
void UpdateLifecycle(LifecycleUpdate requested_update) override;
void UpdateAllLifecyclePhasesAndCompositeForTesting() override;
void CompositeWithRasterForTesting() override;
void UpdateAllLifecyclePhasesAndCompositeForTesting(bool do_raster) override;
void PaintContent(cc::PaintCanvas*, const WebRect&) override;
void PaintContentIgnoringCompositing(cc::PaintCanvas*,
const WebRect&) override;
......
......@@ -67,6 +67,13 @@ WebLocalFrame* WebFrameWidgetBase::LocalRoot() const {
return local_root_;
}
void WebFrameWidgetBase::UpdateAllLifecyclePhasesAndCompositeForTesting(
bool do_raster) {
if (WebLayerTreeView* layer_tree_view = GetLayerTreeView()) {
layer_tree_view->UpdateAllLifecyclePhasesAndCompositeForTesting(do_raster);
}
}
WebDragOperation WebFrameWidgetBase::DragTargetDragEnter(
const WebDragData& web_drag_data,
const WebFloatPoint& point_in_viewport,
......@@ -187,11 +194,6 @@ void WebFrameWidgetBase::DragSourceSystemDragEnded() {
CancelDrag();
}
void WebFrameWidgetBase::CompositeWithRasterForTesting() {
if (auto* layer_tree_view = GetLayerTreeView())
layer_tree_view->CompositeWithRasterForTesting();
}
void WebFrameWidgetBase::CancelDrag() {
// It's possible for us this to be callback while we're not doing a drag if
// it's from a previous page that got unloaded.
......
......@@ -71,6 +71,7 @@ class CORE_EXPORT WebFrameWidgetBase
// WebFrameWidget implementation.
void Close() override;
WebLocalFrame* LocalRoot() const override;
void UpdateAllLifecyclePhasesAndCompositeForTesting(bool do_raster) override;
WebDragOperation DragTargetDragEnter(const WebDragData&,
const WebFloatPoint& point_in_viewport,
const WebFloatPoint& screen_point,
......@@ -90,7 +91,6 @@ class CORE_EXPORT WebFrameWidgetBase
const WebFloatPoint& screen_point,
WebDragOperation) override;
void DragSourceSystemDragEnded() override;
void CompositeWithRasterForTesting() override;
WebLocalFrame* FocusedWebLocalFrameInWidget() const override;
......
......@@ -315,11 +315,6 @@ void WebFrameWidgetImpl::UpdateLifecycle(LifecycleUpdate requested_update) {
UpdateLayerTreeBackgroundColor();
}
void WebFrameWidgetImpl::UpdateAllLifecyclePhasesAndCompositeForTesting() {
if (layer_tree_view_)
layer_tree_view_->SynchronouslyCompositeNoRasterForTesting();
}
void WebFrameWidgetImpl::PaintContent(cc::PaintCanvas* canvas,
const WebRect& rect) {
// Out-of-process iframes require compositing.
......
......@@ -84,7 +84,6 @@ class WebFrameWidgetImpl final : public WebFrameWidgetBase,
void SetSuppressFrameRequestsWorkaroundFor704763Only(bool) final;
void BeginFrame(base::TimeTicks last_frame_time) override;
void UpdateLifecycle(LifecycleUpdate requested_update) override;
void UpdateAllLifecyclePhasesAndCompositeForTesting() override;
void PaintContent(cc::PaintCanvas*, const WebRect&) override;
void LayoutAndPaintAsync(base::OnceClosure callback) override;
void CompositeAndReadbackAsync(
......
......@@ -71,10 +71,6 @@ void WebViewFrameWidget::UpdateLifecycle(LifecycleUpdate requested_update) {
web_view_->UpdateLifecycle(requested_update);
}
void WebViewFrameWidget::UpdateAllLifecyclePhasesAndCompositeForTesting() {
web_view_->UpdateAllLifecyclePhasesAndCompositeForTesting();
}
void WebViewFrameWidget::PaintContent(cc::PaintCanvas* canvas,
const WebRect& view_port) {
web_view_->PaintContent(canvas, view_port);
......
......@@ -50,7 +50,6 @@ class CORE_EXPORT WebViewFrameWidget : public WebFrameWidgetBase {
void BeginFrame(base::TimeTicks last_frame_time) override;
void RecordEndOfFrameMetrics(base::TimeTicks frame_begin_time) override;
void UpdateLifecycle(LifecycleUpdate requested_update) override;
void UpdateAllLifecyclePhasesAndCompositeForTesting() override;
void PaintContent(cc::PaintCanvas*, const WebRect& view_port) override;
void LayoutAndPaintAsync(base::OnceClosure callback) override;
void CompositeAndReadbackAsync(
......
......@@ -322,26 +322,31 @@ void LatencyTracker::ComputeEndToEndLatencyHistograms(
}
base::TimeTicks renderer_swap_timestamp;
bool found_component =
bool found_renderer_swap_component =
latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT,
&renderer_swap_timestamp);
DCHECK_AND_RETURN_ON_FAIL(found_component);
UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2(
"Event.Latency." + scroll_name + "." + input_modality +
".HandledToRendererSwap2_" + thread_name,
rendering_scheduled_timestamp, renderer_swap_timestamp);
base::TimeTicks browser_received_swap_timestamp;
found_component =
bool found_received_frame_component =
latency.FindLatency(ui::DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT,
&browser_received_swap_timestamp);
DCHECK_AND_RETURN_ON_FAIL(found_component);
DCHECK_AND_RETURN_ON_FAIL(found_received_frame_component);
UMA_HISTOGRAM_SCROLL_LATENCY_SHORT_2(
"Event.Latency." + scroll_name + "." + input_modality +
".RendererSwapToBrowserNotified2",
renderer_swap_timestamp, browser_received_swap_timestamp);
// If we're committing to the active tree, there will never be a renderer
// swap. In this case, don't record the two histogram values for the periods
// surrounding the renderer swap. We could assign the total time to one or the
// other of them, but that would likely skew statistics.
if (found_renderer_swap_component) {
UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2(
"Event.Latency." + scroll_name + "." + input_modality +
".HandledToRendererSwap2_" + thread_name,
rendering_scheduled_timestamp, renderer_swap_timestamp);
UMA_HISTOGRAM_SCROLL_LATENCY_SHORT_2(
"Event.Latency." + scroll_name + "." + input_modality +
".RendererSwapToBrowserNotified2",
renderer_swap_timestamp, browser_received_swap_timestamp);
}
UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2(
"Event.Latency." + scroll_name + "." + input_modality +
......
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