Commit 9eed7b76 authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

MacViews: Push VSync parameters from RHWVMac to BridgedNativeView

This is not an appropriate long-term solution, but is a solution that
has a minimal diff and can be merged fairly easily.

The appropriate fix is to:
- make BridgedNativeView have a DisplayLink
- update that DisplayLink when the NSWindow is moved between monitors
- ensure that the VSync parameters are updated "reasonably frequently"
  to avoid skew
  - RWHVMac will poke the DisplayLink every time the renderer displays
    a new frame
  - at each poke, the DisplayLink will update its parameters if it has
    not done so in the last 10 seconds
  - this scheme will need to be revisited both for BridgedNativeView
    (because it rarely gets new frames compared to the renderer) and
    for OOP-D (because RWHVMac will no longer be informed of frames)

Such a fix is a bigger undertaking than should be merged to a branch,
so just push the VSync parameters from RWHVMac (that we would ordinarly
send to the web-contents-only ui::Compositor) to the parent ui::Layer's
compositor instead.

This will only "fix" windows that have web contents in them (which is
almost everything that will have an animation).

Bug: 869129
Change-Id: Ie5949798aa4d1f42e73197326bca5e6e574f0843
Reviewed-on: https://chromium-review.googlesource.com/1157027Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Commit-Queue: ccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579712}
parent 8b125381
...@@ -197,10 +197,19 @@ void BrowserCompositorMac::SynchronizeVisualProperties( ...@@ -197,10 +197,19 @@ void BrowserCompositorMac::SynchronizeVisualProperties(
void BrowserCompositorMac::UpdateVSyncParameters( void BrowserCompositorMac::UpdateVSyncParameters(
const base::TimeTicks& timebase, const base::TimeTicks& timebase,
const base::TimeDelta& interval) { const base::TimeDelta& interval) {
if (recyclable_compositor_) { ui::Compositor* compositor = nullptr;
recyclable_compositor_->compositor()->SetDisplayVSyncParameters( if (recyclable_compositor_)
timebase, interval); compositor = recyclable_compositor_->compositor();
} // TODO(ccameron): VSync parameters for a ui::Compositor should be tracked
// with the owner of that ui::Compositor (which, in the case of MacViews, is
// BridgedNativeView). For the moment, push the VSync parameters from here to
// the BridgedNativeView's ui::Compositor because that is a small change and
// is easy to merge.
// https://crbug.com/869129
if (parent_ui_layer_)
compositor = parent_ui_layer_->GetCompositor();
if (compositor)
compositor->SetDisplayVSyncParameters(timebase, interval);
} }
void BrowserCompositorMac::SetRenderWidgetHostIsHidden(bool hidden) { void BrowserCompositorMac::SetRenderWidgetHostIsHidden(bool hidden) {
......
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