Changeset 47036 in webkit


Ignore:
Timestamp:
Aug 11, 2009 9:33:18 AM (15 years ago)
Author:
atwilson@chromium.org
Message:

Need to refactor WorkerObjectProxy.
https://bugs.webkit.org/show_bug.cgi?id=28136

Reviewed by David Levin.

Added WorkerReportingProxy for reporting worker state (exceptions, console messages, thread exited) to the parent.

Existing tests are sufficient, as this is only a refactoring.

  • GNUmakefile.am:

Added WorkerReportingProxy.h to build.

  • WebCore.gypi:

Added WorkerReportingProxy.h to build.

  • WebCore.vcproj/WebCore.vcproj:

Added WorkerReportingProxy.h to build.

  • WebCore.xcodeproj/project.pbxproj:

Added WorkerReportingProxy.h to build.

  • workers/DedicatedWorkerContext.cpp:
  • workers/DedicatedWorkerContext.h:

Removed addMessage/forwardException() APIs - now handled by WorkerReportingProxy.

  • workers/DedicatedWorkerThread.cpp:

(WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
Changed constructor to pass WorkerReportingProxy to base class.

  • workers/DefaultSharedWorkerRepository.cpp:

Updated SharedWorkerProxy to implement WorkerReportingProxy interface.
(WebCore::SharedWorkerProxy::postExceptionToWorkerObject):
(WebCore::SharedWorkerProxy::postConsoleMessageToWorkerObject):
(WebCore::SharedWorkerProxy::workerContextClosed):
(WebCore::SharedWorkerProxy::workerContextDestroyed):
(WebCore::DefaultSharedWorkerRepository::workerScriptLoaded):
Now passes in WorkerReportingProxy when creating SharedWorkerThread.

  • workers/SharedWorkerContext.cpp:
  • workers/SharedWorkerContext.h:

Removed addMessage/forwardException() APIs - now handled by WorkerReportingProxy.

  • workers/SharedWorkerThread.cpp:

(WebCore::SharedWorkerThread::create):
(WebCore::SharedWorkerThread::SharedWorkerThread):
Passes WorkerReportingProxy to base class constructor.

  • workers/SharedWorkerThread.h:

Constructor now takes a WorkerReportingProxy.

  • workers/WorkerContext.cpp:

(WebCore::WorkerContext::~WorkerContext):
Moved code that calls workerContextDestroyed() into base class so shared workers share this functionality.
(WebCore::WorkerContext::close):
Now notifies WorkerReportingProxy when the thread is closing.
(WebCore::WorkerContext::reportException):
Reports exceptions via WorkerReportingProxy.
(WebCore::WorkerContext::addMessage):
Reports console messages via WorkerReportingProxy.

  • workers/WorkerContext.h:
  • workers/WorkerObjectProxy.h:

(WebCore::WorkerObjectProxy::workerContextClosed):
Default empty implementation for dedicated workers.

  • workers/WorkerReportingProxy.h: Added.

Base interface that contains APIs moved from WorkerObjectProxy.
(WebCore::WorkerReportingProxy::~WorkerReportingProxy):

  • workers/WorkerThread.cpp:

(WebCore::WorkerThread::WorkerThread):
Updated constructor to accept a WorkerReportingProxy.

  • workers/WorkerThread.h:

(WebCore::WorkerThread::workerReportingProxy):

Location:
trunk/WebCore
Files:
18 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r47030 r47036  
     12009-08-11  Drew Wilson  <atwilson@google.com>
     2
     3        Reviewed by David Levin.
     4
     5        Need to refactor WorkerObjectProxy.
     6        https://bugs.webkit.org/show_bug.cgi?id=28136
     7
     8        Added WorkerReportingProxy for reporting worker state (exceptions, console messages, thread exited) to the parent.
     9
     10        Existing tests are sufficient, as this is only a refactoring.
     11
     12        * GNUmakefile.am:
     13        Added WorkerReportingProxy.h to build.
     14        * WebCore.gypi:
     15        Added WorkerReportingProxy.h to build.
     16        * WebCore.vcproj/WebCore.vcproj:
     17        Added WorkerReportingProxy.h to build.
     18        * WebCore.xcodeproj/project.pbxproj:
     19        Added WorkerReportingProxy.h to build.
     20        * workers/DedicatedWorkerContext.cpp:
     21        * workers/DedicatedWorkerContext.h:
     22        Removed addMessage/forwardException() APIs - now handled by WorkerReportingProxy.
     23        * workers/DedicatedWorkerThread.cpp:
     24        (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
     25        Changed constructor to pass WorkerReportingProxy to base class.
     26        * workers/DefaultSharedWorkerRepository.cpp:
     27        Updated SharedWorkerProxy to implement WorkerReportingProxy interface.
     28        (WebCore::SharedWorkerProxy::postExceptionToWorkerObject):
     29        (WebCore::SharedWorkerProxy::postConsoleMessageToWorkerObject):
     30        (WebCore::SharedWorkerProxy::workerContextClosed):
     31        (WebCore::SharedWorkerProxy::workerContextDestroyed):
     32        (WebCore::DefaultSharedWorkerRepository::workerScriptLoaded):
     33        Now passes in WorkerReportingProxy when creating SharedWorkerThread.
     34        * workers/SharedWorkerContext.cpp:
     35        * workers/SharedWorkerContext.h:
     36        Removed addMessage/forwardException() APIs - now handled by WorkerReportingProxy.
     37        * workers/SharedWorkerThread.cpp:
     38        (WebCore::SharedWorkerThread::create):
     39        (WebCore::SharedWorkerThread::SharedWorkerThread):
     40        Passes WorkerReportingProxy to base class constructor.
     41        * workers/SharedWorkerThread.h:
     42        Constructor now takes a WorkerReportingProxy.
     43        * workers/WorkerContext.cpp:
     44        (WebCore::WorkerContext::~WorkerContext):
     45        Moved code that calls workerContextDestroyed() into base class so shared workers share this functionality.
     46        (WebCore::WorkerContext::close):
     47        Now notifies WorkerReportingProxy when the thread is closing.
     48        (WebCore::WorkerContext::reportException):
     49        Reports exceptions via WorkerReportingProxy.
     50        (WebCore::WorkerContext::addMessage):
     51        Reports console messages via WorkerReportingProxy.
     52        * workers/WorkerContext.h:
     53        * workers/WorkerObjectProxy.h:
     54        (WebCore::WorkerObjectProxy::workerContextClosed):
     55        Default empty implementation for dedicated workers.
     56        * workers/WorkerReportingProxy.h: Added.
     57        Base interface that contains APIs moved from WorkerObjectProxy.
     58        (WebCore::WorkerReportingProxy::~WorkerReportingProxy):
     59        * workers/WorkerThread.cpp:
     60        (WebCore::WorkerThread::WorkerThread):
     61        Updated constructor to accept a WorkerReportingProxy.
     62        * workers/WorkerThread.h:
     63        (WebCore::WorkerThread::workerReportingProxy):
     64
    1652009-08-11  Simon Hausmann  <simon.hausmann@nokia.com>
    266
  • trunk/WebCore/GNUmakefile.am

    r46956 r47036  
    23712371        WebCore/workers/WorkerMessagingProxy.h \
    23722372        WebCore/workers/WorkerObjectProxy.h \
     2373        WebCore/workers/WorkerReportingProxy.h \
    23732374        WebCore/workers/WorkerRunLoop.cpp \
    23742375        WebCore/workers/WorkerRunLoop.h \
  • trunk/WebCore/WebCore.gypi

    r46979 r47036  
    33543354            'workers/WorkerMessagingProxy.h',
    33553355            'workers/WorkerObjectProxy.h',
     3356            'workers/WorkerReportingProxy.h',
    33563357            'workers/WorkerRunLoop.cpp',
    33573358            'workers/WorkerRunLoop.h',
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r46995 r47036  
    2429324293                        </File>
    2429424294                        <File
     24295                                RelativePath="..\workers\WorkerReportingProxy.h"
     24296                                >
     24297                        </File>
     24298                        <File
    2429524299                                RelativePath="..\workers\WorkerRunLoop.cpp"
    2429624300                                >
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r46937 r47036  
    676676                4167EBF5102962BA003D252A /* DefaultSharedWorkerRepository.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4167EBF3102962BA003D252A /* DefaultSharedWorkerRepository.cpp */; };
    677677                4167EBF6102962BA003D252A /* DefaultSharedWorkerRepository.h in Headers */ = {isa = PBXBuildFile; fileRef = 4167EBF4102962BA003D252A /* DefaultSharedWorkerRepository.h */; };
     678                416E29A6102FA962007FC14E /* WorkerReportingProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 416E29A5102FA962007FC14E /* WorkerReportingProxy.h */; };
    678679                416E75BE0EDF8FD700360E1D /* ScriptCallStack.h in Headers */ = {isa = PBXBuildFile; fileRef = 416E75BC0EDF8FD700360E1D /* ScriptCallStack.h */; };
    679680                416E75BF0EDF8FD700360E1D /* ScriptCallStack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 416E75BD0EDF8FD700360E1D /* ScriptCallStack.cpp */; };
     
    56745675                4167EBF3102962BA003D252A /* DefaultSharedWorkerRepository.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DefaultSharedWorkerRepository.cpp; path = workers/DefaultSharedWorkerRepository.cpp; sourceTree = "<group>"; };
    56755676                4167EBF4102962BA003D252A /* DefaultSharedWorkerRepository.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DefaultSharedWorkerRepository.h; path = workers/DefaultSharedWorkerRepository.h; sourceTree = "<group>"; };
     5677                416E29A5102FA962007FC14E /* WorkerReportingProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WorkerReportingProxy.h; path = workers/WorkerReportingProxy.h; sourceTree = "<group>"; };
    56765678                416E75BC0EDF8FD700360E1D /* ScriptCallStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptCallStack.h; sourceTree = "<group>"; };
    56775679                416E75BD0EDF8FD700360E1D /* ScriptCallStack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptCallStack.cpp; sourceTree = "<group>"; };
     
    1002710029                                2E43463E0F546A8200B0F1BA /* WorkerMessagingProxy.h */,
    1002810030                                2E43463F0F546A8200B0F1BA /* WorkerObjectProxy.h */,
     10031                                416E29A5102FA962007FC14E /* WorkerReportingProxy.h */,
    1002910032                                2E4346400F546A8200B0F1BA /* WorkerRunLoop.cpp */,
    1003010033                                2E4346410F546A8200B0F1BA /* WorkerRunLoop.h */,
     
    1718617189                                49484FCB102CF23C00187DD3 /* CanvasRenderingContext2D.h in Headers */,
    1718717190                                49484FCE102CF23C00187DD3 /* CanvasStyle.h in Headers */,
     17191                                416E29A6102FA962007FC14E /* WorkerReportingProxy.h in Headers */,
    1718817192                        );
    1718917193                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/workers/DedicatedWorkerContext.cpp

    r46845 r47036  
    4545    : WorkerContext(url, userAgent, thread)
    4646{
    47 }
    48 
    49 DedicatedWorkerContext::~DedicatedWorkerContext()
    50 {
    51     ASSERT(currentThread() == thread()->threadID());
    52     // Notify parent worker we are going away. This can free the WorkerThread object, so do not access it after this.
    53     thread()->workerObjectProxy().workerContextDestroyed();
    54 }
    55 
    56 void DedicatedWorkerContext::forwardException(const String& errorMessage, int lineNumber, const String& sourceURL)
    57 {
    58     thread()->workerObjectProxy().postExceptionToWorkerObject(errorMessage, lineNumber, sourceURL);
    59 }
    60 
    61 void DedicatedWorkerContext::addMessage(MessageDestination destination, MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
    62 {
    63     thread()->workerObjectProxy().postConsoleMessageToWorkerObject(destination, source, type, level, message, lineNumber, sourceURL);
    6447}
    6548
  • trunk/WebCore/workers/DedicatedWorkerContext.h

    r46845 r47036  
    4747            return adoptRef(new DedicatedWorkerContext(url, userAgent, thread));
    4848        }
    49         virtual ~DedicatedWorkerContext();
    5049
    5150        virtual bool isDedicatedWorkerContext() const { return true; }
     
    5352        // Overridden to allow us to check our pending activity after executing imported script.
    5453        virtual void importScripts(const Vector<String>& urls, const String& callerURL, int callerLine, ExceptionCode&);
    55 
    56         // ScriptExecutionContext
    57         virtual void addMessage(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
    58 
    59         virtual void forwardException(const String& errorMessage, int lineNumber, const String& sourceURL);
    6054
    6155        // EventTarget
  • trunk/WebCore/workers/DedicatedWorkerThread.cpp

    r46507 r47036  
    4646
    4747DedicatedWorkerThread::DedicatedWorkerThread(const KURL& url, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerObjectProxy& workerObjectProxy)
    48     : WorkerThread(url, userAgent, sourceCode, workerLoaderProxy)
     48    : WorkerThread(url, userAgent, sourceCode, workerLoaderProxy, workerObjectProxy)
    4949    , m_workerObjectProxy(workerObjectProxy)
    5050{
  • trunk/WebCore/workers/DefaultSharedWorkerRepository.cpp

    r46925 r47036  
    4545#include "SharedWorkerThread.h"
    4646#include "WorkerLoaderProxy.h"
     47#include "WorkerReportingProxy.h"
    4748#include "WorkerScriptLoader.h"
    4849#include "WorkerScriptLoaderClient.h"
     
    5253namespace WebCore {
    5354
    54 class SharedWorkerProxy : public ThreadSafeShared<SharedWorkerProxy>, public WorkerLoaderProxy {
     55class SharedWorkerProxy : public ThreadSafeShared<SharedWorkerProxy>, public WorkerLoaderProxy, public WorkerReportingProxy {
    5556public:
    5657    static PassRefPtr<SharedWorkerProxy> create(const String& name, const KURL& url) { return adoptRef(new SharedWorkerProxy(name, url)); }
     
    6768    virtual void postTaskForModeToWorkerContext(PassRefPtr<ScriptExecutionContext::Task>, const String&) { notImplemented(); }
    6869
     70    // WorkerReportingProxy
     71    virtual void postExceptionToWorkerObject(const String& errorMessage, int lineNumber, const String& sourceURL);
     72    virtual void postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, int lineNumber, const String& sourceURL);
     73    virtual void workerContextClosed();
     74    virtual void workerContextDestroyed();
     75
    6976    // Updates the list of the worker's documents, per section 4.5 of the WebWorkers spec.
    7077    void addToWorkerDocuments(ScriptExecutionContext*);
     78
    7179private:
    7280    SharedWorkerProxy(const String& name, const KURL&);
     
    8290    , m_url(url.copy())
    8391{
     92}
     93
     94void SharedWorkerProxy::postExceptionToWorkerObject(const String&, int, const String&)
     95{
     96    // FIXME: Log exceptions to all parent documents.
     97    notImplemented();
     98}
     99
     100void SharedWorkerProxy::postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageType, MessageLevel, const String&, int, const String&)
     101{
     102    // FIXME: Log console messages to all parent documents.
     103    notImplemented();
     104}
     105
     106void SharedWorkerProxy::workerContextClosed()
     107{
     108    m_closing = true;
     109}
     110
     111void SharedWorkerProxy::workerContextDestroyed()
     112{
     113    // FIXME: Remove the proxy from the repository once the worker context is destroyed.
     114    notImplemented();
    84115}
    85116
     
    178209    // Another loader may have already started up a thread for this proxy - if so, just send a connect to the pre-existing thread.
    179210    if (!proxy.thread()) {
    180         RefPtr<SharedWorkerThread> thread = SharedWorkerThread::create(proxy.name(), proxy.url(), userAgent, workerScript, proxy);
     211        RefPtr<SharedWorkerThread> thread = SharedWorkerThread::create(proxy.name(), proxy.url(), userAgent, workerScript, proxy, proxy);
    181212        proxy.setThread(thread);
    182213        thread->start();
  • trunk/WebCore/workers/SharedWorkerContext.cpp

    r46845 r47036  
    4040#include "NotImplemented.h"
    4141#include "SharedWorkerThread.h"
    42 #include "WorkerObjectProxy.h"
    4342
    4443namespace WebCore {
     
    5251SharedWorkerContext::~SharedWorkerContext()
    5352{
    54 }
    55 
    56 void SharedWorkerContext::forwardException(const String&, int, const String&)
    57 {
    58     // FIXME: forward to console (do not need to report to parent context).
    59 }
    60 
    61 void SharedWorkerContext::addMessage(MessageDestination, MessageSource, MessageType, MessageLevel, const String&, unsigned, const String&)
    62 {
    63     // FIXME: forward to console.
    64     notImplemented();
    6553}
    6654
  • trunk/WebCore/workers/SharedWorkerContext.h

    r46845 r47036  
    5151        virtual bool isSharedWorkerContext() const { return true; }
    5252
    53         // ScriptExecutionContext
    54         virtual void addMessage(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
    55 
    56         virtual void forwardException(const String& errorMessage, int lineNumber, const String& sourceURL);
    57 
    5853        // EventTarget
    5954        virtual SharedWorkerContext* toSharedWorkerContext() { return this; }
  • trunk/WebCore/workers/SharedWorkerThread.cpp

    r46845 r47036  
    3939namespace WebCore {
    4040
    41 PassRefPtr<SharedWorkerThread> SharedWorkerThread::create(const String& name, const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy)
     41PassRefPtr<SharedWorkerThread> SharedWorkerThread::create(const String& name, const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy)
    4242{
    43     return adoptRef(new SharedWorkerThread(name, scriptURL, userAgent, sourceCode, workerLoaderProxy));
     43    return adoptRef(new SharedWorkerThread(name, scriptURL, userAgent, sourceCode, workerLoaderProxy, workerReportingProxy));
    4444}
    4545
    46 SharedWorkerThread::SharedWorkerThread(const String& name, const KURL& url, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy)
    47     : WorkerThread(url, userAgent, sourceCode, workerLoaderProxy)
     46SharedWorkerThread::SharedWorkerThread(const String& name, const KURL& url, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy)
     47    : WorkerThread(url, userAgent, sourceCode, workerLoaderProxy, workerReportingProxy)
    4848    , m_name(name.copy())
    4949{
  • trunk/WebCore/workers/SharedWorkerThread.h

    r46845 r47036  
    3939    class SharedWorkerThread : public WorkerThread {
    4040    public:
    41         static PassRefPtr<SharedWorkerThread> create(const String& name, const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&);
     41        static PassRefPtr<SharedWorkerThread> create(const String& name, const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&);
    4242        ~SharedWorkerThread();
    4343
     
    4646
    4747    private:
    48         SharedWorkerThread(const String& name, const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&);
     48        SharedWorkerThread(const String& name, const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&);
    4949
    5050        String m_name;
  • trunk/WebCore/workers/WorkerContext.cpp

    r46845 r47036  
    6565WorkerContext::~WorkerContext()
    6666{
     67    ASSERT(currentThread() == thread()->threadID());
     68    // Notify proxy that we are going away. This can free the WorkerThread object, so do not access it after this.
     69    thread()->workerReportingProxy().workerContextDestroyed();
    6770}
    6871
     
    110113
    111114    m_closing = true;
     115    // Notify parent that this context is closed.
     116    thread()->workerReportingProxy().workerContextClosed();
    112117    m_thread->stop();
    113118}
     
    272277
    273278    if (!errorHandled)
    274         forwardException(errorMessage, lineNumber, sourceURL);
     279        thread()->workerReportingProxy().postExceptionToWorkerObject(errorMessage, lineNumber, sourceURL);
     280}
     281
     282void WorkerContext::addMessage(MessageDestination destination, MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
     283{
     284    thread()->workerReportingProxy().postConsoleMessageToWorkerObject(destination, source, type, level, message, lineNumber, sourceURL);
    275285}
    276286
  • trunk/WebCore/workers/WorkerContext.h

    r47022 r47036  
    4949    class WorkerContext : public RefCounted<WorkerContext>, public ScriptExecutionContext, public EventTarget {
    5050    public:
    51 
    5251        virtual ~WorkerContext();
    5352
     
    104103        // ScriptExecutionContext
    105104        virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL);
    106 
    107         virtual void forwardException(const String& errorMessage, int lineNumber, const String& sourceURL) = 0;
     105        virtual void addMessage(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
    108106
    109107        // These methods are used for GC marking. See JSWorkerContext::markChildren(MarkStack&) in
  • trunk/WebCore/workers/WorkerObjectProxy.h

    r45786 r47036  
    3434#if ENABLE(WORKERS)
    3535
    36 #include "Console.h"
     36#include "WorkerReportingProxy.h"
    3737
    3838#include <wtf/PassOwnPtr.h>
     
    4141
    4242    class MessagePortChannel;
    43     class String;
    4443
    4544    // A proxy to talk to the worker object.
    46     class WorkerObjectProxy {
     45    class WorkerObjectProxy : public WorkerReportingProxy {
    4746    public:
    48         virtual ~WorkerObjectProxy() {}
    49 
    5047        virtual void postMessageToWorkerObject(const String&, PassOwnPtr<MessagePortChannel>) = 0;
    5148
    52         virtual void postExceptionToWorkerObject(const String& errorMessage, int lineNumber, const String& sourceURL) = 0;
    53 
    54         virtual void postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, int lineNumber, const String& sourceURL) = 0;
    55 
    5649        virtual void confirmMessageFromWorkerObject(bool hasPendingActivity) = 0;
    57 
    5850        virtual void reportPendingActivity(bool hasPendingActivity) = 0;
    5951
    60         virtual void workerContextDestroyed() = 0;
     52        // No need to notify the parent page context when dedicated workers are closing.
     53        virtual void workerContextClosed() { }
    6154    };
    6255
  • trunk/WebCore/workers/WorkerReportingProxy.h

    r47035 r47036  
    2929 */
    3030
    31 #ifndef WorkerObjectProxy_h
    32 #define WorkerObjectProxy_h
     31#ifndef WorkerReportingProxy_h
     32#define WorkerReportingProxy_h
    3333
    3434#if ENABLE(WORKERS)
     
    3636#include "Console.h"
    3737
    38 #include <wtf/PassOwnPtr.h>
    39 
    4038namespace WebCore {
    4139
    42     class MessagePortChannel;
    4340    class String;
    4441
    45     // A proxy to talk to the worker object.
    46     class WorkerObjectProxy {
     42    // APIs used by workers to report console activity.
     43    class WorkerReportingProxy {
    4744    public:
    48         virtual ~WorkerObjectProxy() {}
    49 
    50         virtual void postMessageToWorkerObject(const String&, PassOwnPtr<MessagePortChannel>) = 0;
     45        virtual ~WorkerReportingProxy() {}
    5146
    5247        virtual void postExceptionToWorkerObject(const String& errorMessage, int lineNumber, const String& sourceURL) = 0;
     
    5449        virtual void postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, int lineNumber, const String& sourceURL) = 0;
    5550
    56         virtual void confirmMessageFromWorkerObject(bool hasPendingActivity) = 0;
     51        // Invoked when close() is invoked on the worker context.
     52        virtual void workerContextClosed() = 0;
    5753
    58         virtual void reportPendingActivity(bool hasPendingActivity) = 0;
    59 
     54        // Invoked when the thread has stopped.
    6055        virtual void workerContextDestroyed() = 0;
    6156    };
    62 
    6357} // namespace WebCore
    6458
    6559#endif // ENABLE(WORKERS)
    6660
    67 #endif // WorkerObjectProxy_h
     61#endif // WorkerReportingProxy_h
  • trunk/WebCore/workers/WorkerThread.cpp

    r46507 r47036  
    6262}
    6363
    64 WorkerThread::WorkerThread(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy)
     64WorkerThread::WorkerThread(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy)
    6565    : m_threadID(0)
    6666    , m_workerLoaderProxy(workerLoaderProxy)
     67    , m_workerReportingProxy(workerReportingProxy)
    6768    , m_startupData(WorkerThreadStartupData::create(scriptURL, userAgent, sourceCode))
    6869{
  • trunk/WebCore/workers/WorkerThread.h

    r46507 r47036  
    4141    class WorkerContext;
    4242    class WorkerLoaderProxy;
     43    class WorkerReportingProxy;
    4344    struct WorkerThreadStartupData;
    4445
     
    5354        WorkerRunLoop& runLoop() { return m_runLoop; }
    5455        WorkerLoaderProxy& workerLoaderProxy() const { return m_workerLoaderProxy; }
     56        WorkerReportingProxy& workerReportingProxy() const { return m_workerReportingProxy; }
    5557
    5658    protected:
    57         WorkerThread(const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&);
     59        WorkerThread(const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&);
    5860
    5961        // Factory method for creating a new worker context for the thread.
     
    7375        WorkerRunLoop m_runLoop;
    7476        WorkerLoaderProxy& m_workerLoaderProxy;
     77        WorkerReportingProxy& m_workerReportingProxy;
    7578
    7679        RefPtr<WorkerContext> m_workerContext;
Note: See TracChangeset for help on using the changeset viewer.