bug 1004746 - part 1 - Remove a bunch of usage of nsAutoPtr's copy ctor r=froydnj

This commit is contained in:
Trevor Saunders 2014-05-07 18:05:37 -04:00
parent 23c1664fb7
commit 42ad93c2a2
26 changed files with 238 additions and 183 deletions

View File

@ -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<nsFormSubmission> submission = mPendingSubmission;
nsAutoPtr<nsFormSubmission> submission = Move(mPendingSubmission);
SubmitSubmission(submission);
}

View File

@ -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:

View File

@ -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<nsSMILInterval> interval(mCurrentInterval);
nsAutoPtr<nsSMILInterval> interval(mozilla::Move(mCurrentInterval));
interval->Unlink();
}
}

View File

@ -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<nsIDOMDocument> 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;
}

View File

@ -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<Expr>& aExpression,
nsXPathExpression::nsXPathExpression(nsAutoPtr<Expr>&& aExpression,
txResultRecycler* aRecycler,
nsIDOMDocument *aDocument)
: mExpression(aExpression),
: mExpression(Move(aExpression)),
mRecycler(aRecycler),
mDocument(aDocument)
{

View File

@ -24,7 +24,7 @@ class nsXPathExpression MOZ_FINAL : public nsIDOMXPathExpression,
public nsIDOMNSXPathExpression
{
public:
nsXPathExpression(nsAutoPtr<Expr>& aExpression, txResultRecycler* aRecycler,
nsXPathExpression(nsAutoPtr<Expr>&& aExpression, txResultRecycler* aRecycler,
nsIDOMDocument *aDocument);
// nsISupports interface

View File

@ -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<Token*>(ops.peek()))) {
// can't use expr as argument due to order of evaluation
nsAutoPtr<Expr> left(static_cast<Expr*>(exprs.pop()));
nsAutoPtr<Expr> right(expr);
nsAutoPtr<Expr> right(Move(expr));
rv = createBinaryExpr(left, right,
static_cast<Token*>(ops.pop()),
getter_Transfers(expr));
@ -330,7 +333,7 @@ txExprParser::createExpr(txExprLexer& lexer, txIParseContext* aContext,
while (NS_SUCCEEDED(rv) && !exprs.isEmpty()) {
nsAutoPtr<Expr> left(static_cast<Expr*>(exprs.pop()));
nsAutoPtr<Expr> right(expr);
nsAutoPtr<Expr> right(Move(expr));
rv = createBinaryExpr(left, right, static_cast<Token*>(ops.pop()),
getter_Transfers(expr));
}

View File

@ -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<Expr> aName, nsAutoPtr<Expr> aNamespace,
txAttribute::txAttribute(nsAutoPtr<Expr>&& aName, nsAutoPtr<Expr>&& 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<Expr> aCondition,
txConditionalGoto::txConditionalGoto(nsAutoPtr<Expr>&& 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<Expr> aSelect)
: mSelect(aSelect)
txCopyOf::txCopyOf(nsAutoPtr<Expr>&& aSelect)
: mSelect(Move(aSelect))
{
}
@ -486,11 +486,11 @@ txLoopNodeSet::execute(txExecutionState& aEs)
}
txLREAttribute::txLREAttribute(int32_t aNamespaceID, nsIAtom* aLocalName,
nsIAtom* aPrefix, nsAutoPtr<Expr> aValue)
nsIAtom* aPrefix, nsAutoPtr<Expr>&& 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<txPattern> aCount,
nsAutoPtr<txPattern> aFrom, nsAutoPtr<Expr> aValue,
nsAutoPtr<Expr> aFormat, nsAutoPtr<Expr> aGroupingSeparator,
nsAutoPtr<Expr> aGroupingSize)
: mLevel(aLevel), mCount(aCount), mFrom(aFrom), mValue(aValue),
mFormat(aFormat), mGroupingSeparator(aGroupingSeparator),
mGroupingSize(aGroupingSize)
txNumber::txNumber(txXSLTNumber::LevelType aLevel,
nsAutoPtr<txPattern>&& aCount, nsAutoPtr<txPattern>&& aFrom,
nsAutoPtr<Expr>&& aValue, nsAutoPtr<Expr>&& aFormat,
nsAutoPtr<Expr>&& aGroupingSeparator,
nsAutoPtr<Expr>&& 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<Expr> aName)
: mName(aName)
txProcessingInstruction::txProcessingInstruction(nsAutoPtr<Expr>&& aName)
: mName(Move(aName))
{
}
@ -599,8 +603,8 @@ txProcessingInstruction::execute(txExecutionState& aEs)
return aEs.mResultHandler->processingInstruction(name, handler->mValue);
}
txPushNewContext::txPushNewContext(nsAutoPtr<Expr> aSelect)
: mSelect(aSelect), mBailTarget(nullptr)
txPushNewContext::txPushNewContext(nsAutoPtr<Expr>&& aSelect)
: mSelect(Move(aSelect)), mBailTarget(nullptr)
{
}
@ -660,19 +664,19 @@ txPushNewContext::execute(txExecutionState& aEs)
}
nsresult
txPushNewContext::addSort(nsAutoPtr<Expr> aSelectExpr,
nsAutoPtr<Expr> aLangExpr,
nsAutoPtr<Expr> aDataTypeExpr,
nsAutoPtr<Expr> aOrderExpr,
nsAutoPtr<Expr> aCaseOrderExpr)
txPushNewContext::addSort(nsAutoPtr<Expr>&& aSelectExpr,
nsAutoPtr<Expr>&& aLangExpr,
nsAutoPtr<Expr>&& aDataTypeExpr,
nsAutoPtr<Expr>&& aOrderExpr,
nsAutoPtr<Expr>&& 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<Expr> aValue)
: mName(aName), mValue(aValue)
txSetParam::txSetParam(const txExpandedName& aName, nsAutoPtr<Expr>&& aValue)
: mName(aName), mValue(Move(aValue))
{
}
@ -782,8 +786,8 @@ txSetParam::execute(txExecutionState& aEs)
}
txSetVariable::txSetVariable(const txExpandedName& aName,
nsAutoPtr<Expr> aValue)
: mName(aName), mValue(aValue)
nsAutoPtr<Expr>&& aValue)
: mName(aName), mValue(Move(aValue))
{
}
@ -806,11 +810,11 @@ txSetVariable::execute(txExecutionState& aEs)
return aEs.bindVariable(mName, exprRes);
}
txStartElement::txStartElement(nsAutoPtr<Expr> aName,
nsAutoPtr<Expr> aNamespace,
txStartElement::txStartElement(nsAutoPtr<Expr>&& aName,
nsAutoPtr<Expr>&& 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<Expr> aExpr, bool aDOE)
: mExpr(aExpr),
txValueOf::txValueOf(nsAutoPtr<Expr>&& aExpr, bool aDOE)
: mExpr(Move(aExpr)),
mDOE(aDOE)
{
}

View File

@ -71,7 +71,7 @@ public:
class txAttribute : public txInstruction
{
public:
txAttribute(nsAutoPtr<Expr> aName, nsAutoPtr<Expr> aNamespace,
txAttribute(nsAutoPtr<Expr>&& aName, nsAutoPtr<Expr>&& aNamespace,
txNamespaceMap* aMappings);
TX_DECL_TXINSTRUCTION
@ -105,7 +105,7 @@ public:
class txConditionalGoto : public txInstruction
{
public:
txConditionalGoto(nsAutoPtr<Expr> aCondition, txInstruction* aTarget);
txConditionalGoto(nsAutoPtr<Expr>&& aCondition, txInstruction* aTarget);
TX_DECL_TXINSTRUCTION
@ -138,7 +138,7 @@ public:
class txCopyOf : public txCopyBase
{
public:
txCopyOf(nsAutoPtr<Expr> aSelect);
txCopyOf(nsAutoPtr<Expr>&& aSelect);
TX_DECL_TXINSTRUCTION
@ -191,7 +191,7 @@ class txLREAttribute : public txInstruction
{
public:
txLREAttribute(int32_t aNamespaceID, nsIAtom* aLocalName,
nsIAtom* aPrefix, nsAutoPtr<Expr> aValue);
nsIAtom* aPrefix, nsAutoPtr<Expr>&& aValue);
TX_DECL_TXINSTRUCTION
@ -215,10 +215,10 @@ public:
class txNumber : public txInstruction
{
public:
txNumber(txXSLTNumber::LevelType aLevel, nsAutoPtr<txPattern> aCount,
nsAutoPtr<txPattern> aFrom, nsAutoPtr<Expr> aValue,
nsAutoPtr<Expr> aFormat, nsAutoPtr<Expr> aGroupingSeparator,
nsAutoPtr<Expr> aGroupingSize);
txNumber(txXSLTNumber::LevelType aLevel, nsAutoPtr<txPattern>&& aCount,
nsAutoPtr<txPattern>&& aFrom, nsAutoPtr<Expr>&& aValue,
nsAutoPtr<Expr>&& aFormat, nsAutoPtr<Expr>&& aGroupingSeparator,
nsAutoPtr<Expr>&& aGroupingSize);
TX_DECL_TXINSTRUCTION
@ -240,7 +240,7 @@ public:
class txProcessingInstruction : public txInstruction
{
public:
txProcessingInstruction(nsAutoPtr<Expr> aName);
txProcessingInstruction(nsAutoPtr<Expr>&& aName);
TX_DECL_TXINSTRUCTION
@ -250,15 +250,17 @@ public:
class txPushNewContext : public txInstruction
{
public:
txPushNewContext(nsAutoPtr<Expr> aSelect);
txPushNewContext(nsAutoPtr<Expr>&& aSelect);
~txPushNewContext();
TX_DECL_TXINSTRUCTION
nsresult addSort(nsAutoPtr<Expr> aSelectExpr, nsAutoPtr<Expr> aLangExpr,
nsAutoPtr<Expr> aDataTypeExpr, nsAutoPtr<Expr> aOrderExpr,
nsAutoPtr<Expr> aCaseOrderExpr);
nsresult addSort(nsAutoPtr<Expr>&& aSelectExpr,
nsAutoPtr<Expr>&& aLangExpr,
nsAutoPtr<Expr>&& aDataTypeExpr,
nsAutoPtr<Expr>&& aOrderExpr,
nsAutoPtr<Expr>&& aCaseOrderExpr);
struct SortKey {
nsAutoPtr<Expr> mSelectExpr;
@ -320,7 +322,7 @@ public:
class txSetParam : public txInstruction
{
public:
txSetParam(const txExpandedName& aName, nsAutoPtr<Expr> aValue);
txSetParam(const txExpandedName& aName, nsAutoPtr<Expr>&& aValue);
TX_DECL_TXINSTRUCTION
@ -331,7 +333,7 @@ public:
class txSetVariable : public txInstruction
{
public:
txSetVariable(const txExpandedName& aName, nsAutoPtr<Expr> aValue);
txSetVariable(const txExpandedName& aName, nsAutoPtr<Expr>&& aValue);
TX_DECL_TXINSTRUCTION
@ -342,7 +344,7 @@ public:
class txStartElement : public txInstruction
{
public:
txStartElement(nsAutoPtr<Expr> aName, nsAutoPtr<Expr> aNamespace,
txStartElement(nsAutoPtr<Expr>&& aName, nsAutoPtr<Expr>&& aNamespace,
txNamespaceMap* aMappings);
TX_DECL_TXINSTRUCTION
@ -380,7 +382,7 @@ public:
class txValueOf : public txInstruction
{
public:
txValueOf(nsAutoPtr<Expr> aExpr, bool aDOE);
txValueOf(nsAutoPtr<Expr>&& aExpr, bool aDOE);
TX_DECL_TXINSTRUCTION

View File

@ -120,7 +120,7 @@ public:
* @param aUse use-expression
* @return false if an error occurred, true otherwise
*/
bool addKey(nsAutoPtr<txPattern> aMatch, nsAutoPtr<Expr> aUse);
bool addKey(nsAutoPtr<txPattern>&& aMatch, nsAutoPtr<Expr>&& aUse);
/**
* Indexes a subtree and adds it to the hash of key values

View File

@ -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<txPattern> aMatch, nsAutoPtr<Expr> aUse)
bool txXSLKey::addKey(nsAutoPtr<txPattern>&& aMatch, nsAutoPtr<Expr>&& aUse)
{
if (!aMatch || !aUse)
return false;
@ -260,8 +261,8 @@ bool txXSLKey::addKey(nsAutoPtr<txPattern> aMatch, nsAutoPtr<Expr> aUse)
if (!key)
return false;
key->matchPattern = aMatch;
key->useExpr = aUse;
key->matchPattern = Move(aMatch);
key->useExpr = Move(aUse);
return true;
}

View File

@ -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<txResultBuffer>& aBuffer)
using mozilla::Move;
txResultTreeFragment::txResultTreeFragment(nsAutoPtr<txResultBuffer>&& 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);

View File

@ -14,7 +14,7 @@
class txResultTreeFragment : public txAExprResult
{
public:
txResultTreeFragment(nsAutoPtr<txResultBuffer>& aBuffer);
txResultTreeFragment(nsAutoPtr<txResultBuffer>&& aBuffer);
TX_DECL_EXPRRESULT

View File

@ -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<txPattern> simple = aTemplate->mMatch;
nsAutoPtr<txPattern> simple = Move(aTemplate->mMatch);
nsAutoPtr<txPattern> 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<GlobalVariable> 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<txDecimalFormat> aFormat)
nsAutoPtr<txDecimalFormat>&& aFormat)
{
txDecimalFormat* existing = mDecimalFormats.get(aName);
if (existing) {
@ -603,9 +607,11 @@ txStylesheet::ImportFrame::~ImportFrame()
}
}
txStylesheet::GlobalVariable::GlobalVariable(nsAutoPtr<Expr> aExpr,
nsAutoPtr<txInstruction> aFirstInstruction,
txStylesheet::GlobalVariable::GlobalVariable(nsAutoPtr<Expr>&& aExpr,
nsAutoPtr<txInstruction>&& aInstr,
bool aIsParam)
: mExpr(aExpr), mFirstInstruction(aFirstInstruction), mIsParam(aIsParam)
: mExpr(Move(aExpr)),
mFirstInstruction(Move(aInstr)),
mIsParam(aIsParam)
{
}

View File

@ -65,7 +65,7 @@ public:
* Add a decimal-format to the stylesheet
*/
nsresult addDecimalFormat(const txExpandedName& aName,
nsAutoPtr<txDecimalFormat> aFormat);
nsAutoPtr<txDecimalFormat>&& aFormat);
struct MatchableTemplate {
txInstruction* mFirstInstruction;
@ -96,8 +96,8 @@ public:
class GlobalVariable : public txObject {
public:
GlobalVariable(nsAutoPtr<Expr> aExpr,
nsAutoPtr<txInstruction> aFirstInstruction,
GlobalVariable(nsAutoPtr<Expr>&& aExpr,
nsAutoPtr<txInstruction>&& aFirstInstruction,
bool aIsParam);
nsAutoPtr<Expr> mExpr;

View File

@ -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<txInstruction> 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<txPattern> match(new txRootPattern());
NS_ENSURE_TRUE(match, NS_ERROR_OUT_OF_MEMORY);
nsAutoPtr<txTemplateItem> templ(new txTemplateItem(match, nullExpr,
nsAutoPtr<txTemplateItem> 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<txInstruction> 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<txInstruction> 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<txTemplateItem> templ(new txTemplateItem(match, name, mode, prio));
nsAutoPtr<txTemplateItem> 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<txInstruction> 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<txVariableItem> 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<txInstruction> 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<txInstruction> 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<txInstruction> 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<txInstruction> 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<txInstruction> 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<txPushNewContext> pushcontext(new txPushNewContext(select));
nsAutoPtr<txPushNewContext> 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<txPushNewContext*>(aState.popObject());
nsAutoPtr<txInstruction> 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<txLoopNodeSet> 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<txInstruction> 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<Expr> 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<txInstruction> instr(static_cast<txInstruction*>
(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<txInstruction> 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<txInstruction> instr(static_cast<txInstruction*>(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<txInstruction> 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<txInstruction> 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<txInstruction> 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<txInstruction> 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<txCopy*>(aState.popPtr(aState.eCopy));
@ -1754,10 +1758,10 @@ txFnStartCopyOf(int32_t aNamespaceID,
aState, select);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(new txCopyOf(select));
nsAutoPtr<txInstruction> 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<txInstruction> 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<txInstruction> 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<txPushNewContext> pushcontext(new txPushNewContext(select));
nsAutoPtr<txPushNewContext> 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<txInstruction> 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<txInstruction*>(aState.popPtr(aState.ePushNullTemplateRule));
nsAutoPtr<txInstruction> 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<txConditionalGoto> condGoto(new txConditionalGoto(test, nullptr));
nsAutoPtr<txConditionalGoto> 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<txInstruction> 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<txInstruction> 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<txInstruction> instr(static_cast<txInstruction*>(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<txInstruction> instr(new txNumber(level, count, from, value,
format,groupingSeparator,
groupingSize));
nsAutoPtr<txInstruction> 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<txInstruction> instr(checkParam.forget());
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<Expr> select;
@ -2189,7 +2196,7 @@ txFnStartParam(int32_t aNamespaceID,
aState, select);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txSetVariable> var(new txSetVariable(name, select));
nsAutoPtr<txSetVariable> 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<txInstruction> 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<txInstruction> 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<Expr> 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<txInstruction> instr(static_cast<txInstruction*>
(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<txInstruction> 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<txInstruction> instr(new txValueOf(select, doe == eTrue));
nsAutoPtr<txInstruction> 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<txSetVariable> var(new txSetVariable(name, select));
nsAutoPtr<txSetVariable> 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<txInstruction> 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<txInstruction> 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<txInstruction> 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<txConditionalGoto> condGoto(new txConditionalGoto(test, nullptr));
nsAutoPtr<txConditionalGoto> 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<txInstruction> 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<txInstruction> 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<txSetParam> var(new txSetParam(name, select));
nsAutoPtr<txSetParam> 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<txInstruction> 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<txInstruction> 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);
}

View File

@ -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<txInstruction> 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<txInstruction> aInstruction)
txStylesheetCompilerState::addInstruction(nsAutoPtr<txInstruction>&& aInstruction)
{
NS_PRECONDITION(mNextInstrPtr, "adding instruction outside container");

View File

@ -111,7 +111,7 @@ public:
nsresult addToplevelItem(txToplevelItem* aItem);
nsresult openInstructionContainer(txInstructionContainer* aContainer);
void closeInstructionContainer();
nsresult addInstruction(nsAutoPtr<txInstruction> aInstruction);
nsresult addInstruction(nsAutoPtr<txInstruction>&& aInstruction);
nsresult loadIncludedStylesheet(const nsAString& aURI);
nsresult loadImportedStylesheet(const nsAString& aURI,
txStylesheet::ImportFrame* aFrame);

View File

@ -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<txPattern> aMatch,
txTemplateItem::txTemplateItem(nsAutoPtr<txPattern>&& 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<Expr> aValue,
nsAutoPtr<Expr>&& aValue,
bool aIsParam)
: mName(aName), mValue(aValue), mIsParam(aIsParam)
: mName(aName), mValue(Move(aValue)),
mIsParam(aIsParam)
{
}

View File

@ -107,7 +107,7 @@ public:
class txTemplateItem : public txInstructionContainer
{
public:
txTemplateItem(nsAutoPtr<txPattern> aMatch, const txExpandedName& aName,
txTemplateItem(nsAutoPtr<txPattern>&& 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<Expr> aValue,
txVariableItem(const txExpandedName& aName, nsAutoPtr<Expr>&& aValue,
bool aIsParam);
TX_DECL_TOPLEVELITEM

View File

@ -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<txResultBuffer> buffer(mBuffer);
nsAutoPtr<txResultBuffer> buffer(Move(mBuffer));
return buffer->flushToHandler(mEs->mResultHandler);
}

View File

@ -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<nsCSSPageRule> rule = new nsCSSPageRule(declaration);
nsRefPtr<nsCSSPageRule> 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<nsCSSKeyframeRule> rule =
new nsCSSKeyframeRule(selectorList, declaration);
new nsCSSKeyframeRule(selectorList, Move(declaration));
return rule.forget();
}

View File

@ -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<float>& aKeys,
nsAutoPtr<mozilla::css::Declaration> aDeclaration)
: mDeclaration(aDeclaration)
nsAutoPtr<mozilla::css::Declaration>&& 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<mozilla::css::Declaration> aDeclaration)
: mDeclaration(aDeclaration),
nsCSSPageRule(nsAutoPtr<mozilla::css::Declaration>&& aDeclaration)
: mDeclaration(mozilla::Move(aDeclaration)),
mImportantRule(nullptr)
{
}

View File

@ -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

View File

@ -118,6 +118,12 @@ public:
return *this;
}
nsAutoPtr<T>& operator=(nsAutoPtr<T>&& aRhs)
{
assign(aRhs.forget());
return *this;
}
// Other pointer operators
T*

View File

@ -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<KeyClass,T>::RemoveAndForget(KeyType aKey, nsAutoPtr<T> &aOut)
return;
// Transfer ownership from ent->mData into aOut.
aOut = ent->mData;
aOut = mozilla::Move(ent->mData);
this->Remove(aKey);
}