Bug 1026033, part 1 - Make StyleRule::mDOMRule into an nsRefPtr. r=bz

This commit is contained in:
Andrew McCreight 2014-06-26 09:29:04 -07:00
Родитель 46ae53435c
Коммит d0c431f013
2 изменённых файлов: 2 добавлений и 7 удалений

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

@ -1308,7 +1308,6 @@ StyleRule::StyleRule(nsCSSSelectorList* aSelector,
mSelector(aSelector),
mDeclaration(aDeclaration),
mImportantRule(nullptr),
mDOMRule(nullptr),
mLineNumber(0),
mColumnNumber(0),
mWasMatched(false)
@ -1322,7 +1321,6 @@ StyleRule::StyleRule(const StyleRule& aCopy)
mSelector(aCopy.mSelector ? aCopy.mSelector->Clone() : nullptr),
mDeclaration(new Declaration(*aCopy.mDeclaration)),
mImportantRule(nullptr),
mDOMRule(nullptr),
mLineNumber(aCopy.mLineNumber),
mColumnNumber(aCopy.mColumnNumber),
mWasMatched(false)
@ -1337,14 +1335,13 @@ StyleRule::StyleRule(StyleRule& aCopy,
mSelector(aCopy.mSelector),
mDeclaration(aDeclaration),
mImportantRule(nullptr),
mDOMRule(aCopy.mDOMRule),
mDOMRule(aCopy.mDOMRule.forget()),
mLineNumber(aCopy.mLineNumber),
mColumnNumber(aCopy.mColumnNumber),
mWasMatched(false)
{
// The DOM rule is replacing |aCopy| with |this|, so transfer
// the reverse pointer as well (and transfer ownership).
aCopy.mDOMRule = nullptr;
// Similarly for the selector.
aCopy.mSelector = nullptr;
@ -1366,7 +1363,6 @@ StyleRule::~StyleRule()
NS_IF_RELEASE(mImportantRule);
if (mDOMRule) {
mDOMRule->DOMDeclaration()->DropReference();
NS_RELEASE(mDOMRule);
}
}
@ -1423,7 +1419,6 @@ StyleRule::GetDOMRule()
return nullptr;
}
mDOMRule = new DOMCSSStyleRule(this);
NS_ADDREF(mDOMRule);
}
return mDOMRule;
}

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

@ -375,7 +375,7 @@ private:
nsCSSSelectorList* mSelector; // null for style attribute
Declaration* mDeclaration;
ImportantRule* mImportantRule; // initialized by RuleMatched
DOMCSSStyleRule* mDOMRule;
nsRefPtr<DOMCSSStyleRule> mDOMRule;
// Keep the same type so that MSVC packs them.
uint32_t mLineNumber;
uint32_t mColumnNumber : 31;