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. |