Fixing flakiness of TextureLayerChangeInvisibleMailboxTest

Desktop / Chromium - samans [chromium.org] - 19 April 2017 12:50 EDT

The flake seems to be because of a race between the order of running main and impl thread. Resources are always reclaimed after impl threads posts DidCommitAndDrawFrame to the main thread so whether commit_count_ == 4 or 5 depends on whether we switch to main thread or keep running impl thread and reclaim resources which triggers posting a task to the main thread to release the mailbox. Even though the task for DidCommitAndDrawFrame is posted first, the task for releasing mailbox is posted using a blocking task runner so it is run first. In order to solve this issue, we decided to use DidReceiveCompositorFrameAck instead of DidCommitAndDrawFrame because all the resources are released before DidReceiveCompositorFrameAck is called so the race between releasing resources and starting next commit doesn't happen. In single-thread mode we used to call DidReceiveCompositorFrameAck directly instead of PostTasking which caused different behaviour from multi-thread mode. We decided to also use PostTask for DidReceiveCompositorFrameAck in single thread mode and use weak pointers to discard the ack if CompositorFrameSink is released before ack is processed.

CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel BUG=702868

Review-Url: https://codereview.chromium.org/2757373002 Cr-Commit-Position: refs/heads/master@{#465638}

44b6dfc Fixing flakiness of TextureLayerChangeInvisibleMailboxTest
cc/layers/texture_layer_unittest.cc | 17 ++------
cc/test/layer_tree_test.cc | 6 +++
cc/test/test_hooks.h | 4 ++
cc/trees/layer_tree_host_unittest.cc | 81 ++++++++++++++++++++++++++++++++++++
cc/trees/proxy_impl.cc | 7 +++-
cc/trees/proxy_impl.h | 7 +++-
cc/trees/proxy_main.cc | 9 ++--
cc/trees/proxy_main.h | 4 ++
cc/trees/single_thread_proxy.cc | 14 ++++++-
cc/trees/single_thread_proxy.h | 8 ++++
10 files changed, 137 insertions(+), 20 deletions(-)

Upstream: git.chromium.org


  • Share