зеркало из 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;
|
nsresult rv;
|
||||||
if (!mRecycler) {
|
if (!mRecycler) {
|
||||||
nsRefPtr<txResultRecycler> recycler = new txResultRecycler;
|
mRecycler = new txResultRecycler;
|
||||||
NS_ENSURE_TRUE(recycler, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
|
|
||||||
rv = recycler->init();
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
mRecycler = recycler;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocument);
|
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocument);
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
#include "txNodeSet.h"
|
#include "txNodeSet.h"
|
||||||
|
|
||||||
txResultRecycler::txResultRecycler()
|
txResultRecycler::txResultRecycler()
|
||||||
: mEmptyStringResult(nullptr),
|
: mEmptyStringResult(new StringResult(nullptr)),
|
||||||
mTrueResult(nullptr),
|
mTrueResult(new BooleanResult(true)),
|
||||||
mFalseResult(nullptr)
|
mFalseResult(new BooleanResult(false))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,34 +28,6 @@ txResultRecycler::~txResultRecycler()
|
||||||
while (numberIter.hasNext()) {
|
while (numberIter.hasNext()) {
|
||||||
delete static_cast<NumberResult*>(numberIter.next());
|
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__
|
#define txResultRecycler_h__
|
||||||
|
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
#include "nsAutoPtr.h"
|
||||||
#include "txStack.h"
|
#include "txStack.h"
|
||||||
|
|
||||||
class txAExprResult;
|
class txAExprResult;
|
||||||
|
@ -21,7 +22,6 @@ class txResultRecycler
|
||||||
public:
|
public:
|
||||||
txResultRecycler();
|
txResultRecycler();
|
||||||
~txResultRecycler();
|
~txResultRecycler();
|
||||||
nsresult init();
|
|
||||||
|
|
||||||
void AddRef()
|
void AddRef()
|
||||||
{
|
{
|
||||||
|
@ -72,9 +72,9 @@ private:
|
||||||
txStack mStringResults;
|
txStack mStringResults;
|
||||||
txStack mNodeSetResults;
|
txStack mNodeSetResults;
|
||||||
txStack mNumberResults;
|
txStack mNumberResults;
|
||||||
StringResult* mEmptyStringResult;
|
nsRefPtr<StringResult> mEmptyStringResult;
|
||||||
BooleanResult* mTrueResult;
|
nsRefPtr<BooleanResult> mTrueResult;
|
||||||
BooleanResult* mFalseResult;
|
nsRefPtr<BooleanResult> mFalseResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //txResultRecycler_h__
|
#endif //txResultRecycler_h__
|
||||||
|
|
|
@ -80,11 +80,6 @@ txXPathOptimizer::optimize(Expr* aInExpr, Expr** aOutExpr)
|
||||||
if (exprType != Expr::LITERAL_EXPR &&
|
if (exprType != Expr::LITERAL_EXPR &&
|
||||||
!aInExpr->isSensitiveTo(Expr::ANY_CONTEXT)) {
|
!aInExpr->isSensitiveTo(Expr::ANY_CONTEXT)) {
|
||||||
nsRefPtr<txResultRecycler> recycler = new txResultRecycler;
|
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);
|
txEarlyEvalContext context(recycler);
|
||||||
nsRefPtr<txAExprResult> exprRes;
|
nsRefPtr<txAExprResult> exprRes;
|
||||||
|
|
||||||
|
|
|
@ -125,10 +125,6 @@ txExecutionState::init(const txXPathNode& aNode,
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
mRecycler = new txResultRecycler;
|
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
|
// The actual value here doesn't really matter since noone should use this
|
||||||
// value. But lets put something errorlike in just in case
|
// value. But lets put something errorlike in just in case
|
||||||
|
|
|
@ -470,10 +470,6 @@ txMozillaXSLTProcessor::AddXSLTParam(const nsString& aName,
|
||||||
|
|
||||||
if (!mRecycler) {
|
if (!mRecycler) {
|
||||||
mRecycler = new txResultRecycler;
|
mRecycler = new txResultRecycler;
|
||||||
NS_ENSURE_TRUE(mRecycler, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
|
|
||||||
rv = mRecycler->init();
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
txXSLTParamContext paramContext(&mParamNamespaceMap, *contextNode,
|
txXSLTParamContext paramContext(&mParamNamespaceMap, *contextNode,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче