Debugger: Move server into it's own thread
[profile/ivi/qtdeclarative.git] / src / declarative / debugger / qv8profilerservice.cpp
index 48d2d13..807fe83 100644 (file)
@@ -84,6 +84,7 @@ class QV8ProfilerServicePrivate : public QDeclarativeDebugServicePrivate
 public:
     QV8ProfilerServicePrivate()
         :initialized(false)
+        , isolate(0)
     {
     }
 
@@ -96,6 +97,7 @@ public:
 
     bool initialized;
     QList<QDeclarativeEngine *> engines;
+    v8::Isolate *isolate;
 };
 
 QV8ProfilerService::QV8ProfilerService(QObject *parent)
@@ -146,6 +148,14 @@ void QV8ProfilerService::messageReceived(const QByteArray &message)
     QByteArray title;
     ds >> command >> option;
 
+    if (!d->isolate) {
+        d->isolate = v8::Isolate::New();
+        v8::Isolate::Scope scope(d->isolate);
+        v8::V8::Initialize();
+    }
+
+    v8::Isolate::Scope scope(d->isolate);
+
     if (command == "V8PROFILER") {
         ds >>  title;
         if (option == "start") {