Skip to content

Commit

Permalink
Add base::feature that injects 1ms latency to drawAndSwap
Browse files Browse the repository at this point in the history
Bug: 1494868
Change-Id: I14dd10dd627f661ca34b2f14ba887a96049754ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5016468
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1222961}
  • Loading branch information
Jonathan Johnson authored and Chromium LUCI CQ committed Nov 10, 2023
1 parent de3727f commit 2227e65
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions android_webview/browser/gfx/hardware_renderer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ namespace {
BASE_FEATURE(kWebViewUseOutputSurfaceClipRect,
"WebViewUseOutputSurfaceClipRect",
base::FEATURE_ENABLED_BY_DEFAULT);
BASE_FEATURE(kDrawAndSwapInjectLatency,
"DrawAndSwapInjectLatency",
base::FEATURE_DISABLED_BY_DEFAULT);

class ScopedAcquireExternalContext {
public:
Expand Down Expand Up @@ -633,6 +636,10 @@ void HardwareRenderer::DrawAndSwap(const HardwareRendererDrawParams& params,

DCHECK_CALLED_ON_VALID_THREAD(render_thread_checker_);

if (base::FeatureList::IsEnabled(kDrawAndSwapInjectLatency)) {
usleep(1000);
}

// Ensure that the context is synced from external and synced back before
// returning. This is only necessary when using ANGLE to keep its internals
// synced with the external context
Expand Down

0 comments on commit 2227e65

Please sign in to comment.