[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

Changeset 37715 in webkit


Ignore:
Timestamp:
Oct 20, 2008, 2:24:30 AM (16 years ago)
Author:
ap@webkit.org
Message:

Reviewed by Oliver Hunt.

https://bugs.webkit.org/show_bug.cgi?id=21705
Implement Web Workers client-side API

The implementation is experimental, and disabled by default. It doesn't quite match the
published draft, being influenced by further WHATWG discussions.

This only implements the client-side API, and does not actually create any threads or
global contexts yet.

  • DerivedSources.make: Added DedicatedWorker. SharedWorker is not implemented yet, as I'm still not sure if having separate classes for these helps at all.
  • WebCore.xcodeproj/project.pbxproj: Added new files.
  • bindings/js/JSDOMWindowBase.cpp: (jsDOMWindowBaseWorker): (WebCore::JSDOMWindowBase::put): (setJSDOMWindowBaseWorker): Added window.Worker constructor. Moved JSXSLTProcessorConstructor.h include out of ifdef to match prevailing style.
  • bindings/js/JSDedicatedWorkerConstructor.cpp: Added.
  • bindings/js/JSDedicatedWorkerConstructor.h: Added.
  • bindings/js/JSDedicatedWorkerCustom.cpp: Added. The implementation of event listeners are left custom intentionally, for easier implementation of listeners that are not tied to any Document in the future.
  • dom/DedicatedWorker.cpp: Added.
  • dom/DedicatedWorker.h: Added.
  • dom/DedicatedWorker.idl: Added. Added an implementation that can only load requested scripts for now.
Location:
trunk/WebCore
Files:
6 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r37713 r37715  
     12008-10-20  Alexey Proskuryakov  <ap@webkit.org>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=21705
     6        Implement Web Workers client-side API
     7
     8        The implementation is experimental, and disabled by default. It doesn't quite match the
     9        published draft, being influenced by further WHATWG discussions.
     10
     11        This only implements the client-side API, and does not actually create any threads or
     12        global contexts yet.
     13
     14        * DerivedSources.make: Added DedicatedWorker. SharedWorker is not implemented yet, as I'm
     15        still not sure if having separate classes for these helps at all.
     16
     17        * WebCore.xcodeproj/project.pbxproj: Added new files.
     18
     19        * bindings/js/JSDOMWindowBase.cpp:
     20        (jsDOMWindowBaseWorker):
     21        (WebCore::JSDOMWindowBase::put):
     22        (setJSDOMWindowBaseWorker):
     23        Added window.Worker constructor. Moved JSXSLTProcessorConstructor.h include out of ifdef
     24        to match prevailing style.
     25
     26        * bindings/js/JSDedicatedWorkerConstructor.cpp: Added.
     27        * bindings/js/JSDedicatedWorkerConstructor.h: Added.
     28        * bindings/js/JSDedicatedWorkerCustom.cpp: Added.
     29        The implementation of event listeners are left custom intentionally, for easier implementation
     30        of listeners that are not tied to any Document in the future.
     31
     32        * dom/DedicatedWorker.cpp: Added.
     33        * dom/DedicatedWorker.h: Added.
     34        * dom/DedicatedWorker.idl: Added.
     35        Added an implementation that can only load requested scripts for now.
     36
    1372008-10-19  Darin Adler  <darin@apple.com>
    238
  • trunk/WebCore/DerivedSources.make

    r37435 r37715  
    7878    DOMSelection \
    7979    DOMWindow \
     80    DedicatedWorker \
    8081    Database \
    8182    Document \
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r37662 r37715  
    41604160                E1C4DE690EA75C1E0023CCD6 /* ActiveDOMObject.h in Headers */ = {isa = PBXBuildFile; fileRef = E1C4DE680EA75C1E0023CCD6 /* ActiveDOMObject.h */; };
    41614161                E1C4DE6E0EA75C650023CCD6 /* ActiveDOMObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1C4DE6D0EA75C650023CCD6 /* ActiveDOMObject.cpp */; };
     4162                E1C8BE5D0E8BD15A0064CB7D /* JSDedicatedWorker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1C8BE5C0E8BD15A0064CB7D /* JSDedicatedWorker.cpp */; };
     4163                E1CA5CA00E8CD73B00E8EF90 /* DedicatedWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = E1CA5C9F0E8CD73B00E8EF90 /* DedicatedWorker.h */; };
     4164                E1CA5CA50E8CD78500E8EF90 /* DedicatedWorker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1CA5CA40E8CD78500E8EF90 /* DedicatedWorker.cpp */; };
     4165                E1CA5CBC0E8CDCAF00E8EF90 /* JSDedicatedWorkerCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1CA5CBB0E8CDCAF00E8EF90 /* JSDedicatedWorkerCustom.cpp */; };
     4166                E1CA5CD30E8CDE8000E8EF90 /* JSDedicatedWorkerConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = E1CA5CD20E8CDE8000E8EF90 /* JSDedicatedWorkerConstructor.h */; };
     4167                E1CA5CD60E8CDEE900E8EF90 /* JSDedicatedWorkerConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1CA5CD50E8CDEE900E8EF90 /* JSDedicatedWorkerConstructor.cpp */; };
     4168                E1CAA5C60E8BD23600A73ECA /* JSDedicatedWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = E1CAA5C50E8BD23600A73ECA /* JSDedicatedWorker.h */; };
    41624169                E1E6EEA40B628DA8005F2F70 /* JSHTMLSelectElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1E6EEA30B628DA8005F2F70 /* JSHTMLSelectElement.cpp */; };
    41634170                E1E6EEA80B628DB3005F2F70 /* JSHTMLSelectElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E1E6EEA70B628DB3005F2F70 /* JSHTMLSelectElement.h */; };
     
    87348741                E1C4DE680EA75C1E0023CCD6 /* ActiveDOMObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActiveDOMObject.h; sourceTree = "<group>"; };
    87358742                E1C4DE6D0EA75C650023CCD6 /* ActiveDOMObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ActiveDOMObject.cpp; sourceTree = "<group>"; };
     8743                E1C8BE440E8BCCBB0064CB7D /* DedicatedWorker.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DedicatedWorker.idl; sourceTree = "<group>"; };
     8744                E1C8BE5C0E8BD15A0064CB7D /* JSDedicatedWorker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDedicatedWorker.cpp; sourceTree = "<group>"; };
     8745                E1CA5C9F0E8CD73B00E8EF90 /* DedicatedWorker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DedicatedWorker.h; sourceTree = "<group>"; };
     8746                E1CA5CA40E8CD78500E8EF90 /* DedicatedWorker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DedicatedWorker.cpp; sourceTree = "<group>"; };
     8747                E1CA5CBB0E8CDCAF00E8EF90 /* JSDedicatedWorkerCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDedicatedWorkerCustom.cpp; sourceTree = "<group>"; };
     8748                E1CA5CD20E8CDE8000E8EF90 /* JSDedicatedWorkerConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDedicatedWorkerConstructor.h; sourceTree = "<group>"; };
     8749                E1CA5CD50E8CDEE900E8EF90 /* JSDedicatedWorkerConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDedicatedWorkerConstructor.cpp; sourceTree = "<group>"; };
     8750                E1CAA5C50E8BD23600A73ECA /* JSDedicatedWorker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDedicatedWorker.h; sourceTree = "<group>"; };
    87368751                E1E6EEA30B628DA8005F2F70 /* JSHTMLSelectElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLSelectElement.cpp; sourceTree = "<group>"; };
    87378752                E1E6EEA70B628DB3005F2F70 /* JSHTMLSelectElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = JSHTMLSelectElement.h; sourceTree = "<group>"; };
     
    89838998                                A83B79150CCB0078000B0825 /* Storage */,
    89848999                                A83B790A0CCAFF47000B0825 /* SVG */,
     9000                                E1C8BE4B0E8BD0D10064CB7D /* Threads */,
    89859001                                BC9854530CD3DA8F00069BC1 /* Traversal */,
    89869002                                BC9854430CD3D9D000069BC1 /* Window */,
     
    1285912875                                1A3417C70CECFF250049CBDE /* JSCustomVoidCallback.h */,
    1286012876                                1AE830420CAB0ED1002237AE /* JSDatabaseCustom.cpp */,
     12877                                E1CA5CD20E8CDE8000E8EF90 /* JSDedicatedWorkerConstructor.h */,
     12878                                E1CA5CD50E8CDEE900E8EF90 /* JSDedicatedWorkerConstructor.cpp */,
     12879                                E1CA5CBB0E8CDCAF00E8EF90 /* JSDedicatedWorkerCustom.cpp */,
    1286112880                                929264760B61FC7200B41D34 /* JSDocumentCustom.cpp */,
    1286212881                                BC1DEA4E0E268EB60083A73F /* JSDocumentFragmentCustom.cpp */,
     
    1322513244                        tabWidth = 4;
    1322613245                        usesTabs = 0;
     13246                };
     13247                E1C8BE4B0E8BD0D10064CB7D /* Threads */ = {
     13248                        isa = PBXGroup;
     13249                        children = (
     13250                                E1C8BE5C0E8BD15A0064CB7D /* JSDedicatedWorker.cpp */,
     13251                                E1CAA5C50E8BD23600A73ECA /* JSDedicatedWorker.h */,
     13252                        );
     13253                        name = Threads;
     13254                        sourceTree = "<group>";
    1322713255                };
    1322813256                E1F0424309839389006694EA /* xml */ = {
     
    1372513753                                A8C4A7F809D563270003AC8D /* CSSMappedAttributeDeclaration.cpp */,
    1372613754                                A8C4A7F709D563270003AC8D /* CSSMappedAttributeDeclaration.h */,
     13755                                E1CA5CA40E8CD78500E8EF90 /* DedicatedWorker.cpp */,
     13756                                E1CA5C9F0E8CD73B00E8EF90 /* DedicatedWorker.h */,
     13757                                E1C8BE440E8BCCBB0064CB7D /* DedicatedWorker.idl */,
    1372713758                                93EEC1E709C2877700C515D1 /* DocPtr.h */,
    1372813759                                A8185F3409765765005826D9 /* Document.cpp */,
     
    1597916010                                A8CB413E0E8633FD0032C4F0 /* DashArray.h in Headers */,
    1598016011                                930B3BE20E884921009770C5 /* JSCanvasPixelArrayCustom.h in Headers */,
     16012                                E1CAA5C60E8BD23600A73ECA /* JSDedicatedWorker.h in Headers */,
    1598116013                                BCF937E70E8B2E95005C7AB7 /* JSDOMWindowBase.lut.h in Headers */,
    1598216014                                63F5D4F70E8C4B7100C0BD04 /* ElementRareData.h in Headers */,
     16015                                E1CA5CA00E8CD73B00E8EF90 /* DedicatedWorker.h in Headers */,
     16016                                E1CA5CD30E8CDE8000E8EF90 /* JSDedicatedWorkerConstructor.h in Headers */,
    1598316017                                BC3B7AF40E919CA900D54065 /* JSEventTargetNode.h in Headers */,
    1598416018                                BC60901F0E91B8EC000C68B5 /* JSEventTarget.h in Headers */,
     
    1785517889                                BCC438780E886CC700533DD5 /* JSHTMLInputElementCustom.cpp in Sources */,
    1785617890                                BC2441C40E8B65D00055320F /* ScrollView.cpp in Sources */,
     17891                                E1C8BE5D0E8BD15A0064CB7D /* JSDedicatedWorker.cpp in Sources */,
     17892                                E1CA5CA50E8CD78500E8EF90 /* DedicatedWorker.cpp in Sources */,
     17893                                E1CA5CBC0E8CDCAF00E8EF90 /* JSDedicatedWorkerCustom.cpp in Sources */,
     17894                                E1CA5CD60E8CDEE900E8EF90 /* JSDedicatedWorkerConstructor.cpp in Sources */,
    1785717895                                BC3B7AF30E919CA900D54065 /* JSEventTargetNode.cpp in Sources */,
    1785817896                                BC3B7B210E91AAF400D54065 /* JSEventTargetNodeCustom.cpp in Sources */,
  • trunk/WebCore/bindings/js/JSDOMWindowBase.cpp

    r37705 r37715  
    3939#include "HTMLDocument.h"
    4040#include "JSAudioConstructor.h"
     41#include "JSDedicatedWorkerConstructor.h"
    4142#include "JSDOMWindowCustom.h"
    4243#include "JSEvent.h"
     
    4849#include "JSNode.h"
    4950#include "JSXMLHttpRequestConstructor.h"
     51#include "JSXSLTProcessorConstructor.h"
    5052#include "Logging.h"
    5153#include "MediaPlayer.h"
     
    6668#include <wtf/MathExtras.h>
    6769
    68 #if ENABLE(XSLT)
    69 #include "JSXSLTProcessorConstructor.h"
    70 #endif
    71 
    7270using namespace JSC;
    7371
     
    8785static JSValuePtr jsDOMWindowBaseMessageChannel(ExecState*, const Identifier&, const PropertySlot&);
    8886static void setJSDOMWindowBaseMessageChannel(ExecState*, JSObject*, JSValuePtr);
     87static JSValuePtr jsDOMWindowBaseWorker(ExecState*, const Identifier&, const PropertySlot&);
     88static void setJSDOMWindowBaseWorker(ExecState*, JSObject*, JSValuePtr);
    8989static JSValuePtr jsDOMWindowBaseOption(ExecState*, const Identifier&, const PropertySlot&);
    9090static void setJSDOMWindowBaseOption(ExecState*, JSObject*, JSValuePtr);
     
    159159  MessageChannel                jsDOMWindowBaseMessageChannel               DontDelete
    160160  Option                        jsDOMWindowBaseOption                       DontDelete
     161  Worker                        jsDOMWindowBaseWorker                       DontDelete
    161162  XMLHttpRequest                jsDOMWindowBaseXMLHttpRequest               DontDelete
    162163  XSLTProcessor                 jsDOMWindowBaseXSLTProcessor                DontDelete
     
    471472}
    472473
     474JSValuePtr jsDOMWindowBaseWorker(ExecState* exec, const Identifier&, const PropertySlot& slot)
     475{
     476#if ENABLE(WORKERS)
     477    if (!static_cast<JSDOMWindowBase*>(asObject(slot.slotBase()))->allowsAccessFrom(exec))
     478        return jsUndefined();
     479    return getDOMConstructor<JSDedicatedWorkerConstructor>(exec);
     480#else
     481    return jsUndefined();
     482#endif
     483}
     484
    473485JSValuePtr jsDOMWindowBaseXSLTProcessor(ExecState* exec, const Identifier&, const PropertySlot& slot)
    474486{
     
    603615                || entry->propertyPutter() == setJSDOMWindowBaseOption
    604616                || entry->propertyPutter() == setJSDOMWindowBaseMessageChannel
     617                || entry->propertyPutter() == setJSDOMWindowBaseWorker
    605618                || entry->propertyPutter() == setJSDOMWindowBaseXMLHttpRequest
    606619                || entry->propertyPutter() == setJSDOMWindowBaseXSLTProcessor)) {
     
    637650
    638651void setJSDOMWindowBaseOption(ExecState*, JSObject*, JSValuePtr)
     652{
     653    ASSERT_NOT_REACHED();
     654}
     655
     656void setJSDOMWindowBaseWorker(ExecState*, JSObject*, JSValuePtr)
    639657{
    640658    ASSERT_NOT_REACHED();
Note: See TracChangeset for help on using the changeset viewer.