зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1029104 - Convert XPathExpression to WebIDL bindings, remove txResultRecycler::init. r=bz.
--HG-- extra : rebase_source : 3c2f6f86c2e34c7ec32a22eb4f1a90e77d05cdfa
This commit is contained in:
Родитель
ee27f5d05f
Коммит
0fe9268fa3
|
@ -110,13 +110,7 @@ XPathEvaluator::CreateExpression(const nsAString & aExpression,
|
|||
{
|
||||
nsresult rv;
|
||||
if (!mRecycler) {
|
||||
nsRefPtr<txResultRecycler> recycler = new txResultRecycler;
|
||||
NS_ENSURE_TRUE(recycler, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
rv = recycler->init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mRecycler = recycler;
|
||||
mRecycler = new txResultRecycler;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocument);
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
#include "txNodeSet.h"
|
||||
|
||||
txResultRecycler::txResultRecycler()
|
||||
: mEmptyStringResult(nullptr),
|
||||
mTrueResult(nullptr),
|
||||
mFalseResult(nullptr)
|
||||
: mEmptyStringResult(new StringResult(nullptr)),
|
||||
mTrueResult(new BooleanResult(true)),
|
||||
mFalseResult(new BooleanResult(false))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -28,34 +28,6 @@ txResultRecycler::~txResultRecycler()
|
|||
while (numberIter.hasNext()) {
|
||||
delete static_cast<NumberResult*>(numberIter.next());
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(mEmptyStringResult);
|
||||
NS_IF_RELEASE(mTrueResult);
|
||||
NS_IF_RELEASE(mFalseResult);
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
txResultRecycler::init()
|
||||
{
|
||||
NS_ASSERTION(!mEmptyStringResult && !mTrueResult && !mFalseResult,
|
||||
"Already inited");
|
||||
mEmptyStringResult = new StringResult(nullptr);
|
||||
NS_ENSURE_TRUE(mEmptyStringResult, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(mEmptyStringResult);
|
||||
|
||||
mTrueResult = new BooleanResult(true);
|
||||
NS_ENSURE_TRUE(mTrueResult, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(mTrueResult);
|
||||
|
||||
mFalseResult = new BooleanResult(false);
|
||||
NS_ENSURE_TRUE(mFalseResult, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(mFalseResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#define txResultRecycler_h__
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "txStack.h"
|
||||
|
||||
class txAExprResult;
|
||||
|
@ -21,7 +22,6 @@ class txResultRecycler
|
|||
public:
|
||||
txResultRecycler();
|
||||
~txResultRecycler();
|
||||
nsresult init();
|
||||
|
||||
void AddRef()
|
||||
{
|
||||
|
@ -72,9 +72,9 @@ private:
|
|||
txStack mStringResults;
|
||||
txStack mNodeSetResults;
|
||||
txStack mNumberResults;
|
||||
StringResult* mEmptyStringResult;
|
||||
BooleanResult* mTrueResult;
|
||||
BooleanResult* mFalseResult;
|
||||
nsRefPtr<StringResult> mEmptyStringResult;
|
||||
nsRefPtr<BooleanResult> mTrueResult;
|
||||
nsRefPtr<BooleanResult> mFalseResult;
|
||||
};
|
||||
|
||||
#endif //txResultRecycler_h__
|
||||
|
|
|
@ -80,11 +80,6 @@ txXPathOptimizer::optimize(Expr* aInExpr, Expr** aOutExpr)
|
|||
if (exprType != Expr::LITERAL_EXPR &&
|
||||
!aInExpr->isSensitiveTo(Expr::ANY_CONTEXT)) {
|
||||
nsRefPtr<txResultRecycler> recycler = new txResultRecycler;
|
||||
NS_ENSURE_TRUE(recycler, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
rv = recycler->init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
txEarlyEvalContext context(recycler);
|
||||
nsRefPtr<txAExprResult> exprRes;
|
||||
|
||||
|
|
|
@ -125,10 +125,6 @@ txExecutionState::init(const txXPathNode& aNode,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mRecycler = new txResultRecycler;
|
||||
NS_ENSURE_TRUE(mRecycler, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
rv = mRecycler->init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// The actual value here doesn't really matter since noone should use this
|
||||
// value. But lets put something errorlike in just in case
|
||||
|
|
|
@ -470,10 +470,6 @@ txMozillaXSLTProcessor::AddXSLTParam(const nsString& aName,
|
|||
|
||||
if (!mRecycler) {
|
||||
mRecycler = new txResultRecycler;
|
||||
NS_ENSURE_TRUE(mRecycler, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
rv = mRecycler->init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
txXSLTParamContext paramContext(&mParamNamespaceMap, *contextNode,
|
||||
|
|
Загрузка…
Ссылка в новой задаче