2009-07-13 Drew Wilson <atwilson@google.com>
authorlevin@chromium.org <levin@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Jul 2009 08:58:48 +0000 (08:58 +0000)
committerlevin@chromium.org <levin@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Jul 2009 08:58:48 +0000 (08:58 +0000)
commitcbbc213712bf9abc7573b45e55c0dae41c1e4cdb
treef3a678477c17480091009116e5ac38e81b9d7e01
parentb63aa8c0d4ad08a7785deec68c02c1743c5d85d7
2009-07-13  Drew Wilson  <atwilson@google.com>

        Reviewed by David Levin.

        Add ENABLE(SHARED_WORKERS) flag and define SharedWorker APIs
        https://bugs.webkit.org/show_bug.cgi?id=26932

.:

        Added ENABLE(SHARED_WORKERS) flag.

       * configure.ac:

JavaScriptCore:

        Added ENABLE(SHARED_WORKERS) flag (off by default).

        * Configurations/FeatureDefines.xcconfig:

WebCore:

        Initial IDL definition and bindings for SharedWorkers.

        * Configurations/FeatureDefines.xcconfig:
        Added new files for SharedWorker support.
        * DerivedSources.make:
        Added new files for SharedWorker support.
        * GNUmakefile.am:
        Added new files for SharedWorker support.
        * WebCore.gypi:
        Added new files for SharedWorker support.
        * WebCore.pro:
        Added new files for SharedWorker support.
        * WebCore.xcodeproj/project.pbxproj:
        Added new files for SharedWorker support.
        * bindings/js/JSAbstractWorkerCustom.cpp: Added.
        (WebCore::JSAbstractWorker::mark):
        Custom mark handler that marks the event listeners.
        (WebCore::JSAbstractWorker::addEventListener):
        (WebCore::JSAbstractWorker::removeEventListener):
        (WebCore::JSAbstractWorker::toJS):
        Custom toJS handler which differentiates between various subclasses.
        * bindings/js/JSDOMWindowCustom.cpp:
        (WebCore::JSDOMWindow::sharedWorker):
        SharedWorker constructor (only enabled when SHARED_WORKERS is
        enabled).
        * bindings/js/JSEventTarget.cpp:
        (WebCore::toJS):
        (WebCore::toEventTarget):
        Added support for converting to/from SharedWorkers.
        * bindings/js/JSSharedWorkerConstructor.cpp: Added.
        (WebCore::JSSharedWorkerConstructor::JSSharedWorkerConstructor):
        (WebCore::constructSharedWorker):
        (WebCore::JSSharedWorkerConstructor::getConstructData):
        * bindings/js/JSSharedWorkerConstructor.h: Added.
        (WebCore::JSSharedWorkerConstructor::classInfo):
        * bindings/js/JSSharedWorkerCustom.cpp: Added.
        (WebCore::JSSharedWorker::mark):
        Custom mark function that marks the internal MessagePort.
        * bindings/v8/DOMObjectsInclude.h:
        Updated to include new header files.
        * bindings/v8/V8Index.cpp:
        * bindings/v8/V8Index.h:
        * bindings/v8/custom/V8AbstractWorkerCustom.cpp: Added.
        (WebCore::getEventListener):
        (WebCore::ACCESSOR_GETTER):
        (WebCore::ACCESSOR_SETTER):
        (WebCore::CALLBACK_FUNC_DECL):
        V8 handlers for add/removeEventListener().
        * bindings/v8/custom/V8CustomBinding.h:
        * bindings/v8/custom/V8SharedWorkerCustom.cpp: Added.
        (WebCore::CALLBACK_FUNC_DECL):
        Custom constructor for SharedWorker.
        * dom/EventTarget.cpp:
        (WebCore::EventTarget::toSharedWorker):
        * dom/EventTarget.h:
        * page/DOMWindow.idl:
        * workers/AbstractWorker.cpp: Added.
        (WebCore::AbstractWorker::AbstractWorker):
        Common base class for SharedWorker and (soon) Worker. The functions below were copied from Worker.cpp.
        This is the first step in refactoring Worker to derive from AbstractWorker to enable code sharing.
        (WebCore::AbstractWorker::~AbstractWorker):
        (WebCore::AbstractWorker::addEventListener):
        (WebCore::AbstractWorker::removeEventListener):
        (WebCore::AbstractWorker::dispatchEvent):
        (WebCore::AbstractWorker::dispatchLoadErrorEvent):
        (WebCore::AbstractWorker::dispatchScriptErrorEvent):
        * workers/AbstractWorker.h: Added.
        Definitions of functionality shared by Worker.h and SharedWorker.h. In a future patch, Worker will derive from AbstractWorker.
        (WebCore::AbstractWorker::scriptExecutionContext):
        (WebCore::AbstractWorker::setOnerror):
        (WebCore::AbstractWorker::onerror):
        (WebCore::AbstractWorker::eventListeners):
        (WebCore::AbstractWorker::refEventTarget):
        (WebCore::AbstractWorker::derefEventTarget):
        * workers/AbstractWorker.idl: Added.
        * workers/SharedWorker.cpp: Added.
        (WebCore::SharedWorker::SharedWorker):
        (WebCore::SharedWorker::~SharedWorker):
        * workers/SharedWorker.h: Added.
        (WebCore::SharedWorker::create):
        (WebCore::SharedWorker::port):
        (WebCore::SharedWorker::toSharedWorker):
        * workers/SharedWorker.idl: Added.

WebKit/mac:

        Added ENABLE(SHARED_WORKERS) flag (disabled by default).

        * Configurations/FeatureDefines.xcconfig:

WebKitTools:

        Added support for --shared-workers (turned off by default)

        * Scripts/build-webkit:

LayoutTests:

        Unit tests for new SharedWorker APIs (disabled by default).

        * fast/workers/shared-worker-constructor-expected.txt: Added.
        * fast/workers/shared-worker-constructor.html-disabled: Added.
        * fast/workers/shared-worker-event-listener-expected.txt: Added.
        * fast/workers/shared-worker-event-listener.html-disabled: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@45795 268f45cc-cd09-0410-ab3c-d52691b4dbfc
41 files changed:
ChangeLog
JavaScriptCore/ChangeLog
JavaScriptCore/Configurations/FeatureDefines.xcconfig
LayoutTests/ChangeLog
LayoutTests/fast/workers/shared-worker-constructor-expected.txt [new file with mode: 0644]
LayoutTests/fast/workers/shared-worker-constructor.html-disabled [new file with mode: 0644]
LayoutTests/fast/workers/shared-worker-event-listener-expected.txt [new file with mode: 0644]
LayoutTests/fast/workers/shared-worker-event-listener.html-disabled [new file with mode: 0644]
WebCore/ChangeLog
WebCore/Configurations/FeatureDefines.xcconfig
WebCore/DerivedSources.make
WebCore/GNUmakefile.am
WebCore/WebCore.gypi
WebCore/WebCore.pro
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/js/JSAbstractWorkerCustom.cpp [new file with mode: 0644]
WebCore/bindings/js/JSDOMWindowCustom.cpp
WebCore/bindings/js/JSEventTarget.cpp
WebCore/bindings/js/JSSharedWorkerConstructor.cpp [new file with mode: 0644]
WebCore/bindings/js/JSSharedWorkerConstructor.h [new file with mode: 0644]
WebCore/bindings/js/JSSharedWorkerCustom.cpp [new file with mode: 0644]
WebCore/bindings/v8/DOMObjectsInclude.h
WebCore/bindings/v8/V8Index.cpp
WebCore/bindings/v8/V8Index.h
WebCore/bindings/v8/custom/V8AbstractWorkerCustom.cpp [new file with mode: 0644]
WebCore/bindings/v8/custom/V8CustomBinding.h
WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp [new file with mode: 0644]
WebCore/dom/EventTarget.cpp
WebCore/dom/EventTarget.h
WebCore/page/DOMWindow.idl
WebCore/workers/AbstractWorker.cpp [new file with mode: 0644]
WebCore/workers/AbstractWorker.h [new file with mode: 0644]
WebCore/workers/AbstractWorker.idl [new file with mode: 0644]
WebCore/workers/SharedWorker.cpp [new file with mode: 0644]
WebCore/workers/SharedWorker.h [new file with mode: 0644]
WebCore/workers/SharedWorker.idl [new file with mode: 0644]
WebKit/mac/ChangeLog
WebKit/mac/Configurations/FeatureDefines.xcconfig
WebKitTools/ChangeLog
WebKitTools/Scripts/build-webkit
configure.ac