Skip to content

Commit

Permalink
[mac] Stop calling EnablePreferredSizeMode() in WebContentsViewMac
Browse files Browse the repository at this point in the history
EnablePreferredSizeMode() was enabled for the old cocoa (non-views)
based mac UI. This code is no longer needed after [1].

What is more, with recent conversion of ViewMsg_EnablePreferredSizeChangedMode
to mojo [2], we actually fixed the fact that EnablePreferredSizeMode() was being
called to provisional RenderView instances, and the mode was not
being effectively transferred when the RenderView instanced transitioned
to committed state. Prior to [2], then, the mode was simply not working.

However, now that we made calls to EnablePreferredSizeMode() effective
on Mac for provisional (and committed) RenderViews, a performance drop was
observed on loading.desktop benchmark - see [2].

[1] https://chromium.googlesource.com/chromium/src/+/1515d1b6e029d3071b15ae2e89991de62db890e3
[2] https://crrev.com/c/2068699
[3] https://chromeperf.appspot.com/group_report?bug_id=1058975

This CL fixes the perf regression by removing calling
EnablePreferredSizeMode() on Mac for provisional RenderViews.

As a follow up WebContentsView::RenderViewCreated() declaration and
overrides can be removed altogether.

BUG=1058975, 1051155
R=dtapuska@chromium.org

Change-Id: I14be481949b7e11b6eeba8fe9ac383729ec994b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2092096
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Auto-Submit: Antonio Gomes <tonikitoo@igalia.com>
Cr-Commit-Position: refs/heads/master@{#748386}
  • Loading branch information
tonikitoo authored and Commit Bot committed Mar 9, 2020
1 parent 09922f9 commit b1e1da9
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 19 deletions.
4 changes: 0 additions & 4 deletions content/browser/renderer_host/render_view_host_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,6 @@ bool RenderViewHostImpl::CreateRenderView(
void RenderViewHostImpl::SetMainFrameRoutingId(int routing_id) {
main_frame_routing_id_ = routing_id;
GetWidget()->UpdatePriority();

if (enabled_preferred_size_mode_)
EnablePreferredSizeMode();
}

// TODO(https://crbug.com/1006814): Delete this.
Expand Down Expand Up @@ -998,7 +995,6 @@ void RenderViewHostImpl::EnablePreferredSizeMode() {
->GetAssociatedLocalMainFrame()
->EnablePreferredSizeChangedMode();
}
enabled_preferred_size_mode_ = true;
}

void RenderViewHostImpl::ExecutePluginActionAtLocation(
Expand Down
11 changes: 0 additions & 11 deletions content/browser/renderer_host/render_view_host_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -421,17 +421,6 @@ class CONTENT_EXPORT RenderViewHostImpl
// True if the current main document finished executing onload() handler.
bool is_document_on_load_completed_in_main_frame_ = false;

// This is a sentinel that tracks whether EnablePreferredSizeMode()
// has been called. It happens some times that this method is called
// - prior the main frame is actually being ready (active), and the
// call does not effectively take place.
//
// - after the RenderFrame instance has changed in the renderer side.
//
// In both cases, the variable is used to EnablePreferredSizeMode()
// manually from SetMainFrameRoutingId().
bool enabled_preferred_size_mode_ = false;

WillEnterBackForwardCacheCallbackForTesting
will_enter_back_forward_cache_callback_for_testing_;

Expand Down
4 changes: 0 additions & 4 deletions content/browser/web_contents/web_contents_view_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,6 @@ void PromiseWriterHelper(const DropData& drop_data, base::File file) {


void WebContentsViewMac::RenderViewCreated(RenderViewHost* host) {
// We want updates whenever the intrinsic width of the webpage changes.
// Put the RenderView into that mode. The preferred width is used for example
// when the "zoom" button in the browser window is clicked.
host->EnablePreferredSizeMode();
}

void WebContentsViewMac::RenderViewReady() {}
Expand Down

0 comments on commit b1e1da9

Please sign in to comment.