From ef178f4d7d7545920bf8dbc8f43d571ffd9ddf09 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 7 Aug 2009 16:20:30 +1000 Subject: Remove unused parameters --- src/declarative/qml/qmlbasicscript.cpp | 48 +++------------------------------- src/declarative/qml/qmlbasicscript_p.h | 5 +--- src/declarative/qml/qmlexpression.cpp | 18 +++---------- src/declarative/qml/qmlexpression_p.h | 3 +-- 4 files changed, 9 insertions(+), 65 deletions(-) diff --git a/src/declarative/qml/qmlbasicscript.cpp b/src/declarative/qml/qmlbasicscript.cpp index ca137c7..5800f71 100644 --- a/src/declarative/qml/qmlbasicscript.cpp +++ b/src/declarative/qml/qmlbasicscript.cpp @@ -243,12 +243,7 @@ struct QmlBasicScriptCompiler To see if the QmlBasicScript engine can handle a binding, call compile() and check the return value, or isValid() afterwards. - To evaluate the binding, the QmlBasicScript instance needs some memory in - which to cache state. This may be allocated by calling newScriptState() - and destroyed by calling deleteScriptState(). The state data is then passed - to the run() method when evaluating the binding. - - To further accelerate binding, QmlBasicScript can return a precompiled + To accelerate binding, QmlBasicScript can return a precompiled version of itself that can be saved for future use. Call compileData() to get an opaque pointer to the compiled state, and compileDataSize() for the size of this data in bytes. This data can be saved and passed to future @@ -320,22 +315,6 @@ void QmlBasicScript::clear() } /*! - Return the script state memory for this script instance. This memory should - only be destroyed by calling deleteScriptState(). - */ -void *QmlBasicScript::newScriptState() -{ - return 0; -} - -/*! - Delete the \a data previously allocated by newScriptState(). - */ -void QmlBasicScript::deleteScriptState(void *) -{ -} - -/*! Dump the script instructions to stderr for debugging. */ void QmlBasicScript::dump() @@ -635,23 +614,10 @@ bool QmlBasicScriptCompiler::compileBinaryExpression(AST::Node *node) } /*! - \enum QmlBasicScript::CacheState - \value NoChange The query has not change. Any previous monitoring is still - valid. - \value Incremental The query has been incrementally changed. Any previous - monitoring is still valid, but needs to have the fresh properties added to - it. - \value Reset The entire query has been reset from the beginning. Any previous - monitoring is now invalid. -*/ - -/*! - Run the script in \a context and return the result. \a voidCache should - contain state memory previously acquired from newScript. + Run the script in \a context and return the result. */ -QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *cached) +QVariant QmlBasicScript::run(QmlContext *context) { - Q_UNUSED(voidCache); if (!isValid()) return QVariant(); @@ -660,8 +626,6 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c QStack stack; - CacheState state = NoChange; - for (int idx = 0; idx < d->instructionCount; ++idx) { const ScriptInstruction &instr = d->instructions()[idx]; @@ -671,7 +635,6 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c stack.push(QVariant::fromValue(contextPrivate->idValues[instr.fetch.idx].data())); enginePrivate->capturedProperties << QmlEnginePrivate::CapturedProperty(context, -1, contextPrivate->notifyIndex + instr.fetch.idx); - state = Reset; } break; @@ -683,7 +646,6 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c if (obj && instr.constant.notify != 0) enginePrivate->capturedProperties << QmlEnginePrivate::CapturedProperty(obj, instr.constant.idx, instr.constant.notify); - state = Reset; } break; @@ -695,7 +657,6 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c if (obj && instr.constant.notify != 0) enginePrivate->capturedProperties << QmlEnginePrivate::CapturedProperty(obj, instr.constant.idx, instr.constant.notify); - state = Reset; } break; @@ -708,7 +669,6 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c if (obj && instr.constant.notify != 0) enginePrivate->capturedProperties << QmlEnginePrivate::CapturedProperty(obj, instr.constant.idx, instr.constant.notify); - state = Reset; } break; @@ -733,8 +693,6 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c } } - *cached = Reset; - if (stack.isEmpty()) return QVariant(); else diff --git a/src/declarative/qml/qmlbasicscript_p.h b/src/declarative/qml/qmlbasicscript_p.h index 539227f..152dbe5c 100644 --- a/src/declarative/qml/qmlbasicscript_p.h +++ b/src/declarative/qml/qmlbasicscript_p.h @@ -95,11 +95,8 @@ public: void clear(); void dump(); - void *newScriptState(); - void deleteScriptState(void *); - enum CacheState { NoChange, Incremental, Reset }; - QVariant run(QmlContext *, void *, CacheState *); + QVariant run(QmlContext *); private: int flags; diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp index a9175ea..da8b59f 100644 --- a/src/declarative/qml/qmlexpression.cpp +++ b/src/declarative/qml/qmlexpression.cpp @@ -51,7 +51,7 @@ Q_DECLARE_METATYPE(QList); QT_BEGIN_NAMESPACE QmlExpressionPrivate::QmlExpressionPrivate() -: nextExpression(0), prevExpression(0), ctxt(0), expressionFunctionValid(false), expressionRewritten(false), sseData(0), me(0), trackChange(true), line(-1), guardList(0), guardListLength(0) +: nextExpression(0), prevExpression(0), ctxt(0), expressionFunctionValid(false), expressionRewritten(false), me(0), trackChange(true), line(-1), guardList(0), guardListLength(0) { } @@ -101,8 +101,6 @@ void QmlExpressionPrivate::init(QmlContext *ctxt, void *expr, QmlRefCount *rc, QmlExpressionPrivate::~QmlExpressionPrivate() { - sse.deleteScriptState(sseData); - sseData = 0; if (guardList) { delete [] guardList; guardList = 0; } } @@ -215,10 +213,6 @@ void QmlExpression::clearExpression() void QmlExpression::setExpression(const QString &expression) { Q_D(QmlExpression); - if (d->sseData) { - d->sse.deleteScriptState(d->sseData); - d->sseData = 0; - } d->clearGuards(); @@ -230,7 +224,7 @@ void QmlExpression::setExpression(const QString &expression) d->sse.clear(); } -QVariant QmlExpressionPrivate::evalSSE(QmlBasicScript::CacheState &cacheState) +QVariant QmlExpressionPrivate::evalSSE() { #ifdef Q_ENABLE_PERFORMANCE_LOG QFxPerfTimer perfsse; @@ -240,9 +234,7 @@ QVariant QmlExpressionPrivate::evalSSE(QmlBasicScript::CacheState &cacheState) if (me) ctxtPriv->defaultObjects.insert(ctxtPriv->highPriorityCount , me); - if (!sseData) - sseData = sse.newScriptState(); - QVariant rv = sse.run(ctxt, sseData, &cacheState); + QVariant rv = sse.run(ctxt); if (me) ctxtPriv->defaultObjects.removeAt(ctxtPriv->highPriorityCount); @@ -367,8 +359,6 @@ QVariant QmlExpression::value() QFxPerfTimer perf; #endif - QmlBasicScript::CacheState cacheState = QmlBasicScript::Reset; - QmlEnginePrivate *ep = QmlEnginePrivate::get(engine()); QmlExpression *lastCurrentExpression = ep->currentExpression; @@ -378,7 +368,7 @@ QVariant QmlExpression::value() ep->currentExpression = this; if (d->sse.isValid()) { - rv = d->evalSSE(cacheState); + rv = d->evalSSE(); } else { rv = d->evalQtScript(); } diff --git a/src/declarative/qml/qmlexpression_p.h b/src/declarative/qml/qmlexpression_p.h index f607898..bf95c0e0 100644 --- a/src/declarative/qml/qmlexpression_p.h +++ b/src/declarative/qml/qmlexpression_p.h @@ -89,14 +89,13 @@ public: QScriptValue expressionFunction; QmlBasicScript sse; - void *sseData; QObject *me; bool trackChange; QString fileName; int line; - QVariant evalSSE(QmlBasicScript::CacheState &cacheState); + QVariant evalSSE(); QVariant evalQtScript(); struct SignalGuard : public QGuard { -- cgit v0.12