Bug 1509972 part 5: Use UniquePtr (not nsAutoPtr) to store a few local vars in nsCSSFrameConstructor. r=TYLin
authorDaniel Holbert <dholbert@cs.stanford.edu>
Mon, 26 Nov 2018 22:48:31 +0000
changeset 507419 102cab25b07a8040ea31835f47ac7ab1f669e20a
parent 507418 ffbdfd28202f40c0bc360758504cb98cc4ad9264
child 507420 ad857edac6a5944891e6ee1637f85f45c7f4f027
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersTYLin
bugs1509972
milestone65.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 1509972 part 5: Use UniquePtr (not nsAutoPtr) to store a few local vars in nsCSSFrameConstructor. r=TYLin This patch also gives nsCSSFrameConstructor.h its own UniquePtr include (since we have some UniquePtr usage there, but no include). Presumably it's already getting the include indirectly (via some other header) right now, but it should really include it directly if it uses the type directly. (This leaves one nsAutoPtr usage in nsCSSFrameConstructor, for 'mNode'. We can probably convert that one without too much trouble, but I'm not doing so yet, in part because we intentionally leak that variable in one spot and I haven't fully worked out the ownership transfer for that case.) Differential Revision: https://phabricator.services.mozilla.com/D12992
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsCSSFrameConstructor.h
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -1030,18 +1030,17 @@ nsFrameConstructorState::~nsFrameConstru
 #endif
   for (int32_t i = mGeneratedTextNodesWithInitializer.Count() - 1; i >= 0; --i) {
     mGeneratedTextNodesWithInitializer[i]->
       DeleteProperty(nsGkAtoms::genConInitializerProperty);
   }
   if (!mPendingBindings.isEmpty()) {
     nsBindingManager* bindingManager = mPresShell->GetDocument()->BindingManager();
     do {
-      nsAutoPtr<PendingBinding> pendingBinding;
-      pendingBinding = mPendingBindings.popFirst();
+      UniquePtr<PendingBinding> pendingBinding(mPendingBindings.popFirst());
       bindingManager->AddToAttachedQueue(pendingBinding->mBinding);
     } while (!mPendingBindings.isEmpty());
     mCurrentPendingBindingInsertionPoint = nullptr;
   }
 }
 
 static nsContainerFrame*
 AdjustAbsoluteContainingBlock(nsContainerFrame* aContainingBlockIn)
@@ -3450,20 +3449,19 @@ nsCSSFrameConstructor::ConstructTextFram
 
   nsIFrame* newFrame = (*aData->mFunc.mCreationFunc)(mPresShell, aComputedStyle);
 
   InitAndRestoreFrame(aState, aContent, aParentFrame, newFrame);
 
   // We never need to create a view for a text frame.
 
   if (newFrame->IsGeneratedContentFrame()) {
-    nsAutoPtr<nsGenConInitializer> initializer;
-    initializer =
+    UniquePtr<nsGenConInitializer> initializer(
       static_cast<nsGenConInitializer*>(
-        aContent->UnsetProperty(nsGkAtoms::genConInitializerProperty));
+        aContent->UnsetProperty(nsGkAtoms::genConInitializerProperty)));
     if (initializer) {
       if (initializer->mNode->InitTextFrame(initializer->mList,
               FindAncestorWithGeneratedContentPseudo(newFrame), newFrame)) {
         (this->*(initializer->mDirtyAll))();
       }
       initializer->mNode.forget();
     }
   }
--- a/layout/base/nsCSSFrameConstructor.h
+++ b/layout/base/nsCSSFrameConstructor.h
@@ -13,16 +13,17 @@
 #define nsCSSFrameConstructor_h___
 
 #include "mozilla/ArenaAllocator.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/LinkedList.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/RestyleManager.h"
 #include "mozilla/ScrollStyles.h"
+#include "mozilla/UniquePtr.h"
 
 #include "nsCOMPtr.h"
 #include "nsILayoutHistoryState.h"
 #include "nsQuoteList.h"
 #include "nsCounterManager.h"
 #include "nsIAnonymousContentCreator.h"
 #include "nsFrameManager.h"