diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2011-08-04 14:19:26 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-08-11 10:35:35 +0200 |
commit | 89b694ea15e46461aef5e1695e820582152c67c5 (patch) | |
tree | d94adedcc28c7562ffb1a95989aa6b22b1d376e5 /src/declarative/qml/v8/qjsvalue_p.h | |
parent | 038619bf2c5e7d2c18a6f463cd994d8b3831e61f (diff) |
Replace QScriptBagContainer by QIntrusiveList
QIntrusiveList effectively does the same as
QScriptBagContainer, without the need to inherit a
Node class. Let's avoid the code duplication.
However, QIntrusiveList::remove() and insert()
are less strict than QScriptBagContainer; introduce
QScriptIntrusiveList that performs the same sanity
checks (no duplicate insertion, etc). Ideally these
checks would be merged into QIntrusiveList.
Also rename QJSValuePrivate::reinitialize() to
invalidate(), and make it not call
engine->unregisterValue(this) any more. Values are
only invalidated at engine destruction time, and
it's the engine's responsibility to erase the list.
Change-Id: I60fc61ee8f90a716a285b1dd1bf4d6a08a9349df
Reviewed-on: http://codereview.qt.nokia.com/2628
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Diffstat (limited to 'src/declarative/qml/v8/qjsvalue_p.h')
-rw-r--r-- | src/declarative/qml/v8/qjsvalue_p.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/declarative/qml/v8/qjsvalue_p.h b/src/declarative/qml/v8/qjsvalue_p.h index b50f573b5c..09cd38b0bf 100644 --- a/src/declarative/qml/v8/qjsvalue_p.h +++ b/src/declarative/qml/v8/qjsvalue_p.h @@ -43,7 +43,7 @@ #include <QtCore/qvarlengtharray.h> #include <qdebug.h> -#include "qscripttools_p.h" +#include <private/qintrusivelist_p.h> #include "qscriptshareddata_p.h" #include "qjsvalue.h" @@ -57,7 +57,6 @@ class QV8Engine; */ class QJSValuePrivate : public QSharedData - , public QScriptLinkedNode { public: inline QJSValuePrivate(); @@ -81,7 +80,7 @@ public: inline QJSValuePrivate(QV8Engine *engine, const QString& value); inline QJSValuePrivate(QV8Engine *engine, QJSValue::SpecialValue value); inline QJSValuePrivate(QV8Engine *engine, v8::Handle<v8::Value>); - inline void reinitialize(); + inline void invalidate(); inline bool toBool() const; inline double toNumber() const; @@ -148,6 +147,7 @@ public: inline operator v8::Handle<v8::Object>() const; inline v8::Handle<v8::Value> asV8Value(QV8Engine *engine); private: + QIntrusiveListNode m_node; QV8Engine *m_engine; // Please, update class documentation when you change the enum. @@ -183,6 +183,8 @@ private: inline bool isNumberBased() const; inline bool isStringBased() const; inline bool prepareArgumentsForCall(v8::Handle<v8::Value> argv[], const QJSValueList& arguments) const; + + friend class QV8Engine; }; QT_END_NAMESPACE |