Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(752)

Unified Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 996453002: Allow ui::Compositor to disable commits during tab-switch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporate review feedback Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/compositor/browser_compositor_view_mac.mm ('k') | ui/compositor/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_mac.mm
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index 7f3cb354dc05c946fc6ce1534b5eb6a1ebcd1fea..86f5a774225371db85fd1cc8dbf5f64a44489c0e 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -615,6 +615,14 @@ void RenderWidgetHostViewMac::EnsureBrowserCompositorView() {
if (browser_compositor_state_ == BrowserCompositorSuspended) {
delegated_frame_host_->SetCompositor(browser_compositor_->compositor());
delegated_frame_host_->WasShown(ui::LatencyInfo());
+ // Unsuspend the browser compositor after showing the delegated frame host.
+ // If there is not a saved delegated frame, then the delegated frame host
+ // will keep the compositor locked until a delegated frame is swapped.
+ float scale_factor = ViewScaleFactor();
+ browser_compositor_->compositor()->SetScaleAndSize(
+ scale_factor,
+ gfx::ConvertSizeToPixel(scale_factor, GetViewBounds().size()));
+ browser_compositor_->Unsuspend();
browser_compositor_state_ = BrowserCompositorActive;
}
}
@@ -625,6 +633,9 @@ void RenderWidgetHostViewMac::SuspendBrowserCompositorView() {
// Hide the DelegatedFrameHost to transition from Active -> Suspended.
if (browser_compositor_state_ == BrowserCompositorActive) {
+ // Ensure that any changes made to the ui::Compositor do not result in new
+ // frames being produced.
+ browser_compositor_->Suspend();
// Marking the DelegatedFrameHost as removed from the window hierarchy is
// necessary to remove all connections to its old ui::Compositor.
delegated_frame_host_->WasHidden();
@@ -834,6 +845,12 @@ void RenderWidgetHostViewMac::Show() {
if (!render_widget_host_->is_hidden())
return;
+ // Re-create the browser compositor. If the DelegatedFrameHost has a cached
+ // frame from the last time it was visible, then it will immediately be
+ // drawn. If not, then the compositor will remain locked until a new delegated
+ // frame is swapped.
+ EnsureBrowserCompositorView();
+
WasUnOccluded();
// If there is not a frame being currently drawn, kick one, so that the below
« no previous file with comments | « content/browser/compositor/browser_compositor_view_mac.mm ('k') | ui/compositor/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698