Changeset 46370 in webkit


Ignore:
Timestamp:
Jul 24, 2009 12:28:00 PM (15 years ago)
Author:
eric@webkit.org
Message:

2009-07-24 Drew Wilson <atwilson@google.com>

Reviewed by Adam Barth.

Refactor WorkerContext to move DedicatedWorker-specific APIs into DedicatedWorkerContext
https://bugs.webkit.org/show_bug.cgi?id=27420

No new tests as the existing tests already provide sufficient coverage (this is just a refactoring with no new functionality).

  • DerivedSources.cpp: Added JSDerivedWorkerContext.cpp
  • DerivedSources.make: Added DerivedWorkerContext files
  • GNUmakefile.am: Added DerivedWorkerContext files
  • WebCore.gypi: Added DerivedWorkerContext files
  • WebCore.pro: Added DerivedWorkerContext files
  • WebCore.vcproj/WebCore.vcproj: Added DerivedWorkerContext files
  • WebCore.xcodeproj/project.pbxproj: Added DerivedWorkerContext files
  • bindings/js/JSDedicatedWorkerContextCustom.cpp: Added. (WebCore::JSDedicatedWorkerContext::mark): Custom mark function for onmessage event handler.
  • bindings/js/JSEventTarget.cpp: (WebCore::toJS): Supports conversion to JSDedicatedWorkerContext. (WebCore::toEventTarget):
  • bindings/js/JSWorkerContextCustom.cpp: (WebCore::JSWorkerContext::mark): Moved onmessage mark handling into DedicatedWorkerContext.
  • bindings/js/WorkerScriptController.cpp: Added appropriate casts to DedicatedWorkerContext for postMessage(). (WebCore::WorkerScriptController::initScript): Manually sets up the prototype chain for the worker context.
  • bindings/scripts/CodeGeneratorJS.pm: Changed special case code for WorkerContext to be triggered by new IsWorkerContext attribute.
  • bindings/scripts/CodeGeneratorV8.pm: Changed hard-coded tests for WorkerContext to support DedicatedWorkerContext.
  • bindings/v8/DOMObjectsInclude.h: Added DedicatedWorkerContext.h
  • bindings/v8/DerivedSourcesAllInOne.cpp: Added V8DedicatedWorkerContext.cpp
  • bindings/v8/V8DOMWrapper.cpp: (WebCore::V8DOMWrapper::getTemplate): Added code to reserve extra fields for V8DedicatedWorkerContext.
  • bindings/v8/V8Index.cpp: Now includes V8DedicatedWorkerContext.h in addition to V8WorkerContext.h
  • bindings/v8/V8Index.h: Added DedicatedWorkerContext as a non-node wrapper type. Removed WORKERCONTEXT as a valid template type.
  • bindings/v8/WorkerContextExecutionProxy.cpp: (WebCore::WorkerContextExecutionProxy::initContextIfNeeded): Creates DedicatedWorkerContext instead of WorkerContext. (WebCore::WorkerContextExecutionProxy::EventTargetToV8Object): Returns DedicatedWorkerContext instead of WorkerContext. (WebCore::WorkerContextExecutionProxy::retrieve): Refactored to deal with DedicatedWorkerContext.
  • bindings/v8/custom/V8AbstractWorkerCustom.cpp:
  • bindings/v8/custom/V8CustomBinding.h:
  • bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp: Added. Moved onmessage code from V8WorkerContextCustom.cpp (WebCore::ACCESSOR_GETTER): (WebCore::ACCESSOR_SETTER):
  • bindings/v8/custom/V8WorkerContextCustom.cpp: Moved onmessage code to V8DedicatedWorkerContextCustom.cpp
  • dom/EventTarget.cpp: (WebCore::EventTarget::toDedicatedWorkerContext):
  • dom/EventTarget.h:
  • workers/DedicatedWorkerContext.cpp: Added. Moved DedicatedWorker-only APIs from WorkerContext. (WebCore::DedicatedWorkerContext::DedicatedWorkerContext): (WebCore::DedicatedWorkerContext::~DedicatedWorkerContext): (WebCore::DedicatedWorkerContext::reportException): (WebCore::DedicatedWorkerContext::postMessage): (WebCore::DedicatedWorkerContext::dispatchMessage):
  • workers/DedicatedWorkerContext.h: Added. Moved DedicatedWorker-only APIs from WorkerContext. (WebCore::DedicatedWorkerContext::create): (WebCore::DedicatedWorkerContext::toDedicatedWorkerContext): (WebCore::DedicatedWorkerContext::setOnmessage): (WebCore::DedicatedWorkerContext::onmessage):
  • workers/DedicatedWorkerContext.idl: Added.
  • workers/WorkerContext.cpp: (WebCore::WorkerContext::~WorkerContext): Moved code that notifies parent that worker is closing down into DedicatedWorkerContext.
  • workers/WorkerContext.h: (WebCore::WorkerContext::isClosing): Exposed closing flag as an API so derived classes can access it.
  • workers/WorkerContext.idl:
  • workers/WorkerMessagingProxy.cpp: (WebCore::MessageWorkerContextTask::performTask): Calls into DedicatedWorkerContext to handle message.
  • workers/WorkerThread.cpp: (WebCore::WorkerThread::workerThread): Creates a DedicatedWorkerContext when the thread starts up.
Location:
trunk/WebCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r46369 r46370  
    9797        (WebCore::WorkerThread::workerThread):
    9898        Creates a DedicatedWorkerContext when the thread starts up.
     99
     1002009-07-24  Eric Seidel  <eric@webkit.org>
     101
     102        Reviewed by Adam Barth.
     103
     104        Move more callers to using 3 argument toJS
     105        https://bugs.webkit.org/show_bug.cgi?id=27661
     106
     107        No functional changes, thus no tests.
     108        These are all the places where we can't yet pass the
     109        correct globalObject because we don't have or don't know the right one.
     110
     111        * bindings/js/JSCustomPositionCallback.cpp:
     112        (WebCore::JSCustomPositionCallback::handleEvent):
     113        * bindings/js/JSCustomPositionErrorCallback.cpp:
     114        (WebCore::JSCustomPositionErrorCallback::handleEvent):
     115        * bindings/js/JSCustomSQLStatementCallback.cpp:
     116        (WebCore::JSCustomSQLStatementCallback::handleEvent):
     117        * bindings/js/JSCustomSQLStatementErrorCallback.cpp:
     118        (WebCore::JSCustomSQLStatementErrorCallback::handleEvent):
     119        * bindings/js/JSCustomSQLTransactionCallback.cpp:
     120        (WebCore::JSCustomSQLTransactionCallback::handleEvent):
     121        * bindings/js/JSCustomSQLTransactionErrorCallback.cpp:
     122        (WebCore::JSCustomSQLTransactionErrorCallback::handleEvent):
     123        * bindings/js/JSNodeFilterCondition.cpp:
     124        (WebCore::JSNodeFilterCondition::acceptNode):
    99125
    1001262009-07-24  Eric Seidel  <eric@webkit.org>
  • trunk/WebCore/bindings/js/JSCustomPositionCallback.cpp

    r44094 r46370  
    4949    if (!m_frame->script()->isEnabled())
    5050        return;
    51    
     51
     52    // FIXME: This is likely the wrong globalObject (for prototype chains at least)
    5253    JSGlobalObject* globalObject = m_frame->script()->globalObject();
    5354    ExecState* exec = globalObject->globalExec();
     
    6869   
    6970    RefPtr<JSCustomPositionCallback> protect(this);
    70    
     71
    7172    MarkedArgumentBuffer args;
    72     args.append(toJS(exec, geoposition));
    73    
     73    args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), geoposition));
     74
    7475    globalObject->globalData()->timeoutChecker.start();
    7576    call(exec, function, callType, callData, m_callback, args);
  • trunk/WebCore/bindings/js/JSCustomPositionErrorCallback.cpp

    r44094 r46370  
    4949    if (!m_frame->script()->isEnabled())
    5050        return;
    51    
     51
     52    // FIXME: This is likely the wrong globalObject (for prototype chains at least)
    5253    JSGlobalObject* globalObject = m_frame->script()->globalObject();
    5354    ExecState* exec = globalObject->globalExec();
     
    7071   
    7172    MarkedArgumentBuffer args;
    72     args.append(toJS(exec, positionError));
     73    args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), positionError));
    7374   
    7475    globalObject->globalData()->timeoutChecker.start();
  • trunk/WebCore/bindings/js/JSCustomSQLStatementCallback.cpp

    r43283 r46370  
    5555        return;
    5656
     57    // FIXME: This is likely the wrong globalObject (for prototype chains at least)
    5758    JSGlobalObject* globalObject = m_frame->script()->globalObject();
    5859    ExecState* exec = globalObject->globalExec();
     
    7576
    7677    MarkedArgumentBuffer args;
    77     args.append(toJS(exec, transaction));
    78     args.append(toJS(exec, resultSet));
     78    args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), transaction));
     79    args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), resultSet));
    7980       
    8081    globalObject->globalData()->timeoutChecker.start();
  • trunk/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp

    r43283 r46370  
    5555    if (!m_frame->script()->isEnabled())
    5656        return true;
    57        
     57
     58    // FIXME: This is likely the wrong globalObject (for prototype chains at least)
    5859    JSGlobalObject* globalObject = m_frame->script()->globalObject();
    5960    ExecState* exec = globalObject->globalExec();
     
    7879       
    7980    MarkedArgumentBuffer args;
    80     args.append(toJS(exec, transaction));
    81     args.append(toJS(exec, error));
     81    args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), transaction));
     82    args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), error));
    8283       
    8384    JSValue result;
  • trunk/WebCore/bindings/js/JSCustomSQLTransactionCallback.cpp

    r43283 r46370  
    9595    if (!m_data->frame()->script()->isEnabled())
    9696        return;
    97        
     97
     98    // FIXME: This is likely the wrong globalObject (for prototype chains at least)
    9899    JSGlobalObject* globalObject = m_data->frame()->script()->globalObject();
    99100    ExecState* exec = globalObject->globalExec();
     
    118119       
    119120    MarkedArgumentBuffer args;
    120     args.append(toJS(exec, transaction));
     121    args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), transaction));
    121122
    122123    globalObject->globalData()->timeoutChecker.start();
  • trunk/WebCore/bindings/js/JSCustomSQLTransactionErrorCallback.cpp

    r44155 r46370  
    5555        return;
    5656
     57    // FIXME: This is likely the wrong globalObject (for prototype chains at least)
    5758    JSGlobalObject* globalObject = m_frame->script()->globalObject();
    5859    ExecState* exec = globalObject->globalExec();
     
    7576
    7677    MarkedArgumentBuffer args;
    77     args.append(toJS(exec, error));
     78    args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), error));
    7879
    7980    globalObject->globalData()->timeoutChecker.start();
  • trunk/WebCore/bindings/js/JSNodeFilterCondition.cpp

    r43122 r46370  
    6262
    6363    MarkedArgumentBuffer args;
    64     args.append(toJS(exec, filterNode));
     64    // FIXME: The node should have the prototype chain that came from its document, not
     65    // whatever prototype chain might be on the window this filter came from. Bug 27662
     66    args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), filterNode));
    6567    if (exec->hadException())
    6668        return NodeFilter::FILTER_REJECT;
  • trunk/WebCore/bindings/js/JSWorkerConstructor.cpp

    r46368 r46370  
    6060        return 0;
    6161
    62     // FIXME: Why do we use the lexical global object here?
     62    // See section 4.8.2 step 14 of WebWorkers for why this is the lexicalGlobalObject.
    6363    DOMWindow* window = asJSDOMWindow(exec->lexicalGlobalObject())->impl();
    6464
Note: See TracChangeset for help on using the changeset viewer.