• Dirk Pranke's avatar
    Revert "Synthetic input waits on compositor display" · 716496fe
    Dirk Pranke authored
    This reverts commit 258ed8d5.
    
    Reason for revert: Suspect this introduced memory leaks and broke https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/WebKit%20Linux%20Trusty%20Leak/30388
    
    Original change's description:
    > Synthetic input waits on compositor display
    > 
    > This CL makes synthetic input - the kind used in web tests and
    > telemetry (e.g. gpuBenchmarking.scrollBy) - wait until a CompositorFrame
    > has been submitted by the renderer and displayed by the display
    > compositor before resolving the completion callback. This means client
    > code that wants to wait until any observable side-effects of this input
    > is visible to further input need only wait on the gesture's completion
    > callback.
    > 
    > To give a motivating example: suppose we wish to write a test that
    > scrolls an out-of-process iframe into view and clicks on a button in the
    > frame. The code might look something like this:
    > 
    > gpuBenchmarking.smoothScroll(1000, () => {
    >   gpuBenchmarking.tap(0, 0);
    > });
    > 
    > This code contains a race today. The callback for smoothScroll is
    > invoked as soon as the ScrollEnd is received in the renderer. However,
    > until a new compositor frame is submitted from the renderer, the tap
    > may occur against stale hit testing geometry. This is a major source of
    > flakiness in our tests.
    > 
    > This CL fixes the problem by forcing the renderer to perform a full
    > redraw at the end of each gesture. The redraw produces a compositor
    > frame and we invoke the callback once the compositor frame is displayed.
    > We do this by reusing the RequestPresentation mechanism in RenderWidget.
    > RequestPresentation required two modifications to work in web tests
    > which use a single thread proxy with no scheduler:
    > 
    >  - LayerTreeHost::Composite needs to check the forced redraw flag to
    >    determine whether we need to raster, otherwise it won't produce a
    >    frame
    >  - RequestPresentation must request a main frame since there's no
    >    scheduler to perform the commit, which is what SetNeedsForcedRedraw
    >    requests.
    > 
    > The timing change exposed an issue in the
    > overlay-play-button-tap-to-hide.html test so this CL also cleans that
    > test up to listen to the animation changes in media controls properly.
    > 
    > Finally, it's possible we may get input in a RenderWidget that's not
    > currently displayed. e.g. A click event sent via ChromeDriver causes a
    > TouchStart followed by a TouchEnd. The TouchStart causes a window.open
    > which opens and focuses a new tab. The TouchEnd then happens on the
    > background tab. In this case, we should resolve the callback rather than
    > waiting on a CompositorFrame that'll never come. See ChromeDriver test
    > testNetworkConnectionTypeIsAppliedToAllTabs for an example of this.
    > 
    > Bug: 902446
    > Change-Id: Ib2dddee08400dfa1137c674c47c0d7106961162f
    > Reviewed-on: https://chromium-review.googlesource.com/c/1390329
    > Reviewed-by: Saman Sami <samans@chromium.org>
    > Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
    > Reviewed-by: Navid Zolghadr <nzolghadr@chromium.org>
    > Commit-Queue: David Bokan <bokan@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#633753}
    
    TBR=danakj@chromium.org,bokan@chromium.org,dtapuska@chromium.org,nzolghadr@chromium.org,samans@chromium.org
    
    Change-Id: I7a479a4af8fbec4b4452ff6d9d7b5b9df246f4a4
    No-Presubmit: true
    No-Tree-Checks: true
    No-Try: true
    Bug: 902446
    Reviewed-on: https://chromium-review.googlesource.com/c/1479370Reviewed-by: default avatarDirk Pranke <dpranke@chromium.org>
    Commit-Queue: Dirk Pranke <dpranke@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#633782}
    716496fe
widget_input_handler_impl.cc 7.5 KB