Skip to content

Commit

Permalink
Cleanup: Fold QV8GCCallback class declaration(s) back into qv8engine_p.h
Browse files Browse the repository at this point in the history
The implementation lives in qv8engine.cpp.

Change-Id: I2898556fea867cdc82ea534eaf020dd8d12b25d6
Reviewed-by: Chris Adams <christopher.adams@nokia.com>
  • Loading branch information
Simon Hausmann authored and Qt by Nokia committed Dec 14, 2011
1 parent f12d2a2 commit b0133b8
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 122 deletions.
2 changes: 1 addition & 1 deletion src/declarative/qml/qdeclarativevmemetaobject_p.h
Expand Up @@ -69,7 +69,7 @@
#include "qdeclarativecompiler_p.h"
#include "qdeclarativecontext_p.h"

#include <private/qv8gccallback_p.h>
#include <private/qv8engine_p.h>

#include <private/qv8_p.h>

Expand Down
1 change: 0 additions & 1 deletion src/declarative/qml/qdeclarativeworkerscript.cpp
Expand Up @@ -59,7 +59,6 @@

#include <private/qv8engine_p.h>
#include <private/qv8worker_p.h>
#include <private/qv8gccallback_p.h>

QT_BEGIN_NAMESPACE

Expand Down
2 changes: 0 additions & 2 deletions src/declarative/qml/v8/qv8engine.cpp
Expand Up @@ -41,10 +41,8 @@

#include "qv8engine_p.h"

#include "qv8gccallback_p.h"
#include "qv8contextwrapper_p.h"
#include "qv8valuetypewrapper_p.h"
#include "qv8gccallback_p.h"
#include "qv8sequencewrapper_p.h"
#include "qv8include_p.h"
#include "qjsengine_p.h"
Expand Down
50 changes: 50 additions & 0 deletions src/declarative/qml/v8/qv8engine_p.h
Expand Up @@ -60,6 +60,7 @@
#include <QtCore/qstack.h>
#include <QtCore/qstringlist.h>
#include <QtCore/QElapsedTimer>
#include <QtCore/QThreadStorage>

#include <private/qv8_p.h>
#include <qjsengine.h>
Expand Down Expand Up @@ -222,6 +223,55 @@ class QDeclarativeValueType;
class QNetworkAccessManager;
class QDeclarativeContextData;

class Q_AUTOTEST_EXPORT QV8GCCallback
{
private:
class ThreadData;
public:
static void garbageCollectorPrologueCallback(v8::GCType, v8::GCCallbackFlags);
static void registerGcPrologueCallback();
static void releaseWorkerThreadGcPrologueCallbackData();

class Q_AUTOTEST_EXPORT Referencer {
public:
~Referencer();
void addRelationship(QObject *object, v8::Persistent<v8::Value> handle);
void addRelationship(QObject *object, QObject *other);
void dispose();
private:
Referencer();
static v8::Persistent<v8::Object> *findOwnerAndStrength(QObject *qobjectOwner, bool *shouldBeStrong);
v8::Persistent<v8::Object> strongReferencer;
v8::Persistent<v8::Context> context;
friend class QV8GCCallback::ThreadData;
};

class Q_AUTOTEST_EXPORT Node {
public:
typedef void (*PrologueCallback)(Referencer *r, Node *node);
Node(PrologueCallback callback);
~Node();

QIntrusiveListNode node;
PrologueCallback prologueCallback;
};

static void addGcCallbackNode(Node *node);

private:
class ThreadData {
public:
ThreadData() : gcPrologueCallbackRegistered(false) { }
~ThreadData();
Referencer referencer;
bool gcPrologueCallbackRegistered;
QIntrusiveList<Node, &Node::node> gcCallbackNodes;
};

static void initializeThreadData();
static QThreadStorage<ThreadData *> threadData;
};

class Q_DECLARATIVE_EXPORT QV8Engine
{
public:
Expand Down
115 changes: 0 additions & 115 deletions src/declarative/qml/v8/qv8gccallback_p.h

This file was deleted.

1 change: 0 additions & 1 deletion src/declarative/qml/v8/v8.pri
Expand Up @@ -8,7 +8,6 @@ HEADERS += \
$$PWD/qv8profiler_p.h \
$$PWD/qv8stringwrapper_p.h \
$$PWD/qv8engine_p.h \
$$PWD/qv8gccallback_p.h \
$$PWD/qv8sequencewrapper_p.h \
$$PWD/qv8sequencewrapper_p_p.h \
$$PWD/qv8contextwrapper_p.h \
Expand Down
1 change: 0 additions & 1 deletion tests/auto/declarative/qdeclarativeecmascript/testtypes.h
Expand Up @@ -57,7 +57,6 @@
#include <QtDeclarative/qdeclarativescriptstring.h>
#include <QtDeclarative/qdeclarativecomponent.h>

#include <private/qv8gccallback_p.h>
#include <private/qdeclarativeengine_p.h>
#include <private/qv8engine_p.h>

Expand Down
Expand Up @@ -49,7 +49,6 @@
#include <QtCore/qdir.h>
#include <QtCore/qnumeric.h>
#include <private/qdeclarativeengine_p.h>
#include <private/qv8gccallback_p.h>
#include <private/qdeclarativevmemetaobject_p.h>
#include <private/qv4compiler_p.h>
#include "testtypes.h"
Expand Down

0 comments on commit b0133b8

Please sign in to comment.