diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2011-10-10 13:52:34 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-12 01:31:11 +0200 |
commit | 0466acb02740b5dbf3254d6445186b4d3ccd0699 (patch) | |
tree | a1b7314c2faae73cf93403afdc7ca92f2106d70d /src/declarative/qml/v8/qv8bindings_p.h | |
parent | 3422d4adda7480a44a063ab86447c2fe2792fe02 (diff) |
Optimize signal handling
Bindings connect to lots of signals that are never emitted. By managing
signal connection lists ourselves, we can do a much better job than Qt's
generic signal/slot connection logic.
Also, by connecting to QDeclarativeNotifierEndpoint's rather than QObject
slots, we can eliminate the need to instantiate a QObject for the V4 and
V8 binding managers.
Change-Id: I598667deaefdbd2860227bd74378a1b196761686
Reviewed-on: http://codereview.qt-project.org/6278
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Sanity-Review: Aaron Kennedy <aaron.kennedy@nokia.com>
Diffstat (limited to 'src/declarative/qml/v8/qv8bindings_p.h')
-rw-r--r-- | src/declarative/qml/v8/qv8bindings_p.h | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/src/declarative/qml/v8/qv8bindings_p.h b/src/declarative/qml/v8/qv8bindings_p.h index b387a50df3..3b3aed269b 100644 --- a/src/declarative/qml/v8/qv8bindings_p.h +++ b/src/declarative/qml/v8/qv8bindings_p.h @@ -64,8 +64,7 @@ QT_BEGIN_NAMESPACE class QDeclarativeCompiledData; class QV8BindingsPrivate; -class QV8Bindings : public QObject, - public QDeclarativeAbstractExpression, +class QV8Bindings : public QDeclarativeAbstractExpression, public QDeclarativeRefCount { public: @@ -77,12 +76,37 @@ public: QDeclarativeAbstractBinding *configBinding(int index, QObject *target, QObject *scope, const QDeclarativeProperty &prop, int line); -protected: - int qt_metacall(QMetaObject::Call, int, void **); - private: Q_DISABLE_COPY(QV8Bindings) - Q_DECLARE_PRIVATE(QV8Bindings) + + struct Binding : public QDeclarativeJavaScriptExpression, + public QDeclarativeAbstractBinding { + Binding(); + + void update() { QDeclarativeAbstractBinding::update(); } + + // Inherited from QDeclarativeJavaScriptExpression + inline virtual QString expressionIdentifier(); + virtual void expressionChanged(); + + // Inherited from QDeclarativeAbstractBinding + virtual void setEnabled(bool, QDeclarativePropertyPrivate::WriteFlags flags); + virtual void update(QDeclarativePropertyPrivate::WriteFlags flags); + virtual void destroy(); + virtual void refresh(); + + int index:30; + bool enabled:1; + bool updating:1; + int line; + QDeclarativeProperty property; + QV8Bindings *parent; + }; + + QUrl url; + int bindingsCount; + Binding *bindings; + v8::Persistent<v8::Array> functions; }; QT_END_NAMESPACE |