diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-07-31 13:27:33 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-07-31 14:11:48 (GMT) |
commit | 31263060c53597bfc7677ccc526cc8a19f62b387 (patch) | |
tree | 07c4d434d902c0bbf31c0233718ac043d1f686b6 /src/script/api/qscriptengine.cpp | |
parent | 701303d374b7da33166744d290ec4dbc789c7031 (diff) | |
download | Qt-31263060c53597bfc7677ccc526cc8a19f62b387.zip Qt-31263060c53597bfc7677ccc526cc8a19f62b387.tar.gz Qt-31263060c53597bfc7677ccc526cc8a19f62b387.tar.bz2 |
Remove QScriptContextPrivate, QScriptContext is now a JSC::CallFrame
There will not be instances of QScriptContext anymore. Pointer to
QScriptContext are just pointer to JSC::CallFrame
This simplifies the code as we do not need to manage the memory for the
QScriptContext anymore.
It is compatible because it is not possible to create
QScriptContext. They were all created by QScriptEngine.
QScriptContext constructor is private.
Aknoweldged-by: Kent
Diffstat (limited to 'src/script/api/qscriptengine.cpp')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 92793a4..f80c605 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -490,7 +490,7 @@ QString qtStringFromJSCUString(const JSC::UString &str) return QString(reinterpret_cast<const QChar*>(str.data()), str.size()); } -QScriptEnginePrivate *scriptEngineFromExec(JSC::ExecState *exec) +QScriptEnginePrivate *scriptEngineFromExec(const JSC::ExecState *exec) { return static_cast<GlobalClientData*>(exec->globalData().clientData)->engine; } @@ -1120,25 +1120,11 @@ void QScriptEnginePrivate::setDefaultPrototype(int metaTypeId, JSC::JSValue prot QScriptContext *QScriptEnginePrivate::contextForFrame(JSC::ExecState *frame) { - QHash<JSC::ExecState*, QScriptContext*>::const_iterator it; - it = contextForFrameHash.constFind(frame); - if (it != contextForFrameHash.constEnd()) - return it.value(); - // ### use a pool of context objects - QScriptContext *ctx = QScriptContextPrivate::create(frame, this); - contextForFrameHash.insert(frame, ctx); - return ctx; + return reinterpret_cast<QScriptContext *>(frame); } void QScriptEnginePrivate::releaseContextForFrame(JSC::ExecState *frame) { - QHash<JSC::ExecState*, QScriptContext*>::iterator it; - it = contextForFrameHash.find(frame); - Q_ASSERT(it != contextForFrameHash.end()); - QScriptContext *ctx = it.value(); - contextForFrameHash.erase(it); - // ### put back in pool - delete ctx; } JSC::JSGlobalObject *QScriptEnginePrivate::originalGlobalObject() const |