diff --git a/content/html/content/src/HTMLFormElement.cpp b/content/html/content/src/HTMLFormElement.cpp
index c8fd4c3c8844..a5dafe06c942 100644
--- a/content/html/content/src/HTMLFormElement.cpp
+++ b/content/html/content/src/HTMLFormElement.cpp
@@ -12,6 +12,7 @@
#include "mozilla/EventStates.h"
#include "mozilla/dom/HTMLFormControlsCollection.h"
#include "mozilla/dom/HTMLFormElementBinding.h"
+#include "mozilla/Move.h"
#include "nsIHTMLDocument.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"
@@ -1511,7 +1512,7 @@ HTMLFormElement::FlushPendingSubmission()
if (mPendingSubmission) {
// Transfer owning reference so that the submissioin doesn't get deleted
// if we reenter
- nsAutoPtr submission = mPendingSubmission;
+ nsAutoPtr submission = Move(mPendingSubmission);
SubmitSubmission(submission);
}
diff --git a/dom/smil/nsSMILCompositor.h b/dom/smil/nsSMILCompositor.h
index 933a01392bf3..937f4a6b9a9b 100644
--- a/dom/smil/nsSMILCompositor.h
+++ b/dom/smil/nsSMILCompositor.h
@@ -6,6 +6,7 @@
#ifndef NS_SMILCOMPOSITOR_H_
#define NS_SMILCOMPOSITOR_H_
+#include "mozilla/Move.h"
#include "nsTHashtable.h"
#include "nsString.h"
#include "nsSMILAnimationFunction.h"
@@ -65,7 +66,7 @@ public:
// Transfers |aOther|'s mCachedBaseValue to |this|
void StealCachedBaseValue(nsSMILCompositor* aOther) {
- mCachedBaseValue = aOther->mCachedBaseValue;
+ mCachedBaseValue = mozilla::Move(aOther->mCachedBaseValue);
}
private:
diff --git a/dom/smil/nsSMILTimedElement.h b/dom/smil/nsSMILTimedElement.h
index a8086acb8c52..ba9b1ad9ceb4 100644
--- a/dom/smil/nsSMILTimedElement.h
+++ b/dom/smil/nsSMILTimedElement.h
@@ -6,6 +6,7 @@
#ifndef NS_SMILTIMEDELEMENT_H_
#define NS_SMILTIMEDELEMENT_H_
+#include "mozilla/Move.h"
#include "nsSMILInterval.h"
#include "nsSMILInstanceTime.h"
#include "nsSMILMilestone.h"
@@ -524,7 +525,7 @@ protected:
{
if (mCurrentInterval) {
// Transfer ownership to temp var. (This sets mCurrentInterval to null.)
- nsAutoPtr interval(mCurrentInterval);
+ nsAutoPtr interval(mozilla::Move(mCurrentInterval));
interval->Unlink();
}
}
diff --git a/dom/xslt/xpath/XPathEvaluator.cpp b/dom/xslt/xpath/XPathEvaluator.cpp
index 73e17a6f38b7..a638988d9a42 100644
--- a/dom/xslt/xpath/XPathEvaluator.cpp
+++ b/dom/xslt/xpath/XPathEvaluator.cpp
@@ -4,6 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/XPathEvaluator.h"
+#include "mozilla/Move.h"
#include "nsCOMPtr.h"
#include "nsIAtom.h"
#include "nsXPathExpression.h"
@@ -129,7 +130,7 @@ XPathEvaluator::CreateExpression(const nsAString & aExpression,
nsCOMPtr document = do_QueryReferent(mDocument);
- *aResult = new nsXPathExpression(expression, mRecycler, document);
+ *aResult = new nsXPathExpression(Move(expression), mRecycler, document);
if (!*aResult) {
return NS_ERROR_OUT_OF_MEMORY;
}
diff --git a/dom/xslt/xpath/nsXPathExpression.cpp b/dom/xslt/xpath/nsXPathExpression.cpp
index f7d7b123e5ae..7a5cc13a79ee 100644
--- a/dom/xslt/xpath/nsXPathExpression.cpp
+++ b/dom/xslt/xpath/nsXPathExpression.cpp
@@ -3,6 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+#include "mozilla/Move.h"
#include "nsXPathExpression.h"
#include "txExpr.h"
#include "txExprResult.h"
@@ -14,6 +15,8 @@
#include "txURIUtils.h"
#include "txXPathTreeWalker.h"
+using mozilla::Move;
+
NS_IMPL_CYCLE_COLLECTION(nsXPathExpression, mDocument)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsXPathExpression)
@@ -28,10 +31,10 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXPathExpression)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(XPathExpression)
NS_INTERFACE_MAP_END
-nsXPathExpression::nsXPathExpression(nsAutoPtr& aExpression,
+nsXPathExpression::nsXPathExpression(nsAutoPtr&& aExpression,
txResultRecycler* aRecycler,
nsIDOMDocument *aDocument)
- : mExpression(aExpression),
+ : mExpression(Move(aExpression)),
mRecycler(aRecycler),
mDocument(aDocument)
{
diff --git a/dom/xslt/xpath/nsXPathExpression.h b/dom/xslt/xpath/nsXPathExpression.h
index e36b52124b97..cf6f83acb577 100644
--- a/dom/xslt/xpath/nsXPathExpression.h
+++ b/dom/xslt/xpath/nsXPathExpression.h
@@ -24,7 +24,7 @@ class nsXPathExpression MOZ_FINAL : public nsIDOMXPathExpression,
public nsIDOMNSXPathExpression
{
public:
- nsXPathExpression(nsAutoPtr& aExpression, txResultRecycler* aRecycler,
+ nsXPathExpression(nsAutoPtr&& aExpression, txResultRecycler* aRecycler,
nsIDOMDocument *aDocument);
// nsISupports interface
diff --git a/dom/xslt/xpath/txExprParser.cpp b/dom/xslt/xpath/txExprParser.cpp
index b06e04497016..d431802738a1 100644
--- a/dom/xslt/xpath/txExprParser.cpp
+++ b/dom/xslt/xpath/txExprParser.cpp
@@ -9,6 +9,7 @@
* @see ExprLexer
**/
+#include "mozilla/Move.h"
#include "txExprParser.h"
#include "txExprLexer.h"
#include "txExpr.h"
@@ -20,6 +21,8 @@
#include "txXPathNode.h"
#include "txXPathOptimizer.h"
+using mozilla::Move;
+
/**
* Creates an Attribute Value Template using the given value
* This should move to XSLProcessor class
@@ -113,7 +116,7 @@ txExprParser::createAVT(const nsSubstring& aAttrValue,
// Add expression, create a concat() call if necessary
if (!expr) {
- expr = newExpr;
+ expr = Move(newExpr);
}
else {
if (!concat) {
@@ -311,7 +314,7 @@ txExprParser::createExpr(txExprLexer& lexer, txIParseContext* aContext,
<= precedence(static_cast(ops.peek()))) {
// can't use expr as argument due to order of evaluation
nsAutoPtr left(static_cast(exprs.pop()));
- nsAutoPtr right(expr);
+ nsAutoPtr right(Move(expr));
rv = createBinaryExpr(left, right,
static_cast(ops.pop()),
getter_Transfers(expr));
@@ -330,7 +333,7 @@ txExprParser::createExpr(txExprLexer& lexer, txIParseContext* aContext,
while (NS_SUCCEEDED(rv) && !exprs.isEmpty()) {
nsAutoPtr left(static_cast(exprs.pop()));
- nsAutoPtr right(expr);
+ nsAutoPtr right(Move(expr));
rv = createBinaryExpr(left, right, static_cast(ops.pop()),
getter_Transfers(expr));
}
diff --git a/dom/xslt/xslt/txInstructions.cpp b/dom/xslt/xslt/txInstructions.cpp
index f05ff2e6b234..8dc9be7918e8 100644
--- a/dom/xslt/xslt/txInstructions.cpp
+++ b/dom/xslt/xslt/txInstructions.cpp
@@ -3,6 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+#include "mozilla/Move.h"
#include "txInstructions.h"
#include "nsError.h"
#include "txExpr.h"
@@ -18,6 +19,8 @@
#include "txXSLTNumber.h"
#include "txExecutionState.h"
+using mozilla::Move;
+
nsresult
txApplyDefaultElementTemplate::execute(txExecutionState& aEs)
{
@@ -86,11 +89,9 @@ txApplyTemplates::execute(txExecutionState& aEs)
return aEs.runTemplate(templ);
}
-txAttribute::txAttribute(nsAutoPtr aName, nsAutoPtr aNamespace,
+txAttribute::txAttribute(nsAutoPtr&& aName, nsAutoPtr&& aNamespace,
txNamespaceMap* aMappings)
- : mName(aName),
- mNamespace(aNamespace),
- mMappings(aMappings)
+ : mName(Move(aName)), mNamespace(Move(aNamespace)), mMappings(aMappings)
{
}
@@ -179,10 +180,9 @@ txCheckParam::execute(txExecutionState& aEs)
return NS_OK;
}
-txConditionalGoto::txConditionalGoto(nsAutoPtr aCondition,
+txConditionalGoto::txConditionalGoto(nsAutoPtr&& aCondition,
txInstruction* aTarget)
- : mCondition(aCondition),
- mTarget(aTarget)
+ : mCondition(Move(aCondition)), mTarget(aTarget)
{
}
@@ -365,8 +365,8 @@ txCopy::execute(txExecutionState& aEs)
return NS_OK;
}
-txCopyOf::txCopyOf(nsAutoPtr aSelect)
- : mSelect(aSelect)
+txCopyOf::txCopyOf(nsAutoPtr&& aSelect)
+ : mSelect(Move(aSelect))
{
}
@@ -486,11 +486,11 @@ txLoopNodeSet::execute(txExecutionState& aEs)
}
txLREAttribute::txLREAttribute(int32_t aNamespaceID, nsIAtom* aLocalName,
- nsIAtom* aPrefix, nsAutoPtr aValue)
+ nsIAtom* aPrefix, nsAutoPtr&& aValue)
: mNamespaceID(aNamespaceID),
mLocalName(aLocalName),
mPrefix(aPrefix),
- mValue(aValue)
+ mValue(Move(aValue))
{
if (aNamespaceID == kNameSpaceID_None) {
mLowercaseLocalName = TX_ToLowerCaseAtom(aLocalName);
@@ -541,13 +541,17 @@ txMessage::execute(txExecutionState& aEs)
return mTerminate ? NS_ERROR_XSLT_ABORTED : NS_OK;
}
-txNumber::txNumber(txXSLTNumber::LevelType aLevel, nsAutoPtr aCount,
- nsAutoPtr aFrom, nsAutoPtr aValue,
- nsAutoPtr aFormat, nsAutoPtr aGroupingSeparator,
- nsAutoPtr aGroupingSize)
- : mLevel(aLevel), mCount(aCount), mFrom(aFrom), mValue(aValue),
- mFormat(aFormat), mGroupingSeparator(aGroupingSeparator),
- mGroupingSize(aGroupingSize)
+txNumber::txNumber(txXSLTNumber::LevelType aLevel,
+ nsAutoPtr&& aCount, nsAutoPtr&& aFrom,
+ nsAutoPtr&& aValue, nsAutoPtr&& aFormat,
+ nsAutoPtr&& aGroupingSeparator,
+ nsAutoPtr&& aGroupingSize)
+ : mLevel(aLevel), mCount(Move(aCount)),
+ mFrom(Move(aFrom)),
+ mValue(Move(aValue)),
+ mFormat(Move(aFormat)),
+ mGroupingSeparator(Move(aGroupingSeparator)),
+ mGroupingSize(Move(aGroupingSize))
{
}
@@ -572,8 +576,8 @@ txPopParams::execute(txExecutionState& aEs)
return NS_OK;
}
-txProcessingInstruction::txProcessingInstruction(nsAutoPtr aName)
- : mName(aName)
+txProcessingInstruction::txProcessingInstruction(nsAutoPtr&& aName)
+ : mName(Move(aName))
{
}
@@ -599,8 +603,8 @@ txProcessingInstruction::execute(txExecutionState& aEs)
return aEs.mResultHandler->processingInstruction(name, handler->mValue);
}
-txPushNewContext::txPushNewContext(nsAutoPtr aSelect)
- : mSelect(aSelect), mBailTarget(nullptr)
+txPushNewContext::txPushNewContext(nsAutoPtr&& aSelect)
+ : mSelect(Move(aSelect)), mBailTarget(nullptr)
{
}
@@ -660,19 +664,19 @@ txPushNewContext::execute(txExecutionState& aEs)
}
nsresult
-txPushNewContext::addSort(nsAutoPtr aSelectExpr,
- nsAutoPtr aLangExpr,
- nsAutoPtr aDataTypeExpr,
- nsAutoPtr aOrderExpr,
- nsAutoPtr aCaseOrderExpr)
+txPushNewContext::addSort(nsAutoPtr&& aSelectExpr,
+ nsAutoPtr&& aLangExpr,
+ nsAutoPtr&& aDataTypeExpr,
+ nsAutoPtr&& aOrderExpr,
+ nsAutoPtr&& aCaseOrderExpr)
{
if (SortKey *key = mSortKeys.AppendElement()) {
// workaround for not triggering the Copy Constructor
- key->mSelectExpr = aSelectExpr;
- key->mLangExpr = aLangExpr;
- key->mDataTypeExpr = aDataTypeExpr;
- key->mOrderExpr = aOrderExpr;
- key->mCaseOrderExpr = aCaseOrderExpr;
+ key->mSelectExpr = Move(aSelectExpr);
+ key->mLangExpr = Move(aLangExpr);
+ key->mDataTypeExpr = Move(aDataTypeExpr);
+ key->mOrderExpr = Move(aOrderExpr);
+ key->mCaseOrderExpr = Move(aCaseOrderExpr);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
@@ -748,8 +752,8 @@ txReturn::execute(txExecutionState& aEs)
return NS_OK;
}
-txSetParam::txSetParam(const txExpandedName& aName, nsAutoPtr aValue)
- : mName(aName), mValue(aValue)
+txSetParam::txSetParam(const txExpandedName& aName, nsAutoPtr&& aValue)
+ : mName(aName), mValue(Move(aValue))
{
}
@@ -782,8 +786,8 @@ txSetParam::execute(txExecutionState& aEs)
}
txSetVariable::txSetVariable(const txExpandedName& aName,
- nsAutoPtr aValue)
- : mName(aName), mValue(aValue)
+ nsAutoPtr&& aValue)
+ : mName(aName), mValue(Move(aValue))
{
}
@@ -806,11 +810,11 @@ txSetVariable::execute(txExecutionState& aEs)
return aEs.bindVariable(mName, exprRes);
}
-txStartElement::txStartElement(nsAutoPtr aName,
- nsAutoPtr aNamespace,
+txStartElement::txStartElement(nsAutoPtr&& aName,
+ nsAutoPtr&& aNamespace,
txNamespaceMap* aMappings)
- : mName(aName),
- mNamespace(aNamespace),
+ : mName(Move(aName)),
+ mNamespace(Move(aNamespace)),
mMappings(aMappings)
{
}
@@ -916,8 +920,8 @@ txText::execute(txExecutionState& aEs)
return aEs.mResultHandler->characters(mStr, mDOE);
}
-txValueOf::txValueOf(nsAutoPtr aExpr, bool aDOE)
- : mExpr(aExpr),
+txValueOf::txValueOf(nsAutoPtr&& aExpr, bool aDOE)
+ : mExpr(Move(aExpr)),
mDOE(aDOE)
{
}
diff --git a/dom/xslt/xslt/txInstructions.h b/dom/xslt/xslt/txInstructions.h
index b3deb5537690..1c27f9842874 100644
--- a/dom/xslt/xslt/txInstructions.h
+++ b/dom/xslt/xslt/txInstructions.h
@@ -71,7 +71,7 @@ public:
class txAttribute : public txInstruction
{
public:
- txAttribute(nsAutoPtr aName, nsAutoPtr aNamespace,
+ txAttribute(nsAutoPtr&& aName, nsAutoPtr&& aNamespace,
txNamespaceMap* aMappings);
TX_DECL_TXINSTRUCTION
@@ -105,7 +105,7 @@ public:
class txConditionalGoto : public txInstruction
{
public:
- txConditionalGoto(nsAutoPtr aCondition, txInstruction* aTarget);
+ txConditionalGoto(nsAutoPtr&& aCondition, txInstruction* aTarget);
TX_DECL_TXINSTRUCTION
@@ -138,7 +138,7 @@ public:
class txCopyOf : public txCopyBase
{
public:
- txCopyOf(nsAutoPtr aSelect);
+ txCopyOf(nsAutoPtr&& aSelect);
TX_DECL_TXINSTRUCTION
@@ -191,7 +191,7 @@ class txLREAttribute : public txInstruction
{
public:
txLREAttribute(int32_t aNamespaceID, nsIAtom* aLocalName,
- nsIAtom* aPrefix, nsAutoPtr aValue);
+ nsIAtom* aPrefix, nsAutoPtr&& aValue);
TX_DECL_TXINSTRUCTION
@@ -215,10 +215,10 @@ public:
class txNumber : public txInstruction
{
public:
- txNumber(txXSLTNumber::LevelType aLevel, nsAutoPtr aCount,
- nsAutoPtr aFrom, nsAutoPtr aValue,
- nsAutoPtr aFormat, nsAutoPtr aGroupingSeparator,
- nsAutoPtr aGroupingSize);
+ txNumber(txXSLTNumber::LevelType aLevel, nsAutoPtr&& aCount,
+ nsAutoPtr&& aFrom, nsAutoPtr&& aValue,
+ nsAutoPtr&& aFormat, nsAutoPtr&& aGroupingSeparator,
+ nsAutoPtr&& aGroupingSize);
TX_DECL_TXINSTRUCTION
@@ -240,7 +240,7 @@ public:
class txProcessingInstruction : public txInstruction
{
public:
- txProcessingInstruction(nsAutoPtr aName);
+ txProcessingInstruction(nsAutoPtr&& aName);
TX_DECL_TXINSTRUCTION
@@ -250,15 +250,17 @@ public:
class txPushNewContext : public txInstruction
{
public:
- txPushNewContext(nsAutoPtr aSelect);
+ txPushNewContext(nsAutoPtr&& aSelect);
~txPushNewContext();
TX_DECL_TXINSTRUCTION
- nsresult addSort(nsAutoPtr aSelectExpr, nsAutoPtr aLangExpr,
- nsAutoPtr aDataTypeExpr, nsAutoPtr aOrderExpr,
- nsAutoPtr aCaseOrderExpr);
+ nsresult addSort(nsAutoPtr&& aSelectExpr,
+ nsAutoPtr&& aLangExpr,
+ nsAutoPtr&& aDataTypeExpr,
+ nsAutoPtr&& aOrderExpr,
+ nsAutoPtr&& aCaseOrderExpr);
struct SortKey {
nsAutoPtr mSelectExpr;
@@ -320,7 +322,7 @@ public:
class txSetParam : public txInstruction
{
public:
- txSetParam(const txExpandedName& aName, nsAutoPtr aValue);
+ txSetParam(const txExpandedName& aName, nsAutoPtr&& aValue);
TX_DECL_TXINSTRUCTION
@@ -331,7 +333,7 @@ public:
class txSetVariable : public txInstruction
{
public:
- txSetVariable(const txExpandedName& aName, nsAutoPtr aValue);
+ txSetVariable(const txExpandedName& aName, nsAutoPtr&& aValue);
TX_DECL_TXINSTRUCTION
@@ -342,7 +344,7 @@ public:
class txStartElement : public txInstruction
{
public:
- txStartElement(nsAutoPtr aName, nsAutoPtr aNamespace,
+ txStartElement(nsAutoPtr&& aName, nsAutoPtr&& aNamespace,
txNamespaceMap* aMappings);
TX_DECL_TXINSTRUCTION
@@ -380,7 +382,7 @@ public:
class txValueOf : public txInstruction
{
public:
- txValueOf(nsAutoPtr aExpr, bool aDOE);
+ txValueOf(nsAutoPtr&& aExpr, bool aDOE);
TX_DECL_TXINSTRUCTION
diff --git a/dom/xslt/xslt/txKey.h b/dom/xslt/xslt/txKey.h
index 886cc869e0cc..62f47d3bfb90 100644
--- a/dom/xslt/xslt/txKey.h
+++ b/dom/xslt/xslt/txKey.h
@@ -120,7 +120,7 @@ public:
* @param aUse use-expression
* @return false if an error occurred, true otherwise
*/
- bool addKey(nsAutoPtr aMatch, nsAutoPtr aUse);
+ bool addKey(nsAutoPtr&& aMatch, nsAutoPtr&& aUse);
/**
* Indexes a subtree and adds it to the hash of key values
diff --git a/dom/xslt/xslt/txKeyFunctionCall.cpp b/dom/xslt/xslt/txKeyFunctionCall.cpp
index 60a9aca90d50..9ae5a7e2e907 100644
--- a/dom/xslt/xslt/txKeyFunctionCall.cpp
+++ b/dom/xslt/xslt/txKeyFunctionCall.cpp
@@ -12,6 +12,7 @@
#include "txXSLTPatterns.h"
#include "txNamespaceMap.h"
#include "mozilla/HashFunctions.h"
+#include "mozilla/Move.h"
using namespace mozilla;
@@ -251,7 +252,7 @@ txKeyHash::init()
* @param aUse use-expression
* @return false if an error occurred, true otherwise
*/
-bool txXSLKey::addKey(nsAutoPtr aMatch, nsAutoPtr aUse)
+bool txXSLKey::addKey(nsAutoPtr&& aMatch, nsAutoPtr&& aUse)
{
if (!aMatch || !aUse)
return false;
@@ -260,8 +261,8 @@ bool txXSLKey::addKey(nsAutoPtr aMatch, nsAutoPtr aUse)
if (!key)
return false;
- key->matchPattern = aMatch;
- key->useExpr = aUse;
+ key->matchPattern = Move(aMatch);
+ key->useExpr = Move(aUse);
return true;
}
diff --git a/dom/xslt/xslt/txRtfHandler.cpp b/dom/xslt/xslt/txRtfHandler.cpp
index 5efee64eb5b5..1b3d12822bae 100644
--- a/dom/xslt/xslt/txRtfHandler.cpp
+++ b/dom/xslt/xslt/txRtfHandler.cpp
@@ -4,10 +4,13 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "txRtfHandler.h"
+#include "mozilla/Move.h"
-txResultTreeFragment::txResultTreeFragment(nsAutoPtr& aBuffer)
+using mozilla::Move;
+
+txResultTreeFragment::txResultTreeFragment(nsAutoPtr&& aBuffer)
: txAExprResult(nullptr),
- mBuffer(aBuffer)
+ mBuffer(Move(aBuffer))
{
}
@@ -58,7 +61,7 @@ nsresult txResultTreeFragment::flushToHandler(txAXMLEventHandler* aHandler)
nsresult
txRtfHandler::getAsRTF(txAExprResult** aResult)
{
- *aResult = new txResultTreeFragment(mBuffer);
+ *aResult = new txResultTreeFragment(Move(mBuffer));
NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(*aResult);
diff --git a/dom/xslt/xslt/txRtfHandler.h b/dom/xslt/xslt/txRtfHandler.h
index ec5bf0f6fa0f..14d2f17efdb8 100644
--- a/dom/xslt/xslt/txRtfHandler.h
+++ b/dom/xslt/xslt/txRtfHandler.h
@@ -14,7 +14,7 @@
class txResultTreeFragment : public txAExprResult
{
public:
- txResultTreeFragment(nsAutoPtr& aBuffer);
+ txResultTreeFragment(nsAutoPtr&& aBuffer);
TX_DECL_EXPRRESULT
diff --git a/dom/xslt/xslt/txStylesheet.cpp b/dom/xslt/xslt/txStylesheet.cpp
index 5aff52b1cf3f..a9ee817923b1 100644
--- a/dom/xslt/xslt/txStylesheet.cpp
+++ b/dom/xslt/xslt/txStylesheet.cpp
@@ -4,6 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/FloatingPoint.h"
+#include "mozilla/Move.h"
#include "txStylesheet.h"
#include "txExpr.h"
@@ -15,6 +16,8 @@
#include "txKey.h"
#include "txXPathTreeWalker.h"
+using mozilla::Move;
+
txStylesheet::txStylesheet()
: mRootFrame(nullptr)
{
@@ -39,7 +42,7 @@ txStylesheet::init()
nt.forget();
- txPushNewContext* pushContext = new txPushNewContext(nodeExpr);
+ txPushNewContext* pushContext = new txPushNewContext(Move(nodeExpr));
mContainerTemplate->mNext = pushContext;
NS_ENSURE_TRUE(pushContext, NS_ERROR_OUT_OF_MEMORY);
@@ -68,7 +71,7 @@ txStylesheet::init()
nt.forget();
- mCharactersTemplate = new txValueOf(nodeExpr, false);
+ mCharactersTemplate = new txValueOf(Move(nodeExpr), false);
NS_ENSURE_TRUE(mCharactersTemplate, NS_ERROR_OUT_OF_MEMORY);
mCharactersTemplate->mNext = new txReturn();
@@ -400,10 +403,10 @@ txStylesheet::addTemplate(txTemplateItem* aTemplate,
// Add the simple patterns to the list of matchable templates, according
// to default priority
- nsAutoPtr simple = aTemplate->mMatch;
+ nsAutoPtr simple = Move(aTemplate->mMatch);
nsAutoPtr unionPattern;
if (simple->getType() == txPattern::UNION_PATTERN) {
- unionPattern = simple;
+ unionPattern = Move(simple);
simple = unionPattern->getSubPatternAt(0);
unionPattern->setSubPatternAt(0, nullptr);
}
@@ -428,7 +431,7 @@ txStylesheet::addTemplate(txTemplateItem* aTemplate,
NS_ENSURE_TRUE(nt, NS_ERROR_OUT_OF_MEMORY);
nt->mFirstInstruction = instr;
- nt->mMatch = simple;
+ nt->mMatch = Move(simple);
nt->mPriority = priority;
if (unionPattern) {
@@ -539,7 +542,8 @@ txStylesheet::addGlobalVariable(txVariableItem* aVariable)
return NS_OK;
}
nsAutoPtr var(
- new GlobalVariable(aVariable->mValue, aVariable->mFirstInstruction,
+ new GlobalVariable(Move(aVariable->mValue),
+ Move(aVariable->mFirstInstruction),
aVariable->mIsParam));
NS_ENSURE_TRUE(var, NS_ERROR_OUT_OF_MEMORY);
@@ -569,7 +573,7 @@ txStylesheet::addKey(const txExpandedName& aName,
return rv;
}
}
- if (!xslKey->addKey(aMatch, aUse)) {
+ if (!xslKey->addKey(Move(aMatch), Move(aUse))) {
return NS_ERROR_OUT_OF_MEMORY;
}
return NS_OK;
@@ -577,7 +581,7 @@ txStylesheet::addKey(const txExpandedName& aName,
nsresult
txStylesheet::addDecimalFormat(const txExpandedName& aName,
- nsAutoPtr aFormat)
+ nsAutoPtr&& aFormat)
{
txDecimalFormat* existing = mDecimalFormats.get(aName);
if (existing) {
@@ -603,9 +607,11 @@ txStylesheet::ImportFrame::~ImportFrame()
}
}
-txStylesheet::GlobalVariable::GlobalVariable(nsAutoPtr aExpr,
- nsAutoPtr aFirstInstruction,
+txStylesheet::GlobalVariable::GlobalVariable(nsAutoPtr&& aExpr,
+ nsAutoPtr&& aInstr,
bool aIsParam)
- : mExpr(aExpr), mFirstInstruction(aFirstInstruction), mIsParam(aIsParam)
+ : mExpr(Move(aExpr)),
+ mFirstInstruction(Move(aInstr)),
+ mIsParam(aIsParam)
{
}
diff --git a/dom/xslt/xslt/txStylesheet.h b/dom/xslt/xslt/txStylesheet.h
index 7e340cd1bc30..829bb6e4dd74 100644
--- a/dom/xslt/xslt/txStylesheet.h
+++ b/dom/xslt/xslt/txStylesheet.h
@@ -65,7 +65,7 @@ public:
* Add a decimal-format to the stylesheet
*/
nsresult addDecimalFormat(const txExpandedName& aName,
- nsAutoPtr aFormat);
+ nsAutoPtr&& aFormat);
struct MatchableTemplate {
txInstruction* mFirstInstruction;
@@ -96,8 +96,8 @@ public:
class GlobalVariable : public txObject {
public:
- GlobalVariable(nsAutoPtr aExpr,
- nsAutoPtr aFirstInstruction,
+ GlobalVariable(nsAutoPtr&& aExpr,
+ nsAutoPtr&& aFirstInstruction,
bool aIsParam);
nsAutoPtr mExpr;
diff --git a/dom/xslt/xslt/txStylesheetCompileHandlers.cpp b/dom/xslt/xslt/txStylesheetCompileHandlers.cpp
index 63da2e1f31c2..dc380543a783 100644
--- a/dom/xslt/xslt/txStylesheetCompileHandlers.cpp
+++ b/dom/xslt/xslt/txStylesheetCompileHandlers.cpp
@@ -5,6 +5,7 @@
#include "mozilla/ArrayUtils.h"
#include "mozilla/FloatingPoint.h"
+#include "mozilla/Move.h"
#include "txStylesheetCompiler.h"
#include "txStylesheetCompileHandlers.h"
@@ -114,7 +115,7 @@ parseUseAttrSets(txStylesheetAttr* aAttributes,
nsAutoPtr instr(new txInsertAttrSet(name));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
}
return NS_OK;
@@ -525,7 +526,7 @@ txFnStartLREStylesheet(int32_t aNamespaceID,
nsAutoPtr match(new txRootPattern());
NS_ENSURE_TRUE(match, NS_ERROR_OUT_OF_MEMORY);
- nsAutoPtr templ(new txTemplateItem(match, nullExpr,
+ nsAutoPtr templ(new txTemplateItem(Move(match), nullExpr,
nullExpr, prio));
NS_ENSURE_TRUE(templ, NS_ERROR_OUT_OF_MEMORY);
@@ -553,7 +554,7 @@ txFnEndLREStylesheet(txStylesheetCompilerState& aState)
nsAutoPtr instr(new txReturn());
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
aState.closeInstructionContainer();
@@ -659,7 +660,7 @@ txFnEndAttributeSet(txStylesheetCompilerState& aState)
nsAutoPtr instr(new txReturn());
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- nsresult rv = aState.addInstruction(instr);
+ nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
aState.closeInstructionContainer();
@@ -735,7 +736,7 @@ txFnStartDecimalFormat(int32_t aNamespaceID,
false, aState, format->mPatternSeparator);
NS_ENSURE_SUCCESS(rv, rv);
- rv = aState.mStylesheet->addDecimalFormat(name, format);
+ rv = aState.mStylesheet->addDecimalFormat(name, Move(format));
NS_ENSURE_SUCCESS(rv, rv);
return aState.pushHandlerTable(gTxIgnoreHandler);
@@ -847,7 +848,7 @@ txFnStartKey(int32_t aNamespaceID,
aState, use);
NS_ENSURE_SUCCESS(rv, rv);
- rv = aState.mStylesheet->addKey(name, match, use);
+ rv = aState.mStylesheet->addKey(name, Move(match), Move(use));
NS_ENSURE_SUCCESS(rv, rv);
return aState.pushHandlerTable(gTxIgnoreHandler);
@@ -1123,7 +1124,8 @@ txFnStartTemplate(int32_t aNamespaceID,
name.isNull(), aState, match);
NS_ENSURE_SUCCESS(rv, rv);
- nsAutoPtr templ(new txTemplateItem(match, name, mode, prio));
+ nsAutoPtr templ(new txTemplateItem(Move(match), name, mode,
+ prio));
NS_ENSURE_TRUE(templ, NS_ERROR_OUT_OF_MEMORY);
aState.openInstructionContainer(templ);
@@ -1143,7 +1145,7 @@ txFnEndTemplate(txStylesheetCompilerState& aState)
nsAutoPtr instr(new txReturn());
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- nsresult rv = aState.addInstruction(instr);
+ nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
aState.closeInstructionContainer();
@@ -1172,7 +1174,8 @@ txFnStartTopVariable(int32_t aNamespaceID,
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr var(
- new txVariableItem(name, select, aLocalName == nsGkAtoms::param));
+ new txVariableItem(name, Move(select),
+ aLocalName == nsGkAtoms::param));
NS_ENSURE_TRUE(var, NS_ERROR_OUT_OF_MEMORY);
aState.openInstructionContainer(var);
@@ -1217,7 +1220,7 @@ txFnEndTopVariable(txStylesheetCompilerState& aState)
nsAutoPtr instr(new txReturn());
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- nsresult rv = aState.addInstruction(instr);
+ nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
}
@@ -1276,7 +1279,7 @@ txFnStartLRE(int32_t aNamespaceID,
aLocalName, aPrefix));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
rv = parseExcludeResultPrefixes(aAttributes, aAttrCount, kNameSpaceID_XSLT);
@@ -1304,10 +1307,10 @@ txFnStartLRE(int32_t aNamespaceID,
NS_ENSURE_SUCCESS(rv, rv);
instr = new txLREAttribute(attr->mNamespaceID, attr->mLocalName,
- attr->mPrefix, avt);
+ attr->mPrefix, Move(avt));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
}
@@ -1320,7 +1323,7 @@ txFnEndLRE(txStylesheetCompilerState& aState)
nsAutoPtr instr(new txEndElement);
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- nsresult rv = aState.addInstruction(instr);
+ nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@@ -1339,7 +1342,7 @@ txFnText(const nsAString& aStr, txStylesheetCompilerState& aState)
nsAutoPtr instr(new txText(aStr, false));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- nsresult rv = aState.addInstruction(instr);
+ nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@@ -1364,13 +1367,13 @@ txFnStartApplyImports(int32_t aNamespaceID,
nsAutoPtr instr(new txApplyImportsStart);
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
instr = new txApplyImportsEnd;
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return aState.pushHandlerTable(gTxIgnoreHandler);
@@ -1407,7 +1410,7 @@ txFnStartApplyTemplates(int32_t aNamespaceID,
nsAutoPtr instr(new txPushParams);
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
txExpandedName mode;
@@ -1439,7 +1442,7 @@ txFnStartApplyTemplates(int32_t aNamespaceID,
nt.forget();
}
- nsAutoPtr pushcontext(new txPushNewContext(select));
+ nsAutoPtr pushcontext( new txPushNewContext(Move(select)));
NS_ENSURE_TRUE(pushcontext, NS_ERROR_OUT_OF_MEMORY);
rv = aState.pushSorter(pushcontext);
@@ -1461,7 +1464,7 @@ txFnEndApplyTemplates(txStylesheetCompilerState& aState)
txPushNewContext* pushcontext =
static_cast(aState.popObject());
nsAutoPtr instr(pushcontext); // txPushNewContext
- nsresult rv = aState.addInstruction(instr);
+ nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
aState.popSorter();
@@ -1470,18 +1473,18 @@ txFnEndApplyTemplates(txStylesheetCompilerState& aState)
nsAutoPtr loop(new txLoopNodeSet(instr));
NS_ENSURE_TRUE(loop, NS_ERROR_OUT_OF_MEMORY);
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
instr = loop.forget();
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
instr = new txPopParams;
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
pushcontext->mBailTarget = instr;
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@@ -1507,7 +1510,7 @@ txFnStartAttribute(int32_t aNamespaceID,
nsAutoPtr instr(new txPushStringHandler(true));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr name;
@@ -1520,7 +1523,8 @@ txFnStartAttribute(int32_t aNamespaceID,
aState, nspace);
NS_ENSURE_SUCCESS(rv, rv);
- instr = new txAttribute(name, nspace, aState.mElementContext->mMappings);
+ instr = new txAttribute(Move(name), Move(nspace),
+ aState.mElementContext->mMappings);
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
rv = aState.pushObject(instr);
@@ -1539,7 +1543,7 @@ txFnEndAttribute(txStylesheetCompilerState& aState)
aState.popHandlerTable();
nsAutoPtr instr(static_cast
(aState.popObject()));
- nsresult rv = aState.addInstruction(instr);
+ nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@@ -1566,7 +1570,7 @@ txFnStartCallTemplate(int32_t aNamespaceID,
nsAutoPtr instr(new txPushParams);
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
txExpandedName name;
@@ -1592,13 +1596,13 @@ txFnEndCallTemplate(txStylesheetCompilerState& aState)
// txCallTemplate
nsAutoPtr instr(static_cast(aState.popObject()));
- nsresult rv = aState.addInstruction(instr);
+ nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
instr = new txPopParams;
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@@ -1667,7 +1671,7 @@ txFnStartComment(int32_t aNamespaceID,
nsAutoPtr instr(new txPushStringHandler(true));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- nsresult rv = aState.addInstruction(instr);
+ nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@@ -1679,7 +1683,7 @@ txFnEndComment(txStylesheetCompilerState& aState)
nsAutoPtr instr(new txComment);
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- nsresult rv = aState.addInstruction(instr);
+ nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@@ -1709,7 +1713,7 @@ txFnStartCopy(int32_t aNamespaceID,
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr instr(copy.forget());
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
rv = parseUseAttrSets(aAttributes, aAttrCount, false, aState);
@@ -1724,7 +1728,7 @@ txFnEndCopy(txStylesheetCompilerState& aState)
nsAutoPtr instr(new txEndElement);
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- nsresult rv = aState.addInstruction(instr);
+ nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
txCopy* copy = static_cast(aState.popPtr(aState.eCopy));
@@ -1754,10 +1758,10 @@ txFnStartCopyOf(int32_t aNamespaceID,
aState, select);
NS_ENSURE_SUCCESS(rv, rv);
- nsAutoPtr instr(new txCopyOf(select));
+ nsAutoPtr instr(new txCopyOf(Move(select)));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return aState.pushHandlerTable(gTxIgnoreHandler);
@@ -1799,10 +1803,11 @@ txFnStartElement(int32_t aNamespaceID,
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr instr(
- new txStartElement(name, nspace, aState.mElementContext->mMappings));
+ new txStartElement(Move(name), Move(nspace),
+ aState.mElementContext->mMappings));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
rv = parseUseAttrSets(aAttributes, aAttrCount, false, aState);
@@ -1817,7 +1822,7 @@ txFnEndElement(txStylesheetCompilerState& aState)
nsAutoPtr instr(new txEndElement);
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- nsresult rv = aState.addInstruction(instr);
+ nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@@ -1875,7 +1880,7 @@ txFnStartForEach(int32_t aNamespaceID,
aState, select);
NS_ENSURE_SUCCESS(rv, rv);
- nsAutoPtr pushcontext(new txPushNewContext(select));
+ nsAutoPtr pushcontext(new txPushNewContext(Move(select)));
NS_ENSURE_TRUE(pushcontext, NS_ERROR_OUT_OF_MEMORY);
rv = aState.pushPtr(pushcontext, aState.ePushNewContext);
@@ -1885,7 +1890,7 @@ txFnStartForEach(int32_t aNamespaceID,
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr instr(pushcontext.forget());
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
instr = new txPushNullTemplateRule;
@@ -1894,7 +1899,7 @@ txFnStartForEach(int32_t aNamespaceID,
rv = aState.pushPtr(instr, aState.ePushNullTemplateRule);
NS_ENSURE_SUCCESS(rv, rv);
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return aState.pushHandlerTable(gTxForEachHandler);
@@ -1910,7 +1915,7 @@ txFnEndForEach(txStylesheetCompilerState& aState)
static_cast(aState.popPtr(aState.ePushNullTemplateRule));
nsAutoPtr instr(new txLoopNodeSet(pnullrule));
- nsresult rv = aState.addInstruction(instr);
+ nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
aState.popSorter();
@@ -1967,14 +1972,15 @@ txFnStartIf(int32_t aNamespaceID,
aState, test);
NS_ENSURE_SUCCESS(rv, rv);
- nsAutoPtr condGoto(new txConditionalGoto(test, nullptr));
+ nsAutoPtr condGoto(new txConditionalGoto(Move(test),
+ nullptr));
NS_ENSURE_TRUE(condGoto, NS_ERROR_OUT_OF_MEMORY);
rv = aState.pushPtr(condGoto, aState.eConditionalGoto);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr instr(condGoto.forget());
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@@ -2006,7 +2012,7 @@ txFnStartMessage(int32_t aNamespaceID,
nsAutoPtr instr(new txPushStringHandler(false));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- nsresult rv = aState.addInstruction(instr);
+ nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
txThreeState term;
@@ -2029,7 +2035,7 @@ static nsresult
txFnEndMessage(txStylesheetCompilerState& aState)
{
nsAutoPtr instr(static_cast(aState.popObject()));
- nsresult rv = aState.addInstruction(instr);
+ nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@@ -2106,12 +2112,13 @@ txFnStartNumber(int32_t aNamespaceID,
false, aState, groupingSize);
NS_ENSURE_SUCCESS(rv, rv);
- nsAutoPtr instr(new txNumber(level, count, from, value,
- format,groupingSeparator,
- groupingSize));
+ nsAutoPtr instr(new txNumber(level, Move(count), Move(from),
+ Move(value), Move(format),
+ Move(groupingSeparator),
+ Move(groupingSize)));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return aState.pushHandlerTable(gTxIgnoreHandler);
@@ -2181,7 +2188,7 @@ txFnStartParam(int32_t aNamespaceID,
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr instr(checkParam.forget());
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr select;
@@ -2189,7 +2196,7 @@ txFnStartParam(int32_t aNamespaceID,
aState, select);
NS_ENSURE_SUCCESS(rv, rv);
- nsAutoPtr var(new txSetVariable(name, select));
+ nsAutoPtr var(new txSetVariable(name, Move(select)));
NS_ENSURE_TRUE(var, NS_ERROR_OUT_OF_MEMORY);
if (var->mValue) {
@@ -2230,7 +2237,7 @@ txFnEndParam(txStylesheetCompilerState& aState)
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr instr(var.forget());
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
txCheckParam* checkParam =
@@ -2258,7 +2265,7 @@ txFnStartPI(int32_t aNamespaceID,
nsAutoPtr instr(new txPushStringHandler(true));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- nsresult rv = aState.addInstruction(instr);
+ nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr name;
@@ -2266,7 +2273,7 @@ txFnStartPI(int32_t aNamespaceID,
aState, name);
NS_ENSURE_SUCCESS(rv, rv);
- instr = new txProcessingInstruction(name);
+ instr = new txProcessingInstruction(Move(name));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
rv = aState.pushObject(instr);
@@ -2282,7 +2289,7 @@ txFnEndPI(txStylesheetCompilerState& aState)
{
nsAutoPtr instr(static_cast
(aState.popObject()));
- nsresult rv = aState.addInstruction(instr);
+ nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@@ -2339,7 +2346,8 @@ txFnStartSort(int32_t aNamespaceID,
aState, caseOrder);
NS_ENSURE_SUCCESS(rv, rv);
- rv = aState.mSorter->addSort(select, lang, dataType, order, caseOrder);
+ rv = aState.mSorter->addSort(Move(select), Move(lang), Move(dataType),
+ Move(order), Move(caseOrder));
NS_ENSURE_SUCCESS(rv, rv);
return aState.pushHandlerTable(gTxIgnoreHandler);
@@ -2394,7 +2402,7 @@ txFnTextText(const nsAString& aStr, txStylesheetCompilerState& aState)
nsAutoPtr instr(new txText(aStr, aState.mDOE));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- nsresult rv = aState.addInstruction(instr);
+ nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@@ -2426,10 +2434,10 @@ txFnStartValueOf(int32_t aNamespaceID,
aState, select);
NS_ENSURE_SUCCESS(rv, rv);
- nsAutoPtr instr(new txValueOf(select, doe == eTrue));
+ nsAutoPtr instr(new txValueOf(Move(select), doe == eTrue));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return aState.pushHandlerTable(gTxIgnoreHandler);
@@ -2469,7 +2477,7 @@ txFnStartVariable(int32_t aNamespaceID,
aState, select);
NS_ENSURE_SUCCESS(rv, rv);
- nsAutoPtr var(new txSetVariable(name, select));
+ nsAutoPtr var(new txSetVariable(name, Move(select)));
NS_ENSURE_TRUE(var, NS_ERROR_OUT_OF_MEMORY);
if (var->mValue) {
@@ -2511,7 +2519,7 @@ txFnEndVariable(txStylesheetCompilerState& aState)
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr instr(var.forget());
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@@ -2528,7 +2536,7 @@ txFnStartElementStartRTF(int32_t aNamespaceID,
nsAutoPtr instr(new txPushRTFHandler);
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- nsresult rv = aState.addInstruction(instr);
+ nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
aState.mHandlerTable = gTxTemplateHandler;
@@ -2544,7 +2552,7 @@ txFnTextStartRTF(const nsAString& aStr, txStylesheetCompilerState& aState)
nsAutoPtr instr(new txPushRTFHandler);
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- nsresult rv = aState.addInstruction(instr);
+ nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
aState.mHandlerTable = gTxTemplateHandler;
@@ -2572,14 +2580,15 @@ txFnStartWhen(int32_t aNamespaceID,
aState, test);
NS_ENSURE_SUCCESS(rv, rv);
- nsAutoPtr condGoto(new txConditionalGoto(test, nullptr));
+ nsAutoPtr condGoto(new txConditionalGoto(Move(test),
+ nullptr));
NS_ENSURE_TRUE(condGoto, NS_ERROR_OUT_OF_MEMORY);
rv = aState.pushPtr(condGoto, aState.eConditionalGoto);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr instr(condGoto.forget());
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return aState.pushHandlerTable(gTxTemplateHandler);
@@ -2596,7 +2605,7 @@ txFnEndWhen(txStylesheetCompilerState& aState)
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr instr(gotoinstr.forget());
- rv = aState.addInstruction(instr);
+ rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
txConditionalGoto* condGoto =
@@ -2634,7 +2643,7 @@ txFnStartWithParam(int32_t aNamespaceID,
aState, select);
NS_ENSURE_SUCCESS(rv, rv);
- nsAutoPtr var(new txSetParam(name, select));
+ nsAutoPtr var(new txSetParam(name, Move(select)));
NS_ENSURE_TRUE(var, NS_ERROR_OUT_OF_MEMORY);
if (var->mValue) {
@@ -2671,7 +2680,7 @@ txFnEndWithParam(txStylesheetCompilerState& aState)
}
nsAutoPtr instr(var.forget());
- nsresult rv = aState.addInstruction(instr);
+ nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@@ -2713,7 +2722,7 @@ txFnEndUnknownInstruction(txStylesheetCompilerState& aState)
nsAutoPtr instr(new txErrorInstruction());
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- nsresult rv = aState.addInstruction(instr);
+ nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
}
diff --git a/dom/xslt/xslt/txStylesheetCompiler.cpp b/dom/xslt/xslt/txStylesheetCompiler.cpp
index b23e1b6be733..b53e9ee0d533 100644
--- a/dom/xslt/xslt/txStylesheetCompiler.cpp
+++ b/dom/xslt/xslt/txStylesheetCompiler.cpp
@@ -4,6 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/ArrayUtils.h"
+#include "mozilla/Move.h"
#include "txStylesheetCompiler.h"
#include "txStylesheetCompileHandlers.h"
@@ -336,7 +337,7 @@ txStylesheetCompiler::endElement()
nsAutoPtr instr(new txRemoveVariable(var->mName));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
- rv = addInstruction(instr);
+ rv = addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
mInScopeVariables.RemoveElementAt(i);
@@ -484,7 +485,7 @@ txStylesheetCompiler::ensureNewElementContext()
NS_ENSURE_SUCCESS(rv, rv);
mElementContext.forget();
- mElementContext = context;
+ mElementContext = Move(context);
return NS_OK;
}
@@ -723,7 +724,7 @@ txStylesheetCompilerState::closeInstructionContainer()
}
nsresult
-txStylesheetCompilerState::addInstruction(nsAutoPtr aInstruction)
+txStylesheetCompilerState::addInstruction(nsAutoPtr&& aInstruction)
{
NS_PRECONDITION(mNextInstrPtr, "adding instruction outside container");
diff --git a/dom/xslt/xslt/txStylesheetCompiler.h b/dom/xslt/xslt/txStylesheetCompiler.h
index 4e8d5ed2c63d..ac385e6b24aa 100644
--- a/dom/xslt/xslt/txStylesheetCompiler.h
+++ b/dom/xslt/xslt/txStylesheetCompiler.h
@@ -111,7 +111,7 @@ public:
nsresult addToplevelItem(txToplevelItem* aItem);
nsresult openInstructionContainer(txInstructionContainer* aContainer);
void closeInstructionContainer();
- nsresult addInstruction(nsAutoPtr aInstruction);
+ nsresult addInstruction(nsAutoPtr&& aInstruction);
nsresult loadIncludedStylesheet(const nsAString& aURI);
nsresult loadImportedStylesheet(const nsAString& aURI,
txStylesheet::ImportFrame* aFrame);
diff --git a/dom/xslt/xslt/txToplevelItems.cpp b/dom/xslt/xslt/txToplevelItems.cpp
index a039dc16ef8e..f3737e2851ce 100644
--- a/dom/xslt/xslt/txToplevelItems.cpp
+++ b/dom/xslt/xslt/txToplevelItems.cpp
@@ -4,10 +4,14 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "txToplevelItems.h"
+
+#include "mozilla/Move.h"
#include "txStylesheet.h"
#include "txInstructions.h"
#include "txXSLTPatterns.h"
+using mozilla::Move;
+
TX_IMPL_GETTYPE(txAttributeSetItem, txToplevelItem::attributeSet)
TX_IMPL_GETTYPE(txImportItem, txToplevelItem::import)
TX_IMPL_GETTYPE(txOutputItem, txToplevelItem::output)
@@ -35,18 +39,20 @@ txStripSpaceItem::addStripSpaceTest(txStripSpaceTest* aStripSpaceTest)
TX_IMPL_GETTYPE(txTemplateItem, txToplevelItem::templ)
-txTemplateItem::txTemplateItem(nsAutoPtr aMatch,
+txTemplateItem::txTemplateItem(nsAutoPtr&& aMatch,
const txExpandedName& aName,
const txExpandedName& aMode, double aPrio)
- : mMatch(aMatch), mName(aName), mMode(aMode), mPrio(aPrio)
+ : mMatch(Move(aMatch)), mName(aName),
+ mMode(aMode), mPrio(aPrio)
{
}
TX_IMPL_GETTYPE(txVariableItem, txToplevelItem::variable)
txVariableItem::txVariableItem(const txExpandedName& aName,
- nsAutoPtr aValue,
+ nsAutoPtr&& aValue,
bool aIsParam)
- : mName(aName), mValue(aValue), mIsParam(aIsParam)
+ : mName(aName), mValue(Move(aValue)),
+ mIsParam(aIsParam)
{
}
diff --git a/dom/xslt/xslt/txToplevelItems.h b/dom/xslt/xslt/txToplevelItems.h
index 9b69564b8445..361e9066be59 100644
--- a/dom/xslt/xslt/txToplevelItems.h
+++ b/dom/xslt/xslt/txToplevelItems.h
@@ -107,7 +107,7 @@ public:
class txTemplateItem : public txInstructionContainer
{
public:
- txTemplateItem(nsAutoPtr aMatch, const txExpandedName& aName,
+ txTemplateItem(nsAutoPtr&& aMatch, const txExpandedName& aName,
const txExpandedName& aMode, double aPrio);
TX_DECL_TOPLEVELITEM
@@ -122,7 +122,7 @@ public:
class txVariableItem : public txInstructionContainer
{
public:
- txVariableItem(const txExpandedName& aName, nsAutoPtr aValue,
+ txVariableItem(const txExpandedName& aName, nsAutoPtr&& aValue,
bool aIsParam);
TX_DECL_TOPLEVELITEM
diff --git a/dom/xslt/xslt/txUnknownHandler.cpp b/dom/xslt/xslt/txUnknownHandler.cpp
index 70d0ca8d93ee..2771d9069fe1 100644
--- a/dom/xslt/xslt/txUnknownHandler.cpp
+++ b/dom/xslt/xslt/txUnknownHandler.cpp
@@ -4,11 +4,15 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "txUnknownHandler.h"
+
+#include "mozilla/Move.h"
#include "txExecutionState.h"
#include "txStringUtils.h"
#include "txStylesheet.h"
#include "nsGkAtoms.h"
+using mozilla::Move;
+
txUnknownHandler::txUnknownHandler(txExecutionState* aEs)
: mEs(aEs),
mFlushed(false)
@@ -192,6 +196,6 @@ nsresult txUnknownHandler::createHandlerAndFlush(bool aHTMLRoot,
// Let go of out buffer as soon as we're done flushing it, we're not going
// to need it anymore from this point on (all hooks get forwarded to
// mEs->mResultHandler.
- nsAutoPtr buffer(mBuffer);
+ nsAutoPtr buffer(Move(mBuffer));
return buffer->flushToHandler(mEs->mResultHandler);
}
diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp
index d0da89507bf1..d2813cfd4b87 100644
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -8,6 +8,7 @@
#include "mozilla/ArrayUtils.h"
#include "mozilla/DebugOnly.h"
+#include "mozilla/Move.h"
#include "nsCSSParser.h"
#include "nsCSSProps.h"
@@ -3575,7 +3576,7 @@ CSSParserImpl::ParsePageRule(RuleAppendFunc aAppendFunc, void* aData)
}
// Takes ownership of declaration.
- nsRefPtr rule = new nsCSSPageRule(declaration);
+ nsRefPtr rule = new nsCSSPageRule(Move(declaration));
(*aAppendFunc)(rule, aData);
return true;
@@ -3599,7 +3600,7 @@ CSSParserImpl::ParseKeyframeRule()
// Takes ownership of declaration, and steals contents of selectorList.
nsRefPtr rule =
- new nsCSSKeyframeRule(selectorList, declaration);
+ new nsCSSKeyframeRule(selectorList, Move(declaration));
return rule.forget();
}
diff --git a/layout/style/nsCSSRules.h b/layout/style/nsCSSRules.h
index 1c47062ae247..c9af6f2f3bcf 100644
--- a/layout/style/nsCSSRules.h
+++ b/layout/style/nsCSSRules.h
@@ -10,6 +10,7 @@
#define nsCSSRules_h_
#include "mozilla/Attributes.h"
+#include "mozilla/Move.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/css/GroupRule.h"
@@ -421,8 +422,8 @@ class nsCSSKeyframeRule MOZ_FINAL : public mozilla::css::Rule,
public:
// WARNING: Steals the contents of aKeys *and* aDeclaration
nsCSSKeyframeRule(InfallibleTArray& aKeys,
- nsAutoPtr aDeclaration)
- : mDeclaration(aDeclaration)
+ nsAutoPtr&& aDeclaration)
+ : mDeclaration(mozilla::Move(aDeclaration))
{
mKeys.SwapElements(aKeys);
}
@@ -548,8 +549,8 @@ class nsCSSPageRule MOZ_FINAL : public mozilla::css::Rule,
{
public:
// WARNING: Steals the contents of aDeclaration
- nsCSSPageRule(nsAutoPtr aDeclaration)
- : mDeclaration(aDeclaration),
+ nsCSSPageRule(nsAutoPtr&& aDeclaration)
+ : mDeclaration(mozilla::Move(aDeclaration)),
mImportantRule(nullptr)
{
}
diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp
index 1d83cbf2132a..751fd593eff6 100644
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -2203,7 +2203,7 @@ nsHttpChannel::ProcessPartialContent()
if (NS_FAILED(rv)) return rv;
// make the cached response be the current response
- mResponseHead = mCachedResponseHead;
+ mResponseHead = Move(mCachedResponseHead);
UpdateInhibitPersistentCachingFlag();
@@ -2334,7 +2334,7 @@ nsHttpChannel::ProcessNotModified()
if (NS_FAILED(rv)) return rv;
// make the cached response be the current response
- mResponseHead = mCachedResponseHead;
+ mResponseHead = Move(mCachedResponseHead);
UpdateInhibitPersistentCachingFlag();
@@ -3536,7 +3536,7 @@ nsHttpChannel::ReadFromCache(bool alreadyMarkedValid)
"Using cached copy of: %s\n", this, mSpec.get()));
if (mCachedResponseHead)
- mResponseHead = mCachedResponseHead;
+ mResponseHead = Move(mCachedResponseHead);
UpdateInhibitPersistentCachingFlag();
@@ -5156,7 +5156,7 @@ nsHttpChannel::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult st
}
else if (contentLength != int64_t(-1) && contentLength != size) {
LOG((" concurrent cache entry write has been interrupted"));
- mCachedResponseHead = mResponseHead;
+ mCachedResponseHead = Move(mResponseHead);
rv = MaybeSetupByteRangeRequest(size, contentLength);
if (NS_SUCCEEDED(rv) && mIsPartialRequest) {
// Prevent read from cache again
diff --git a/xpcom/base/nsAutoPtr.h b/xpcom/base/nsAutoPtr.h
index 32cb8b1f80df..d54bf4623222 100644
--- a/xpcom/base/nsAutoPtr.h
+++ b/xpcom/base/nsAutoPtr.h
@@ -118,6 +118,12 @@ public:
return *this;
}
+ nsAutoPtr& operator=(nsAutoPtr&& aRhs)
+ {
+ assign(aRhs.forget());
+ return *this;
+ }
+
// Other pointer operators
T*
diff --git a/xpcom/glue/nsClassHashtable.h b/xpcom/glue/nsClassHashtable.h
index efc6e7487532..21ac3e8f3537 100644
--- a/xpcom/glue/nsClassHashtable.h
+++ b/xpcom/glue/nsClassHashtable.h
@@ -6,6 +6,7 @@
#ifndef nsClassHashtable_h__
#define nsClassHashtable_h__
+#include "mozilla/Move.h"
#include "nsBaseHashtable.h"
#include "nsHashKeys.h"
#include "nsAutoPtr.h"
@@ -109,7 +110,7 @@ nsClassHashtable::RemoveAndForget(KeyType aKey, nsAutoPtr &aOut)
return;
// Transfer ownership from ent->mData into aOut.
- aOut = ent->mData;
+ aOut = mozilla::Move(ent->mData);
this->Remove(aKey);
}