Bug 1585523 - Use NSAnimationContext instead of CATransaction when triggering off-main-thread composites. r=mattwoodrow
authorMarkus Stange <mstange@themasta.com>
Thu, 03 Oct 2019 01:14:23 +0000
changeset 496242 b386ee32d8f6ae0dda09898d2b40247b96cfae17
parent 496241 d11c8544621f0b7a1d9cf43893882a22e8897469
child 496243 6d734cb4e0cac938e1e3758b44c750f401e0f5b6
push id36647
push usernerli@mozilla.com
push dateFri, 04 Oct 2019 04:09:18 +0000
treeherdermozilla-central@678d4d2c3c4d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1585523
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1585523 - Use NSAnimationContext instead of CATransaction when triggering off-main-thread composites. r=mattwoodrow When called on a non-main thread, [NSAnimationContext beginGrouping] calls [CATransaction activateBackground:]. There's a chance that doing so might help with some of the crashes we're seeing during [CATransaction commit]. Differential Revision: https://phabricator.services.mozilla.com/D47854
widget/cocoa/nsChildView.mm
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -2026,20 +2026,20 @@ void nsChildView::PostRender(WidgetRende
   if (StaticPrefs::gfx_core_animation_enabled_AtStartup()) {
     auto compositingState = mCompositingState.Lock();
     if (compositingState->mAsyncCATransactionsSuspended) {
       // We should not trigger a CATransactions on this thread. Instead, let the
       // main thread take care of calling ApplyChanges at an appropriate time.
       compositingState->mNativeLayerChangesPending = true;
     } else {
       // Force a CoreAnimation layer tree update from this thread.
-      [CATransaction begin];
+      [NSAnimationContext beginGrouping];
       mNativeLayerRoot->ApplyChanges();
       compositingState->mNativeLayerChangesPending = false;
-      [CATransaction commit];
+      [NSAnimationContext endGrouping];
     }
   } else {
     UniquePtr<GLManager> manager(GLManager::CreateGLManager(aContext->mLayerManager));
     GLContext* gl = manager ? manager->gl() : aContext->mGL;
     NSOpenGLContext* glContext =
         gl ? GLContextCGL::Cast(gl)->GetNSOpenGLContext() : mGLPresenter->GetNSOpenGLContext();
     [mView postRender:glContext];
   }