Bug 1155478 - Use smart pointers for three members of nsIPresShell; r=roc

This commit is contained in:
Ehsan Akhgari 2015-04-16 21:46:08 -04:00
Родитель 2557a4c19e
Коммит f9076fe89f
2 изменённых файлов: 4 добавлений и 11 удалений

Просмотреть файл

@ -1671,13 +1671,13 @@ protected:
// These are the same Document and PresContext owned by the DocViewer.
// we must share ownership.
nsIDocument* mDocument; // [STRONG]
nsPresContext* mPresContext; // [STRONG]
nsCOMPtr<nsIDocument> mDocument;
nsRefPtr<nsPresContext> mPresContext;
nsStyleSet* mStyleSet; // [OWNS]
nsCSSFrameConstructor* mFrameConstructor; // [OWNS]
nsViewManager* mViewManager; // [WEAK] docViewer owns it so I don't have to
nsPresArena mFrameArena;
nsFrameSelection* mSelection;
nsRefPtr<nsFrameSelection> mSelection;
// Pointer into mFrameConstructor - this is purely so that FrameManager() and
// GetRootFrame() can be inlined:
nsFrameManagerBase* mFrameManager;

Просмотреть файл

@ -746,7 +746,6 @@ PresShell::BeforeAfterKeyboardEventEnabled()
PresShell::PresShell()
: mMouseLocation(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE)
{
mSelection = nullptr;
#ifdef MOZ_REFLOW_PERF
mReflowCountMgr = new ReflowCountMgr();
mReflowCountMgr->SetPresContext(mPresContext);
@ -835,10 +834,6 @@ PresShell::~PresShell()
delete mFrameConstructor;
mCurrentEventContent = nullptr;
NS_IF_RELEASE(mPresContext);
NS_IF_RELEASE(mDocument);
NS_IF_RELEASE(mSelection);
}
/**
@ -864,7 +859,6 @@ PresShell::Init(nsIDocument* aDocument,
}
mDocument = aDocument;
NS_ADDREF(mDocument);
mViewManager = aViewManager;
// Create our frame constructor.
@ -877,7 +871,6 @@ PresShell::Init(nsIDocument* aDocument,
// Bind the context to the presentation shell.
mPresContext = aPresContext;
NS_ADDREF(mPresContext);
aPresContext->SetShell(this);
// Now we can initialize the style set.
@ -905,7 +898,7 @@ PresShell::Init(nsIDocument* aDocument,
}
NS_ADDREF(mSelection = new nsFrameSelection());
mSelection = new nsFrameSelection();
mSelection->Init(this, nullptr);