Bug 1507313 part 1: Convert nsIPresShell::mFrameConstructor into a UniquePtr (rather than an owning raw pointer). r=TYLin

Also, null out its alias mFrameManager before it's deleted.

Differential Revision: https://phabricator.services.mozilla.com/D11945

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Daniel Holbert 2018-11-15 07:28:33 +00:00
parent 5265a3bfd3
commit 52166a8007
2 changed files with 7 additions and 7 deletions

View File

@ -747,8 +747,7 @@ PresShell::AccessibleCaretEnabled(nsIDocShell* aDocShell)
}
nsIPresShell::nsIPresShell()
: mFrameConstructor(nullptr)
, mViewManager(nullptr)
: mViewManager(nullptr)
, mFrameManager(nullptr)
#ifdef ACCESSIBILITY
, mDocAccessible(nullptr)
@ -892,7 +891,8 @@ PresShell::~PresShell()
MOZ_ASSERT(mAllocatedPointers.IsEmpty(), "Some pres arena objects were not freed");
mStyleSet = nullptr;
delete mFrameConstructor;
mFrameManager = nullptr;
mFrameConstructor = nullptr;
mCurrentEventContent = nullptr;
}
@ -929,9 +929,9 @@ PresShell::Init(nsIDocument* aDocument,
SetNeedStyleFlush();
// Create our frame constructor.
mFrameConstructor = new nsCSSFrameConstructor(mDocument, this);
mFrameConstructor = MakeUnique<nsCSSFrameConstructor>(mDocument, this);
mFrameManager = mFrameConstructor;
mFrameManager = mFrameConstructor.get();
// The document viewer owns both view manager and pres shell.
mViewManager->SetPresShell(this);

View File

@ -281,7 +281,7 @@ public:
mozilla::ServoStyleSet* StyleSet() const { return mStyleSet.get(); }
nsCSSFrameConstructor* FrameConstructor() const { return mFrameConstructor; }
nsCSSFrameConstructor* FrameConstructor() const { return mFrameConstructor.get(); }
/* Enable/disable author style level. Disabling author style disables the entire
* author level of the cascade, including the HTML preshint level.
@ -1743,7 +1743,7 @@ protected:
nsCOMPtr<nsIDocument> mDocument;
RefPtr<nsPresContext> mPresContext;
mozilla::UniquePtr<mozilla::ServoStyleSet> mStyleSet;
nsCSSFrameConstructor* mFrameConstructor; // [OWNS]
mozilla::UniquePtr<nsCSSFrameConstructor> mFrameConstructor;
nsViewManager* mViewManager; // [WEAK] docViewer owns it so I don't have to
nsPresArena mFrameArena;
RefPtr<nsFrameSelection> mSelection;