Bug 993194, part 4 - Make nsNodeInfoManager::mBindingManager into an nsRefPtr. r=smaug

This commit is contained in:
Andrew McCreight 2014-04-10 07:05:20 -07:00
Родитель 8160114bbd
Коммит e8c627b9d1
2 изменённых файлов: 5 добавлений и 10 удалений

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

@ -116,8 +116,7 @@ nsNodeInfoManager::nsNodeInfoManager()
mPrincipal(nullptr),
mTextNodeInfo(nullptr),
mCommentNodeInfo(nullptr),
mDocumentNodeInfo(nullptr),
mBindingManager(nullptr)
mDocumentNodeInfo(nullptr)
{
nsLayoutStatics::AddRef();
@ -144,7 +143,7 @@ nsNodeInfoManager::~nsNodeInfoManager()
// Note: mPrincipal may be null here if we never got inited correctly
NS_IF_RELEASE(mPrincipal);
NS_IF_RELEASE(mBindingManager);
mBindingManager = nullptr;
#ifdef PR_LOGGING
if (gNodeInfoManagerLeakPRLog)
@ -167,7 +166,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsNodeInfoManager)
if (tmp->mNonDocumentNodeInfos) {
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mDocument)
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mBindingManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBindingManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(nsNodeInfoManager, AddRef)
@ -186,9 +185,6 @@ nsNodeInfoManager::Init(nsIDocument *aDocument)
if (aDocument) {
mBindingManager = new nsBindingManager(aDocument);
NS_ENSURE_TRUE(mBindingManager, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(mBindingManager);
}
mDefaultPrincipal = mPrincipal;

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

@ -12,6 +12,7 @@
#include "mozilla/Attributes.h" // for MOZ_FINAL
#include "nsCOMPtr.h" // for member
#include "nsAutoPtr.h" // for nsRefPtr
#include "nsCycleCollectionParticipant.h" // for NS_DECL_CYCLE_*
#include "plhash.h" // for typedef PLHashNumber
@ -132,9 +133,7 @@ private:
nsINodeInfo *mTextNodeInfo; // WEAK to avoid circular ownership
nsINodeInfo *mCommentNodeInfo; // WEAK to avoid circular ownership
nsINodeInfo *mDocumentNodeInfo; // WEAK to avoid circular ownership
nsBindingManager* mBindingManager; // STRONG, but not nsCOMPtr to avoid
// include hell while inlining
// GetBindingManager().
nsRefPtr<nsBindingManager> mBindingManager;
};
#endif /* nsNodeInfoManager_h___ */