Bug 1585523 - Use NSAnimationContext instead of CATransaction when triggering off-main-thread composites. r=mattwoodrow a=lizzard
authorMarkus Stange <mstange@themasta.com>
Thu, 03 Oct 2019 04:14:23 +0300
changeset 555576 e8fb03fbdda7f151d41e8c9b8565d10cd1a9a8a5
parent 555575 a1e98c104fbd009e607ffd4d648b1d8017d7c551
child 555577 546ee49d66a195581d9f151a78b71b3566567ca1
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow, lizzard
bugs1585523
milestone70.0
Bug 1585523 - Use NSAnimationContext instead of CATransaction when triggering off-main-thread composites. r=mattwoodrow a=lizzard 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];
   }