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

Unified Diff: content/browser/compositor/browser_compositor_view_mac.mm

Issue 1097223002: Mac: Fix black flashing during tab switch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Wait for swap to draw frames Created 5 years, 8 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
Index: content/browser/compositor/browser_compositor_view_mac.mm
diff --git a/content/browser/compositor/browser_compositor_view_mac.mm b/content/browser/compositor/browser_compositor_view_mac.mm
index 322183d0570ff20a19ef6871219263b4ee653609..472c17fab837a504b65f8698ee36915426d73721 100644
--- a/content/browser/compositor/browser_compositor_view_mac.mm
+++ b/content/browser/compositor/browser_compositor_view_mac.mm
@@ -48,9 +48,12 @@ BrowserCompositorMac::BrowserCompositorMac()
RenderWidgetResizeHelper::Get()->task_runner()) {
compositor_.SetLocksWillTimeOut(false);
Suspend();
+ compositor_.AddObserver(this);
}
-BrowserCompositorMac::~BrowserCompositorMac() {}
+BrowserCompositorMac::~BrowserCompositorMac() {
+ compositor_.RemoveObserver(this);
+}
void BrowserCompositorMac::Suspend() {
compositor_suspended_lock_ = compositor_.GetCompositorLock();
@@ -60,6 +63,13 @@ void BrowserCompositorMac::Unsuspend() {
compositor_suspended_lock_ = nullptr;
}
+void BrowserCompositorMac::OnCompositingDidCommit(
+ ui::Compositor* compositor_that_did_commit) {
+ DCHECK_EQ(compositor_that_did_commit, compositor());
+ content::ImageTransportFactory::GetInstance()
+ ->SetCompositorSuspendedForRecycle(compositor(), false);
+}
+
// static
scoped_ptr<BrowserCompositorMac> BrowserCompositorMac::Create() {
if (g_recyclable_browser_compositor.Get())
@@ -71,8 +81,8 @@ scoped_ptr<BrowserCompositorMac> BrowserCompositorMac::Create() {
void BrowserCompositorMac::Recycle(
scoped_ptr<BrowserCompositorMac> compositor) {
DCHECK(compositor);
- content::ImageTransportFactory::GetInstance()->OnCompositorRecycled(
- compositor->compositor());
+ content::ImageTransportFactory::GetInstance()
+ ->SetCompositorSuspendedForRecycle(compositor->compositor(), true);
// It is an error to have a browser compositor continue to exist after
// shutdown.

Powered by Google App Engine
This is Rietveld 408576698