Commit 77c83454 authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

MacViews: Don't wait for frames on new tabs

Only have a non-zero deadline when resizing -- otherwise new tab
creation and tab-switch can feel janky.

Bug: 855364
Change-Id: If198085e418f0bf9ed5af47833d23df0c37c47c7
Reviewed-on: https://chromium-review.googlesource.com/1121630Reviewed-by: default avatarFady Samuel <fsamuel@chromium.org>
Commit-Queue: ccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#571781}
parent 82d8415f
......@@ -149,7 +149,7 @@ class CONTENT_EXPORT BrowserCompositorMac : public DelegatedFrameHostClient,
// ui::LayerObserver implementation:
void LayerDestroyed(ui::Layer* layer) override;
cc::DeadlinePolicy GetDeadlinePolicy() const;
cc::DeadlinePolicy GetDeadlinePolicy(bool is_resize) const;
// The state of |delegated_frame_host_| and |recyclable_compositor_| to
// manage being visible, occluded, hidden, or drawn via a ui::Layer. Note that
......
......@@ -302,6 +302,8 @@ bool BrowserCompositorMac::UpdateNSViewAndDisplay(
if (new_size_dip == dfh_size_dip_ && new_display == dfh_display_)
return false;
bool is_resize = !dfh_size_dip_.IsEmpty() && new_size_dip != dfh_size_dip_;
bool needs_new_surface_id =
new_size_dip != dfh_size_dip_ ||
new_display.device_scale_factor() != dfh_display_.device_scale_factor();
......@@ -317,7 +319,7 @@ bool BrowserCompositorMac::UpdateNSViewAndDisplay(
recyclable_compositor_->Suspend();
GetDelegatedFrameHost()->EmbedSurface(
dfh_local_surface_id_allocator_.GenerateId(), dfh_size_dip_,
GetDeadlinePolicy());
GetDeadlinePolicy(is_resize));
}
if (recyclable_compositor_) {
......@@ -347,7 +349,7 @@ void BrowserCompositorMac::SynchronizeVisualProperties(
}
GetDelegatedFrameHost()->EmbedSurface(
dfh_local_surface_id_allocator_.GetCurrentLocalSurfaceId(),
dfh_size_dip_, GetDeadlinePolicy());
dfh_size_dip_, GetDeadlinePolicy(true /* is_resize */));
}
client_->SynchronizeVisualProperties();
}
......@@ -631,9 +633,12 @@ ui::Compositor* BrowserCompositorMac::GetCompositorForTesting() const {
return nullptr;
}
cc::DeadlinePolicy BrowserCompositorMac::GetDeadlinePolicy() const {
// Determined empirically for smoothness.
uint32_t frames_to_wait = 8;
cc::DeadlinePolicy BrowserCompositorMac::GetDeadlinePolicy(
bool is_resize) const {
// Determined empirically for smoothness. Don't wait for non-resize frames,
// as it can cause jank at new tab creation.
// https://crbug.com/855364
uint32_t frames_to_wait = is_resize ? 8 : 0;
// When using the RecyclableCompositor, never wait for frames to arrive
// (surface sync is managed by the Suspend/Unsuspend lock).
......
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