[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

atwilson at chromium.org atwilson at chromium.org
Thu Oct 29 20:44:03 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit e7a9ea36550158a19c88e3b4e0810db1265c08cd
Author: atwilson at chromium.org <atwilson at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 13 23:39:42 2009 +0000

    Enable SHARED_WORKERS for Chromium
    https://bugs.webkit.org/show_bug.cgi?id=30289
    
    Patch by Drew Wilson <atwilson at atwilson-macpro.local> on 2009-10-13
    Reviewed by David Levin.
    
    WebCore:
    
    Cleaned up bitrot in SharedWorker V8 bindings.
    
    * WebCore.gypi:
    Removed default implementation of SharedWorkerRepository so Chromium can provide its own.
    * bindings/v8/DerivedSourcesAllInOne.cpp:
    Added V8SharedWorkerContext.cpp.
    * bindings/v8/V8DOMWrapper.cpp:
    (WebCore::V8DOMWrapper::getTemplate):
    Added case statements for SHAREDWORKER and SHAREDWORKERCONTEXT.
    * bindings/v8/V8Index.cpp:
    Now includes V8SharedWorkerContext.h to allow supporting SharedWorkers.
    * bindings/v8/V8Index.h:
    Added definition for SHAREDWORKERCONTEXT wrapper.
    * bindings/v8/WorkerContextExecutionProxy.cpp:
    Added includes for SharedWorker.h and SharedWorkerContext.h.
    * bindings/v8/custom/V8CustomBinding.h:
    Reorganized Worker field indexes to be clearer, and fixed mismatch in worker field index.
    Also added field indexes for SharedWorkers.
    * bindings/v8/custom/V8DOMWindowCustom.cpp:
    (WebCore::ACCESSOR_RUNTIME_ENABLER):
    Added runtime enabler for the SharedWorker constructor.
    * bindings/v8/custom/V8SharedWorkerCustom.cpp:
    (WebCore::CALLBACK_FUNC_DECL):
    Cleaned up bitrot (various APIs have changed since this file was written).
    * page/DOMWindow.idl:
    Added EnabledAtRuntime flag to window.SharedWorker.
    
    WebKit:
    
    * chromium/features.gypi:
    Turned on ENABLE_SHARED_WORKERS by default. This doesn't actually turn on
    SharedWorkers yet, as Chromium overrides this flag in its feature_overrides.gypi.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49526 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b7ef721..68ec67f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,37 @@
+2009-10-13  Drew Wilson  <atwilson at atwilson-macpro.local>
+
+        Reviewed by David Levin.
+
+        Enable SHARED_WORKERS for Chromium
+        https://bugs.webkit.org/show_bug.cgi?id=30289
+
+        Cleaned up bitrot in SharedWorker V8 bindings.
+
+        * WebCore.gypi:
+        Removed default implementation of SharedWorkerRepository so Chromium can provide its own.
+        * bindings/v8/DerivedSourcesAllInOne.cpp:
+        Added V8SharedWorkerContext.cpp.
+        * bindings/v8/V8DOMWrapper.cpp:
+        (WebCore::V8DOMWrapper::getTemplate):
+        Added case statements for SHAREDWORKER and SHAREDWORKERCONTEXT.
+        * bindings/v8/V8Index.cpp:
+        Now includes V8SharedWorkerContext.h to allow supporting SharedWorkers.
+        * bindings/v8/V8Index.h:
+        Added definition for SHAREDWORKERCONTEXT wrapper.
+        * bindings/v8/WorkerContextExecutionProxy.cpp:
+        Added includes for SharedWorker.h and SharedWorkerContext.h.
+        * bindings/v8/custom/V8CustomBinding.h:
+        Reorganized Worker field indexes to be clearer, and fixed mismatch in worker field index.
+        Also added field indexes for SharedWorkers.
+        * bindings/v8/custom/V8DOMWindowCustom.cpp:
+        (WebCore::ACCESSOR_RUNTIME_ENABLER):
+        Added runtime enabler for the SharedWorker constructor.
+        * bindings/v8/custom/V8SharedWorkerCustom.cpp:
+        (WebCore::CALLBACK_FUNC_DECL):
+        Cleaned up bitrot (various APIs have changed since this file was written).
+        * page/DOMWindow.idl:
+        Added EnabledAtRuntime flag to window.SharedWorker.
+
 2009-10-13  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Brady Eidson.
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index fbc5e7d..b69e995 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -3489,8 +3489,6 @@
             'workers/DedicatedWorkerContext.h',
             'workers/DedicatedWorkerThread.cpp',
             'workers/DedicatedWorkerThread.h',
-            'workers/DefaultSharedWorkerRepository.cpp',
-            'workers/DefaultSharedWorkerRepository.h',
             'workers/GenericWorkerTask.h',
             'workers/SharedWorker.cpp',
             'workers/SharedWorker.h',
diff --git a/WebCore/bindings/v8/DerivedSourcesAllInOne.cpp b/WebCore/bindings/v8/DerivedSourcesAllInOne.cpp
index 0691dd3..e50fdf9 100644
--- a/WebCore/bindings/v8/DerivedSourcesAllInOne.cpp
+++ b/WebCore/bindings/v8/DerivedSourcesAllInOne.cpp
@@ -208,6 +208,7 @@
 #include "bindings/V8RGBColor.cpp"
 #include "bindings/V8Screen.cpp"
 #include "bindings/V8SharedWorker.cpp"
+#include "bindings/V8SharedWorkerContext.cpp"
 #include "bindings/V8SQLError.cpp"
 #include "bindings/V8SQLResultSet.cpp"
 #include "bindings/V8SQLResultSetRowList.cpp"
diff --git a/WebCore/bindings/v8/V8DOMWrapper.cpp b/WebCore/bindings/v8/V8DOMWrapper.cpp
index 7cba234..12ccf2a 100644
--- a/WebCore/bindings/v8/V8DOMWrapper.cpp
+++ b/WebCore/bindings/v8/V8DOMWrapper.cpp
@@ -438,6 +438,24 @@ v8::Persistent<v8::FunctionTemplate> V8DOMWrapper::getTemplate(V8ClassIndex::V8W
 
 #endif // WORKERS
 
+#if ENABLE(SHARED_WORKERS)
+    case V8ClassIndex::SHAREDWORKER: {
+        // Reserve one more internal field for keeping event listeners.
+        v8::Local<v8::ObjectTemplate> instanceTemplate = descriptor->InstanceTemplate();
+        instanceTemplate->SetInternalFieldCount(V8Custom::kSharedWorkerInternalFieldCount);
+        descriptor->SetCallHandler(USE_CALLBACK(SharedWorkerConstructor));
+        break;
+    }
+
+    case V8ClassIndex::SHAREDWORKERCONTEXT: {
+        // Reserve internal fields for keeping event listeners.
+        v8::Local<v8::ObjectTemplate> instanceTemplate = descriptor->InstanceTemplate();
+        ASSERT(instanceTemplate->InternalFieldCount() == V8Custom::kDefaultWrapperInternalFieldCount);
+        instanceTemplate->SetInternalFieldCount(V8Custom::kSharedWorkerContextInternalFieldCount);
+        break;
+    }
+#endif // SHARED_WORKERS
+
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
     case V8ClassIndex::DOMAPPLICATIONCACHE: {
         // Reserve one more internal field for keeping event listeners.
diff --git a/WebCore/bindings/v8/V8Index.cpp b/WebCore/bindings/v8/V8Index.cpp
index 7f2b44c..66e3371 100644
--- a/WebCore/bindings/v8/V8Index.cpp
+++ b/WebCore/bindings/v8/V8Index.cpp
@@ -401,6 +401,7 @@
 
 #if ENABLE(SHARED_WORKERS)
 #include "V8SharedWorker.h"
+#include "V8SharedWorkerContext.h"
 #endif
 
 #if ENABLE(3D_CANVAS)
diff --git a/WebCore/bindings/v8/V8Index.h b/WebCore/bindings/v8/V8Index.h
index 9368318..082d7a1 100644
--- a/WebCore/bindings/v8/V8Index.h
+++ b/WebCore/bindings/v8/V8Index.h
@@ -100,7 +100,9 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)();
 #if ENABLE(SHARED_WORKERS)
 #define SHARED_WORKER_ACTIVE_OBJECT_WRAPPER_TYPES(V)                    \
     V(SHAREDWORKER, SharedWorker)
-#define SHARED_WORKER_NONNODE_WRAPPER_TYPES(V)
+
+#define SHARED_WORKER_NONNODE_WRAPPER_TYPES(V)                          \
+    V(SHAREDWORKERCONTEXT, SharedWorkerContext)
 #else
 #define SHARED_WORKER_ACTIVE_OBJECT_WRAPPER_TYPES(V)
 #define SHARED_WORKER_NONNODE_WRAPPER_TYPES(V)
diff --git a/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp b/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
index 839411b..4a2cd0e 100644
--- a/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
+++ b/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
@@ -43,6 +43,8 @@
 #include "EventException.h"
 #include "MessagePort.h"
 #include "RangeException.h"
+#include "SharedWorker.h"
+#include "SharedWorkerContext.h"
 #include "V8Binding.h"
 #include "V8DOMMap.h"
 #include "V8Index.h"
diff --git a/WebCore/bindings/v8/custom/V8CustomBinding.h b/WebCore/bindings/v8/custom/V8CustomBinding.h
index 840f04c..1f6c2a5 100644
--- a/WebCore/bindings/v8/custom/V8CustomBinding.h
+++ b/WebCore/bindings/v8/custom/V8CustomBinding.h
@@ -124,17 +124,25 @@ namespace WebCore {
         static const int kMessagePortInternalFieldCount = kDefaultWrapperInternalFieldCount + 2;
 
 #if ENABLE(WORKERS)
-        static const int kWorkerRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
-        static const int kWorkerInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
+        static const int kAbstractWorkerRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
+        static const int kAbstractWorkerInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
+
+        static const int kWorkerRequestCacheIndex = kAbstractWorkerInternalFieldCount + 0;
+        static const int kWorkerInternalFieldCount = kAbstractWorkerInternalFieldCount + 1;
 
         static const int kWorkerContextRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
         static const int kWorkerContextMinimumInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
 
         static const int kDedicatedWorkerContextRequestCacheIndex = kWorkerContextMinimumInternalFieldCount + 0;
         static const int kDedicatedWorkerContextInternalFieldCount = kWorkerContextMinimumInternalFieldCount + 1;
+#endif
 
-        static const int kAbstractWorkerRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
-        static const int kAbstractWorkerInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
+#if ENABLE(SHARED_WORKERS)
+        static const int kSharedWorkerRequestCacheIndex = kAbstractWorkerInternalFieldCount + 0;
+        static const int kSharedWorkerInternalFieldCount = kAbstractWorkerInternalFieldCount + 1;
+
+        static const int kSharedWorkerContextRequestCacheIndex = kWorkerContextMinimumInternalFieldCount + 0;
+        static const int kSharedWorkerContextInternalFieldCount = kWorkerContextMinimumInternalFieldCount + 1;
 #endif
 
 #if ENABLE(NOTIFICATIONS)
@@ -625,6 +633,7 @@ namespace WebCore {
 
 #if ENABLE(SHARED_WORKERS)
         DECLARE_CALLBACK(SharedWorkerConstructor);
+        DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowSharedWorker);
 #endif
 
 #if ENABLE(WEB_SOCKETS)
diff --git a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
index a579c98..c3d781e 100644
--- a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
@@ -52,6 +52,7 @@
 #include "ScriptSourceCode.h"
 #include "SerializedScriptValue.h"
 #include "Settings.h"
+#include "SharedWorkerRepository.h"
 #include "WindowFeatures.h"
 
 // Horizontal and vertical offset, from the parent content area, around newly
@@ -243,6 +244,13 @@ ACCESSOR_RUNTIME_ENABLER(DOMWindowAudio)
 
 #endif
 
+#if ENABLE(SHARED_WORKERS)
+ACCESSOR_RUNTIME_ENABLER(DOMWindowSharedWorker)
+{
+    return SharedWorkerRepository::isAvailable();
+}
+#endif
+
 ACCESSOR_GETTER(DOMWindowImage)
 {
     DOMWindow* window = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, info.Holder());
diff --git a/WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp b/WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp
index e470bc8..de53ac7 100644
--- a/WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp
@@ -38,7 +38,6 @@
 #include "Frame.h"
 #include "V8Binding.h"
 #include "V8CustomBinding.h"
-#include "V8ObjectEventListener.h"
 #include "V8Proxy.h"
 #include "V8Utilities.h"
 #include "WorkerContext.h"
@@ -53,7 +52,7 @@ CALLBACK_FUNC_DECL(SharedWorkerConstructor)
     if (!args.IsConstructCall())
         return throwError("DOM object constructor cannot be called as a function.");
 
-    if (args.Length() < 1)
+    if (!args.Length())
         return throwError("Not enough arguments", V8Proxy::SyntaxError);
 
     v8::TryCatch tryCatch;
@@ -73,17 +72,19 @@ CALLBACK_FUNC_DECL(SharedWorkerConstructor)
     if (!context)
         return v8::Undefined();
 
-    // Create the worker object.
+    // Create the SharedWorker object.
     // Note: it's OK to let this RefPtr go out of scope because we also call SetDOMWrapper(), which effectively holds a reference to obj.
     ExceptionCode ec = 0;
     RefPtr<SharedWorker> obj = SharedWorker::create(toWebCoreString(scriptUrl), name, context, ec);
+    if (ec)
+        return throwError(ec);
 
     // Setup the standard wrapper object internal fields.
     v8::Handle<v8::Object> wrapperObject = args.Holder();
-    V8Proxy::setDOMWrapper(wrapperObject, V8ClassIndex::SHAREDWORKER, obj.get());
+    V8DOMWrapper::setDOMWrapper(wrapperObject, V8ClassIndex::SHAREDWORKER, obj.get());
 
     obj->ref();
-    V8Proxy::setJSWrapperForActiveDOMObject(obj.get(), v8::Persistent<v8::Object>::New(wrapperObject));
+    V8DOMWrapper::setJSWrapperForActiveDOMObject(obj.get(), v8::Persistent<v8::Object>::New(wrapperObject));
 
     return wrapperObject;
 }
diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl
index 10f9c7d..903ed18 100644
--- a/WebCore/page/DOMWindow.idl
+++ b/WebCore/page/DOMWindow.idl
@@ -502,7 +502,7 @@ module window {
 #endif
 
 #if defined(ENABLE_SHARED_WORKERS) && ENABLE_SHARED_WORKERS
-        attribute [JSCCustomGetter] SharedWorkerConstructor SharedWorker; // Usable with the new operator
+        attribute [JSCCustomGetter, EnabledAtRuntime] SharedWorkerConstructor SharedWorker; // Usable with the new operator
 #endif
 
 #if defined(ENABLE_WEB_SOCKETS) && ENABLE_WEB_SOCKETS
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 9fa393c..c9ce4e2 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,14 @@
+2009-10-13  Drew Wilson  <atwilson at atwilson-macpro.local>
+
+        Reviewed by David Levin.
+
+        Enable SHARED_WORKERS for Chromium
+        https://bugs.webkit.org/show_bug.cgi?id=30289
+
+        * chromium/features.gypi:
+        Turned on ENABLE_SHARED_WORKERS by default. This doesn't actually turn on
+        SharedWorkers yet, as Chromium overrides this flag in its feature_overrides.gypi.
+
 2009-10-12  Yaar Schnitman  <yaar at chromium.org>
 
         Reviewed by Dimitri Glazkov.
diff --git a/WebKit/chromium/features.gypi b/WebKit/chromium/features.gypi
index f91598c..27d10c5 100644
--- a/WebKit/chromium/features.gypi
+++ b/WebKit/chromium/features.gypi
@@ -53,7 +53,7 @@
         'ENABLE_ORIENTATION_EVENTS=0',
         'ENABLE_XSLT=1',
         'ENABLE_XPATH=1',
-        'ENABLE_SHARED_WORKERS=0',
+        'ENABLE_SHARED_WORKERS=1',
         'ENABLE_SVG=1',
         'ENABLE_SVG_ANIMATION=1',
         'ENABLE_SVG_AS_IMAGE=1',

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list