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

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

Issue 2005013002: mac: ensure ui::Compositor exists for visible RWHVs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move dcheck Created 4 years, 6 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 | « no previous file | content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper_unittest.mm » ('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 6b759cee848fc22a310e525221104b0a0af13b9c..68b34768d253b8c8c3a35b4005eec4b18cae408b 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -597,6 +597,9 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget,
->GetInputEventRouter()
->AddSurfaceIdNamespaceOwner(GetSurfaceIdNamespace(), this);
}
+
+ if (!render_widget_host_->is_hidden())
+ EnsureBrowserCompositorView();
}
RenderWidgetHostViewMac::~RenderWidgetHostViewMac() {
@@ -640,6 +643,7 @@ cc::SurfaceId RenderWidgetHostViewMac::SurfaceIdForTesting() const {
// RenderWidgetHostViewMac, RenderWidgetHostView implementation:
void RenderWidgetHostViewMac::EnsureBrowserCompositorView() {
+ DCHECK(!render_widget_host_->is_hidden());
TRACE_EVENT0("browser",
"RenderWidgetHostViewMac::EnsureBrowserCompositorView");
@@ -716,6 +720,7 @@ void RenderWidgetHostViewMac::DestroySuspendedBrowserCompositorViewIfNeeded() {
// This should only be reached if |render_widget_host_| is hidden, destroyed,
// or in the process of being destroyed.
+ DCHECK(!render_widget_host_ || render_widget_host_->is_hidden());
DestroyBrowserCompositorView();
}
@@ -887,8 +892,12 @@ RenderWidgetHost* RenderWidgetHostViewMac::GetRenderWidgetHost() const {
void RenderWidgetHostViewMac::Show() {
ScopedCAActionDisabler disabler;
[cocoa_view_ setHidden:NO];
- if (!render_widget_host_->is_hidden())
+ if (!render_widget_host_->is_hidden()) {
+ DCHECK_EQ(browser_compositor_state_, BrowserCompositorActive);
return;
+ }
+
+ WasUnOccluded();
// Re-create the browser compositor. If the DelegatedFrameHost has a cached
// frame from the last time it was visible, then it will immediately be
@@ -896,8 +905,6 @@ void RenderWidgetHostViewMac::Show() {
// frame is swapped.
EnsureBrowserCompositorView();
- WasUnOccluded();
-
// If there is not a frame being currently drawn, kick one, so that the below
// pause will have a frame to wait on.
render_widget_host_->ScheduleComposite();
@@ -917,6 +924,11 @@ void RenderWidgetHostViewMac::Hide() {
// completes. As a result you won't get a thumbnail for the page unless you
// execute these two statements in this specific order.
render_widget_host_->WasHidden();
+ // Re-check hidden flag, as the thumbnail generation could have called
enne (OOO) 2016/06/15 22:07:44 This was the cause of the white tabs. I added a b
+ // WasUnOccluded and unhidden itself.
+ if (!render_widget_host_->is_hidden()) {
+ return;
+ }
SuspendBrowserCompositorView();
}
DestroySuspendedBrowserCompositorViewIfNeeded();
@@ -932,6 +944,7 @@ void RenderWidgetHostViewMac::WasUnOccluded() {
render_widget_host_->GetLatencyComponentId(),
0);
render_widget_host_->WasShown(renderer_latency_info);
+ EnsureBrowserCompositorView();
}
void RenderWidgetHostViewMac::WasOccluded() {
@@ -1494,8 +1507,7 @@ void RenderWidgetHostViewMac::OnSwapCompositorFrame(
gfx::Size dip_size = gfx::ConvertSizeToDIP(scale_factor, pixel_size);
root_layer_->SetBounds(gfx::Rect(dip_size));
- if (!render_widget_host_->is_hidden()) {
- EnsureBrowserCompositorView();
+ if (browser_compositor_ && browser_compositor_->compositor()) {
browser_compositor_->compositor()->SetScaleAndSize(
scale_factor, pixel_size);
}
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698