Bug 1316290 - Use 'auto' type specifier for some variable decls that are assigned to "new", in /layout. r?dholbert
MozReview-Commit-ID: hEBEzzmMlC
--- a/layout/base/nsRefreshDriver.cpp
+++ b/layout/base/nsRefreshDriver.cpp
@@ -2232,18 +2232,18 @@ nsRefreshDriver::SetThrottled(bool aThro
}
}
/*static*/ void
nsRefreshDriver::PVsyncActorCreated(VsyncChild* aVsyncChild)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!XRE_IsParentProcess());
- VsyncRefreshDriverTimer* vsyncRefreshDriverTimer =
- new VsyncRefreshDriverTimer(aVsyncChild);
+ auto* vsyncRefreshDriverTimer =
+ new VsyncRefreshDriverTimer(aVsyncChild);
// If we are using software timer, swap current timer to
// VsyncRefreshDriverTimer.
if (sRegularRateTimer) {
sRegularRateTimer->SwapRefreshDrivers(vsyncRefreshDriverTimer);
delete sRegularRateTimer;
}
sRegularRateTimer = vsyncRefreshDriverTimer;
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -274,17 +274,17 @@ RuleHash_ClearEntry(PLDHashTable *table,
static void
RuleHash_MoveEntry(PLDHashTable *table, const PLDHashEntryHdr *from,
PLDHashEntryHdr *to)
{
NS_PRECONDITION(from != to, "This is not going to work!");
RuleHashTableEntry *oldEntry =
const_cast<RuleHashTableEntry*>(
static_cast<const RuleHashTableEntry*>(from));
- RuleHashTableEntry *newEntry = new (KnownNotNull, to) RuleHashTableEntry();
+ auto* newEntry = new (KnownNotNull, to) RuleHashTableEntry();
newEntry->mRules.SwapElements(oldEntry->mRules);
oldEntry->~RuleHashTableEntry();
}
static bool
RuleHash_TagTable_MatchEntry(const PLDHashEntryHdr *hdr, const void *key)
{
nsIAtom *match_atom = const_cast<nsIAtom*>(static_cast<const nsIAtom*>(key));
@@ -311,17 +311,17 @@ RuleHash_TagTable_ClearEntry(PLDHashTabl
static void
RuleHash_TagTable_MoveEntry(PLDHashTable *table, const PLDHashEntryHdr *from,
PLDHashEntryHdr *to)
{
NS_PRECONDITION(from != to, "This is not going to work!");
RuleHashTagTableEntry *oldEntry =
const_cast<RuleHashTagTableEntry*>(
static_cast<const RuleHashTagTableEntry*>(from));
- RuleHashTagTableEntry *newEntry = new (KnownNotNull, to) RuleHashTagTableEntry();
+ auto* newEntry = new (KnownNotNull, to) RuleHashTagTableEntry();
newEntry->mTag.swap(oldEntry->mTag);
newEntry->mRules.SwapElements(oldEntry->mRules);
oldEntry->~RuleHashTagTableEntry();
}
static PLDHashNumber
RuleHash_NameSpaceTable_HashKey(const void *key)
{
@@ -801,17 +801,17 @@ AtomSelector_InitEntry(PLDHashEntryHdr *
static void
AtomSelector_MoveEntry(PLDHashTable *table, const PLDHashEntryHdr *from,
PLDHashEntryHdr *to)
{
NS_PRECONDITION(from != to, "This is not going to work!");
AtomSelectorEntry *oldEntry =
const_cast<AtomSelectorEntry*>(static_cast<const AtomSelectorEntry*>(from));
- AtomSelectorEntry *newEntry = new (KnownNotNull, to) AtomSelectorEntry();
+ auto* newEntry = new (KnownNotNull, to) AtomSelectorEntry();
newEntry->mAtom = oldEntry->mAtom;
newEntry->mSelectors.SwapElements(oldEntry->mSelectors);
oldEntry->~AtomSelectorEntry();
}
static bool
AtomSelector_CIMatchEntry(const PLDHashEntryHdr *hdr, const void *key)
{
@@ -3601,17 +3601,17 @@ CascadeRuleEnumFunc(css::Rule* aRule, vo
int32_t weight = sel->mWeight;
auto entry = static_cast<RuleByWeightEntry*>
(data->mRulesByWeight.Add(NS_INT32_TO_PTR(weight), fallible));
if (!entry)
return false;
entry->data.mWeight = weight;
// entry->data.mRuleSelectorPairs should be linked in forward order;
// entry->data.mTail is the slot to write to.
- PerWeightDataListItem *newItem =
+ auto* newItem =
new (data->mArena) PerWeightDataListItem(styleRule, sel->mSelectors);
if (newItem) {
*(entry->data.mTail) = newItem;
entry->data.mTail = &newItem->mNext;
}
}
}
else if (css::Rule::MEDIA_RULE == type ||