diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-10-22 14:47:04 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-10-23 10:18:24 (GMT) |
commit | 36d365458d54c6168c8003f7348e932e3a4ffc2c (patch) | |
tree | 18fbb941678c7c7bd7a58d122df64a4b238f67ce /src/script | |
parent | 4d318525c9663a46d36b27605143dab3250d2b9b (diff) | |
download | Qt-36d365458d54c6168c8003f7348e932e3a4ffc2c.zip Qt-36d365458d54c6168c8003f7348e932e3a4ffc2c.tar.gz Qt-36d365458d54c6168c8003f7348e932e3a4ffc2c.tar.bz2 |
Inline internal QtScript object delegate functions
Makes QScriptValue::scriptClass() 20% faster.
Reviewed-by: Olivier Goffart
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/bridge/qscriptclassobject.cpp | 11 | ||||
-rw-r--r-- | src/script/bridge/qscriptclassobject_p.h | 15 | ||||
-rw-r--r-- | src/script/bridge/qscriptobject.cpp | 16 | ||||
-rw-r--r-- | src/script/bridge/qscriptobject_p.h | 20 |
4 files changed, 31 insertions, 31 deletions
diff --git a/src/script/bridge/qscriptclassobject.cpp b/src/script/bridge/qscriptclassobject.cpp index 0d88532..1dde98b 100644 --- a/src/script/bridge/qscriptclassobject.cpp +++ b/src/script/bridge/qscriptclassobject.cpp @@ -70,17 +70,6 @@ ClassObjectDelegate::~ClassObjectDelegate() { } -QScriptClass *ClassObjectDelegate::scriptClass() const -{ - return m_scriptClass; -} - -void ClassObjectDelegate::setScriptClass(QScriptClass *scriptClass) -{ - Q_ASSERT(scriptClass != 0); - m_scriptClass = scriptClass; -} - QScriptObjectDelegate::Type ClassObjectDelegate::type() const { return ClassObject; diff --git a/src/script/bridge/qscriptclassobject_p.h b/src/script/bridge/qscriptclassobject_p.h index f5cce76..9b34244 100644 --- a/src/script/bridge/qscriptclassobject_p.h +++ b/src/script/bridge/qscriptclassobject_p.h @@ -70,8 +70,8 @@ public: ClassObjectDelegate(QScriptClass *scriptClass); ~ClassObjectDelegate(); - QScriptClass *scriptClass() const; - void setScriptClass(QScriptClass *scriptClass); + inline QScriptClass *scriptClass() const; + inline void setScriptClass(QScriptClass *scriptClass); virtual Type type() const; @@ -105,6 +105,17 @@ private: QScriptClass *m_scriptClass; }; +inline QScriptClass *ClassObjectDelegate::scriptClass() const +{ + return m_scriptClass; +} + +inline void ClassObjectDelegate::setScriptClass(QScriptClass *scriptClass) +{ + Q_ASSERT(scriptClass != 0); + m_scriptClass = scriptClass; +} + } // namespace QScript QT_END_NAMESPACE diff --git a/src/script/bridge/qscriptobject.cpp b/src/script/bridge/qscriptobject.cpp index 55644fe..4808c7c 100644 --- a/src/script/bridge/qscriptobject.cpp +++ b/src/script/bridge/qscriptobject.cpp @@ -84,22 +84,6 @@ void QScriptObject::setData(JSC::JSValue data) d->data = data; } -QScriptObjectDelegate *QScriptObject::delegate() const -{ - if (!d) - return 0; - return d->delegate; -} - -void QScriptObject::setDelegate(QScriptObjectDelegate *delegate) -{ - if (!d) - d = new Data(); - else - delete d->delegate; - d->delegate = delegate; -} - bool QScriptObject::getOwnPropertySlot(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::PropertySlot& slot) diff --git a/src/script/bridge/qscriptobject_p.h b/src/script/bridge/qscriptobject_p.h index c1cee31..1170709 100644 --- a/src/script/bridge/qscriptobject_p.h +++ b/src/script/bridge/qscriptobject_p.h @@ -107,8 +107,8 @@ public: JSC::JSValue data() const; void setData(JSC::JSValue data); - QScriptObjectDelegate *delegate() const; - void setDelegate(QScriptObjectDelegate *delegate); + inline QScriptObjectDelegate *delegate() const; + inline void setDelegate(QScriptObjectDelegate *delegate); protected: Data *d; @@ -158,6 +158,22 @@ private: Q_DISABLE_COPY(QScriptObjectDelegate) }; +inline QScriptObjectDelegate *QScriptObject::delegate() const +{ + if (!d) + return 0; + return d->delegate; +} + +inline void QScriptObject::setDelegate(QScriptObjectDelegate *delegate) +{ + if (!d) + d = new Data(); + else + delete d->delegate; + d->delegate = delegate; +} + QT_END_NAMESPACE #endif |