[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

hausmann at webkit.org hausmann at webkit.org
Wed Dec 22 13:21:16 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit b3bcbfc2320fa747b9ddaa9b01bdad1d60dddb7a
Author: hausmann at webkit.org <hausmann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Sep 12 18:19:53 2010 +0000

    [Qt] Add support for binding QtWebKit to a QScriptEngine.
    
    Reviewed by Andreas Kling.
    
    The ScriptController owns the V8 context, and this patch
    for the Qt build also gives it a QScriptEngine, that has
    been instructed to adopt the V8 context.
    
    This is the enabler for the QObject bindings, used in
    the API and DRT.
    
    * WebCore.pro:
    * bindings/v8/ScriptController.cpp: Include QScriptEngine
    for the Qt build, to let the ~ScriptController destructor
    find the QScriptEngine destructor (via OwnPtr).
    * bindings/v8/ScriptController.h: Declare getters.
    * bindings/v8/ScriptControllerQt.cpp: Added.
    (WebCore::ScriptController::qtScriptEngine): Implement
    engine adoption.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67335 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 7c19f63..09988a6 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,28 @@
 
         Reviewed by Andreas Kling.
 
+        [Qt] Add support for binding QtWebKit to a QScriptEngine.
+
+        The ScriptController owns the V8 context, and this patch
+        for the Qt build also gives it a QScriptEngine, that has
+        been instructed to adopt the V8 context.
+
+        This is the enabler for the QObject bindings, used in
+        the API and DRT.
+
+        * WebCore.pro:
+        * bindings/v8/ScriptController.cpp: Include QScriptEngine
+        for the Qt build, to let the ~ScriptController destructor
+        find the QScriptEngine destructor (via OwnPtr).
+        * bindings/v8/ScriptController.h: Declare getters.
+        * bindings/v8/ScriptControllerQt.cpp: Added.
+        (WebCore::ScriptController::qtScriptEngine): Implement
+        engine adoption.
+
+2010-09-12  Simon Hausmann  <simon.hausmann at nokia.com>
+
+        Reviewed by Andreas Kling.
+
         [Qt] Last bits and pieces for a V8 build.
 
         When building with V8, get it from QtScript.
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 2c04835..d16ea99 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -2509,6 +2509,7 @@ HEADERS += \
 
 v8 {
     SOURCES += \
+       bindings/v8/ScriptControllerQt.cpp \
        platform/qt/PlatformBridgeQt.cpp
 } else {
     SOURCES += \
diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp
index 5b3b747..556b5c6 100644
--- a/WebCore/bindings/v8/ScriptController.cpp
+++ b/WebCore/bindings/v8/ScriptController.cpp
@@ -64,6 +64,10 @@
 #include <wtf/StdLibExtras.h>
 #include <wtf/text/CString.h>
 
+#if PLATFORM(QT)
+#include <QScriptEngine>
+#endif
+
 namespace WebCore {
 
 void ScriptController::initializeThreading()
diff --git a/WebCore/bindings/v8/ScriptController.h b/WebCore/bindings/v8/ScriptController.h
index 525476d..3bc42ef 100644
--- a/WebCore/bindings/v8/ScriptController.h
+++ b/WebCore/bindings/v8/ScriptController.h
@@ -44,6 +44,13 @@
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
 
+#if PLATFORM(QT)
+#include <qglobal.h>
+QT_BEGIN_NAMESPACE
+class QScriptEngine;
+QT_END_NAMESPACE
+#endif
+
 struct NPObject;
 
 namespace WebCore {
@@ -178,6 +185,10 @@ public:
     NPObject* windowScriptNPObject();
 #endif
 
+#if PLATFORM(QT)
+    QScriptEngine* qtScriptEngine();
+#endif
+
     // Dummy method to avoid a bunch of ifdef's in WebCore.
     void evaluateInWorld(const ScriptSourceCode&, DOMWrapperWorld*);
     static void getAllWorlds(Vector<DOMWrapperWorld*>& worlds);
@@ -193,6 +204,9 @@ private:
 
     OwnPtr<V8Proxy> m_proxy;
     typedef HashMap<Widget*, NPObject*> PluginObjectMap;
+#if PLATFORM(QT)
+    OwnPtr<QScriptEngine> m_qtScriptEngine;
+#endif
 
     // A mapping between Widgets and their corresponding script object.
     // This list is used so that when the plugin dies, we can immediately
diff --git a/WebCore/bindings/v8/ScriptControllerQt.cpp b/WebCore/bindings/v8/ScriptControllerQt.cpp
new file mode 100644
index 0000000..246921e
--- /dev/null
+++ b/WebCore/bindings/v8/ScriptControllerQt.cpp
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ScriptController.h"
+
+#include <QScriptEngine>
+
+namespace WebCore {
+
+QScriptEngine* ScriptController::qtScriptEngine()
+{
+    if (!m_qtScriptEngine) {
+        v8::HandleScope handleScope;
+        v8::Handle<v8::Context> v8Context = V8Proxy::mainWorldContext(m_frame);
+        v8::Context::Scope scope(v8Context);
+        if (v8Context.IsEmpty())
+            return 0;
+        m_qtScriptEngine = new QScriptEngine(QScriptEngine::AdoptCurrentContext);
+     }
+     return m_qtScriptEngine.get();
+}
+
+}
+// vim: ts=4 sw=4 et

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list