Commit d8de8d34 authored by Fady Samuel's avatar Fady Samuel Committed by Commit Bot

Surface synchronization: Simplify Auto-Resize

It doesn't seem like there's any reason to defer auto-resize embeddings
anymore. There was a concern way back when about re-entrancy and flicker:

https://codereview.chromium.org/9702068

Child allocated LocalSurfaceIds address both of these issues.

Change-Id: Ieaefdf517f7c6c14d0e6a8ac496e233798185dc0
Reviewed-on: https://chromium-review.googlesource.com/1036501Reviewed-by: default avatarSaman Sami <samans@chromium.org>
Commit-Queue: Fady Samuel <fsamuel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555149}
parent 6cc4e64c
......@@ -2182,15 +2182,14 @@ void RenderWidgetHostImpl::OnResizeOrRepaintACK(
DidCompleteResizeOrRepaint(params, paint_start);
last_auto_resize_surface_id_ = params.child_allocated_local_surface_id;
if (auto_resize_enabled_) {
bool post_callback = new_auto_size_.IsEmpty();
new_auto_size_ = params.view_size;
if (post_callback) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(&RenderWidgetHostImpl::DelayedAutoResized,
weak_factory_.GetWeakPtr()));
if (auto_resize_enabled_ && view_) {
viz::ScopedSurfaceIdAllocator scoped_allocator =
view_->ResizeDueToAutoResize(params.view_size,
*params.child_allocated_local_surface_id);
if (delegate_) {
delegate_->ResizeDueToAutoResize(
this, params.view_size, *params.child_allocated_local_surface_id);
}
}
......@@ -2632,27 +2631,6 @@ void RenderWidgetHostImpl::GotResponseToKeyboardLockRequest(bool allowed) {
UnlockKeyboard();
}
void RenderWidgetHostImpl::DelayedAutoResized() {
gfx::Size new_size = new_auto_size_;
// Clear the new_auto_size_ since the empty value is used as a flag to
// indicate that no callback is in progress (i.e. without this line
// DelayedAutoResized will not get called again).
new_auto_size_.SetSize(0, 0);
if (!auto_resize_enabled_)
return;
if (view_) {
viz::ScopedSurfaceIdAllocator scoped_allocator =
view_->ResizeDueToAutoResize(new_size,
last_auto_resize_surface_id_.value());
if (delegate_) {
delegate_->ResizeDueToAutoResize(this, new_size,
last_auto_resize_surface_id_.value());
}
}
}
void RenderWidgetHostImpl::DetachDelegate() {
delegate_ = nullptr;
latency_tracker_.reset_delegate();
......
......@@ -838,10 +838,6 @@ class CONTENT_EXPORT RenderWidgetHostImpl
void DispatchInputEventWithLatencyInfo(const blink::WebInputEvent& event,
ui::LatencyInfo* latency);
// Called when there is a new auto resize (using a post to avoid a stack
// which may get in recursive loops).
void DelayedAutoResized();
void WindowSnapshotReachedScreen(int snapshot_id);
void OnSnapshotFromSurfaceReceived(int snapshot_id,
......@@ -938,9 +934,6 @@ class CONTENT_EXPORT RenderWidgetHostImpl
// Visual properties that were most recently sent to the renderer.
std::unique_ptr<VisualProperties> old_visual_properties_;
// The next auto resize to send.
gfx::Size new_auto_size_;
// True if the render widget host should track the render widget's size as
// opposed to visa versa.
bool auto_resize_enabled_;
......@@ -951,8 +944,6 @@ class CONTENT_EXPORT RenderWidgetHostImpl
// The maximum size for the render widget if auto-resize is enabled.
gfx::Size max_size_for_auto_resize_;
base::Optional<viz::LocalSurfaceId> last_auto_resize_surface_id_;
bool waiting_for_screen_rects_ack_;
gfx::Rect last_view_screen_rect_;
gfx::Rect last_window_screen_rect_;
......
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