/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
// We mean it.
//
-#include <QtScript/qscriptvalue.h>
#include <private/qobject_p.h>
-#include "private/qdeclarativeguard_p.h"
#include <private/qv8_p.h>
QT_BEGIN_NAMESPACE
+template <class Key, class T> class QHash;
+class QDeclarativeGuardImpl;
class QDeclarativeCompiledData;
class QDeclarativeAbstractBinding;
class QDeclarativeContext;
class QDeclarativeContextData;
class QDeclarativeNotifier;
class QDeclarativeDataExtended;
+class QDeclarativeNotifierEndpoint;
// This class is structured in such a way, that simply zero'ing it is the
// default state for elemental object allocations. This is crucial in the
// workings of the QDeclarativeInstruction::CreateSimpleObject instruction.
// Don't change anything here without first considering that case!
-class Q_AUTOTEST_EXPORT QDeclarativeData : public QAbstractDeclarativeData
+class Q_DECLARATIVE_EXPORT QDeclarativeData : public QAbstractDeclarativeData
{
public:
QDeclarativeData()
: ownMemory(true), ownContext(false), indestructible(true), explicitIndestructibleSet(false),
- hasTaintedV8Object(false), context(0), outerContext(0), bindings(0), nextContextObject(0),
- prevContextObject(0), bindingBitsSize(0), bindingBits(0), lineNumber(0), columnNumber(0),
- deferredComponent(0), deferredIdx(0), v8objectid(0), propertyCache(0), guards(0),
- extendedData(0) {
+ hasTaintedV8Object(false), notifyList(0), context(0), outerContext(0), bindings(0),
+ nextContextObject(0), prevContextObject(0), bindingBitsSize(0), bindingBits(0),
+ lineNumber(0), columnNumber(0), deferredComponent(0), deferredIdx(0), v8objectid(0),
+ propertyCache(0), guards(0), extendedData(0) {
init();
- }
+ }
static inline void init() {
QAbstractDeclarativeData::destroyed = destroyed;
QAbstractDeclarativeData::parentChanged = parentChanged;
QAbstractDeclarativeData::objectNameChanged = objectNameChanged;
+ QAbstractDeclarativeData::signalEmitted = signalEmitted;
}
static void destroyed(QAbstractDeclarativeData *, QObject *);
static void parentChanged(QAbstractDeclarativeData *, QObject *, QObject *);
static void objectNameChanged(QAbstractDeclarativeData *, QObject *);
+ static void signalEmitted(QAbstractDeclarativeData *, QObject *, int, void **);
void destroyed(QObject *);
void parentChanged(QObject *, QObject *);
quint32 hasTaintedV8Object:1;
quint32 dummy:27;
+ struct NotifyList {
+ quint64 connectionMask;
+
+ quint16 maximumTodoIndex;
+ quint16 notifiesSize;
+
+ QDeclarativeNotifierEndpoint *todo;
+ QDeclarativeNotifierEndpoint**notifies;
+ void layout();
+ private:
+ void layout(QDeclarativeNotifierEndpoint*);
+ };
+ NotifyList *notifyList;
+
+ inline QDeclarativeNotifierEndpoint *notify(int index);
+ void addNotify(int index, QDeclarativeNotifierEndpoint *);
+
// The context that created the C++ object
QDeclarativeContextData *context;
// The outermost context in which this object lives
QDeclarativePropertyCache *propertyCache;
- QDeclarativeGuard<QObject> *guards;
+ QDeclarativeGuardImpl *guards;
static QDeclarativeData *get(const QObject *object, bool create = false) {
QObjectPrivate *priv = QObjectPrivate::get(const_cast<QObject *>(object));
mutable QDeclarativeDataExtended *extendedData;
};
-template<class T>
-void QDeclarativeGuard<T>::addGuard()
-{
- Q_ASSERT(!prev);
-
- if (QObjectPrivate::get(o)->wasDeleted)
- return;
-
- QDeclarativeData *data = QDeclarativeData::get(o, true);
- next = data->guards;
- if (next) reinterpret_cast<QDeclarativeGuard<T> *>(next)->prev = &next;
- data->guards = reinterpret_cast<QDeclarativeGuard<QObject> *>(this);
- prev = &data->guards;
-}
-
-template<class T>
-void QDeclarativeGuard<T>::remGuard()
+QDeclarativeNotifierEndpoint *QDeclarativeData::notify(int index)
{
- Q_ASSERT(prev);
+ Q_ASSERT(index <= 0xFFFF);
+
+ if (!notifyList || !(notifyList->connectionMask & (1ULL << quint64(index % 64)))) {
+ return 0;
+ } else if (index < notifyList->notifiesSize) {
+ return notifyList->notifies[index];
+ } else if (index <= notifyList->maximumTodoIndex) {
+ notifyList->layout();
+ }
- if (next) reinterpret_cast<QDeclarativeGuard<T> *>(next)->prev = prev;
- *prev = next;
- next = 0;
- prev = 0;
+ if (index < notifyList->notifiesSize) {
+ return notifyList->notifies[index];
+ } else {
+ return 0;
+ }
}
QT_END_NAMESPACE