Changeset 199853 in webkit


Ignore:
Timestamp:
Apr 21, 2016 6:03:39 PM (8 years ago)
Author:
beidson@apple.com
Message:

Modern IDB (Workers): Get the IDBConnectionProxy from the Document to the WorkerGlobalScope.
https://bugs.webkit.org/show_bug.cgi?id=156877

Reviewed by Tim Horton.

Source/WebCore:

No new tests (Covered by changes to existing tests).

  • workers/WorkerMessagingProxy.cpp:

(WebCore::WorkerMessagingProxy::startWorkerGlobalScope): This is the point on the main thread

where we can get the IDBConnectionProxy from the Document and pass it down through Worker
machinery so it can end up at the WorkerGlobalScope.

Everything else is this patch is just passing it along as needed.

And cleaning up header style for neglected headers.

  • workers/DedicatedWorkerGlobalScope.cpp:

(WebCore::DedicatedWorkerGlobalScope::create):
(WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):

  • workers/DedicatedWorkerGlobalScope.h:
  • workers/DedicatedWorkerThread.cpp:

(WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
(WebCore::DedicatedWorkerThread::createWorkerGlobalScope):

  • workers/DedicatedWorkerThread.h:

(WebCore::DedicatedWorkerThread::create):
(WebCore::DedicatedWorkerThread::workerObjectProxy):

  • workers/WorkerGlobalScope.cpp:

(WebCore::WorkerGlobalScope::WorkerGlobalScope):
(WebCore::WorkerGlobalScope::idbConnectionProxy):

  • workers/WorkerGlobalScope.h:
  • workers/WorkerThread.cpp:

(WebCore::WorkerThread::WorkerThread):
(WebCore::WorkerThread::idbConnectionProxy):

  • workers/WorkerThread.h:

(WebCore::WorkerThread::threadID):
(WebCore::WorkerThread::runLoop):
(WebCore::WorkerThread::workerLoaderProxy):
(WebCore::WorkerThread::workerReportingProxy):
(WebCore::WorkerThread::getNotificationClient):
(WebCore::WorkerThread::setNotificationClient):
(WebCore::WorkerThread::workerGlobalScope):

LayoutTests:

  • storage/indexeddb/modern/workers-enable-expected.txt:
Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r199852 r199853  
     12016-04-21  Brady Eidson  <beidson@apple.com>
     2
     3        Modern IDB (Workers): Get the IDBConnectionProxy from the Document to the WorkerGlobalScope.
     4        https://bugs.webkit.org/show_bug.cgi?id=156877
     5
     6        Reviewed by Tim Horton.
     7
     8        * storage/indexeddb/modern/workers-enable-expected.txt:
     9
    1102016-04-21  Joseph Pecoraro  <pecoraro@apple.com>
    211
  • trunk/LayoutTests/storage/indexeddb/modern/workers-enable-expected.txt

    r199835 r199853  
    66Starting worker: resources/workers-enable.js
    77PASS [Worker] self.indexedDB is defined.
    8 FAIL [Worker] self.indexedDB should be non-null. Was null
    9 FAIL [Worker] self.indexedDB instanceof IDBFactory should be true. Was false.
     8PASS [Worker] self.indexedDB is non-null.
     9PASS [Worker] self.indexedDB instanceof IDBFactory is true
    1010PASS successfullyParsed is true
    1111
  • trunk/Source/WebCore/ChangeLog

    r199851 r199853  
     12016-04-21  Brady Eidson  <beidson@apple.com>
     2
     3        Modern IDB (Workers): Get the IDBConnectionProxy from the Document to the WorkerGlobalScope.
     4        https://bugs.webkit.org/show_bug.cgi?id=156877
     5
     6        Reviewed by Tim Horton.
     7
     8        No new tests (Covered by changes to existing tests).
     9
     10        * workers/WorkerMessagingProxy.cpp:
     11        (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): This is the point on the main thread
     12          where we can get the IDBConnectionProxy from the Document and pass it down through Worker
     13          machinery so it can end up at the WorkerGlobalScope.
     14       
     15        Everything else is this patch is just passing it along as needed.
     16
     17        And cleaning up header style for neglected headers.
     18
     19        * workers/DedicatedWorkerGlobalScope.cpp:
     20        (WebCore::DedicatedWorkerGlobalScope::create):
     21        (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
     22        * workers/DedicatedWorkerGlobalScope.h:
     23
     24        * workers/DedicatedWorkerThread.cpp:
     25        (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
     26        (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
     27        * workers/DedicatedWorkerThread.h:
     28        (WebCore::DedicatedWorkerThread::create):
     29        (WebCore::DedicatedWorkerThread::workerObjectProxy):
     30
     31        * workers/WorkerGlobalScope.cpp:
     32        (WebCore::WorkerGlobalScope::WorkerGlobalScope):
     33        (WebCore::WorkerGlobalScope::idbConnectionProxy):
     34        * workers/WorkerGlobalScope.h:
     35
     36        * workers/WorkerThread.cpp:
     37        (WebCore::WorkerThread::WorkerThread):
     38        (WebCore::WorkerThread::idbConnectionProxy):
     39        * workers/WorkerThread.h:
     40        (WebCore::WorkerThread::threadID):
     41        (WebCore::WorkerThread::runLoop):
     42        (WebCore::WorkerThread::workerLoaderProxy):
     43        (WebCore::WorkerThread::workerReportingProxy):
     44        (WebCore::WorkerThread::getNotificationClient):
     45        (WebCore::WorkerThread::setNotificationClient):
     46        (WebCore::WorkerThread::workerGlobalScope):
     47
    1482016-04-21  Anders Carlsson  <andersca@apple.com>
    249
  • trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp

    r196242 r199853  
    11/*
    22 * Copyright (C) 2009 Google Inc. All rights reserved.
     3 * Copyright (C) 2016 Apple Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    4142namespace WebCore {
    4243
    43 Ref<DedicatedWorkerGlobalScope> DedicatedWorkerGlobalScope::create(const URL& url, const String& userAgent, DedicatedWorkerThread& thread, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin)
     44Ref<DedicatedWorkerGlobalScope> DedicatedWorkerGlobalScope::create(const URL& url, const String& userAgent, DedicatedWorkerThread& thread, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin, IDBClient::IDBConnectionProxy* connectionProxy)
    4445{
    45     Ref<DedicatedWorkerGlobalScope> context = adoptRef(*new DedicatedWorkerGlobalScope(url, userAgent, thread, shouldBypassMainWorldContentSecurityPolicy, topOrigin));
     46    Ref<DedicatedWorkerGlobalScope> context = adoptRef(*new DedicatedWorkerGlobalScope(url, userAgent, thread, shouldBypassMainWorldContentSecurityPolicy, topOrigin, connectionProxy));
    4647    if (!shouldBypassMainWorldContentSecurityPolicy)
    4748        context->applyContentSecurityPolicyResponseHeaders(contentSecurityPolicyResponseHeaders);
     
    4950}
    5051
    51 DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope(const URL& url, const String& userAgent, DedicatedWorkerThread& thread, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin)
    52     : WorkerGlobalScope(url, userAgent, thread, shouldBypassMainWorldContentSecurityPolicy, topOrigin)
     52DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope(const URL& url, const String& userAgent, DedicatedWorkerThread& thread, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin, IDBClient::IDBConnectionProxy* connectionProxy)
     53    : WorkerGlobalScope(url, userAgent, thread, shouldBypassMainWorldContentSecurityPolicy, topOrigin, connectionProxy)
    5354{
    5455}
  • trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h

    r197563 r199853  
    11/*
    22 * Copyright (C) 2009 Google Inc. All rights reserved.
     3 * Copyright (C) 2016 Apple Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    2930 */
    3031
    31 #ifndef DedicatedWorkerGlobalScope_h
    32 #define DedicatedWorkerGlobalScope_h
     32#pragma once
    3333
    3434#include "MessagePort.h"
     
    4343    public:
    4444        typedef WorkerGlobalScope Base;
    45         static Ref<DedicatedWorkerGlobalScope> create(const URL&, const String& userAgent, DedicatedWorkerThread&, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin);
     45        static Ref<DedicatedWorkerGlobalScope> create(const URL&, const String& userAgent, DedicatedWorkerThread&, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin, IDBClient::IDBConnectionProxy*);
    4646        virtual ~DedicatedWorkerGlobalScope();
    4747
     
    6161
    6262    private:
    63         DedicatedWorkerGlobalScope(const URL&, const String& userAgent, DedicatedWorkerThread&, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin);
     63        DedicatedWorkerGlobalScope(const URL&, const String& userAgent, DedicatedWorkerThread&, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin, IDBClient::IDBConnectionProxy*);
    6464    };
    6565
    6666} // namespace WebCore
    67 
    68 #endif // DedicatedWorkerGlobalScope_h
  • trunk/Source/WebCore/workers/DedicatedWorkerThread.cpp

    r196242 r199853  
    11/*
    22 * Copyright (C) 2009 Google Inc. All rights reserved.
     3 * Copyright (C) 2016 Apple Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    3031
    3132#include "config.h"
    32 
    3333#include "DedicatedWorkerThread.h"
    3434
     
    3939namespace WebCore {
    4040
    41 DedicatedWorkerThread::DedicatedWorkerThread(const URL& url, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerObjectProxy& workerObjectProxy, WorkerThreadStartMode startMode, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin* topOrigin)
    42     : WorkerThread(url, userAgent, sourceCode, workerLoaderProxy, workerObjectProxy, startMode, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, topOrigin)
     41DedicatedWorkerThread::DedicatedWorkerThread(const URL& url, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerObjectProxy& workerObjectProxy, WorkerThreadStartMode startMode, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin* topOrigin, IDBClient::IDBConnectionProxy* connectionProxy)
     42    : WorkerThread(url, userAgent, sourceCode, workerLoaderProxy, workerObjectProxy, startMode, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, topOrigin, connectionProxy)
    4343    , m_workerObjectProxy(workerObjectProxy)
    4444{
     
    5151Ref<WorkerGlobalScope> DedicatedWorkerThread::createWorkerGlobalScope(const URL& url, const String& userAgent, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin)
    5252{
    53     return DedicatedWorkerGlobalScope::create(url, userAgent, *this, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, topOrigin);
     53    return DedicatedWorkerGlobalScope::create(url, userAgent, *this, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, topOrigin, idbConnectionProxy());
    5454}
    5555
  • trunk/Source/WebCore/workers/DedicatedWorkerThread.h

    r197563 r199853  
    11/*
    22 * Copyright (C) 2009 Google Inc. All rights reserved.
     3 * Copyright (C) 2016 Apple Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    2829 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2930 */
    30 #ifndef DedicatedWorkerThread_h
    31 #define DedicatedWorkerThread_h
     31
     32#pragma once
    3233
    3334#include "WorkerThread.h"
     
    3536namespace WebCore {
    3637
    37     class ContentSecurityPolicyResponseHeaders;
    38     class WorkerObjectProxy;
     38class ContentSecurityPolicyResponseHeaders;
     39class WorkerObjectProxy;
    3940
    40     class DedicatedWorkerThread : public WorkerThread {
    41     public:
    42         template<typename... Args> static Ref<DedicatedWorkerThread> create(Args&&... args)
    43         {
    44             return adoptRef(*new DedicatedWorkerThread(std::forward<Args>(args)...));
    45         }
    46         virtual ~DedicatedWorkerThread();
     41class DedicatedWorkerThread : public WorkerThread {
     42public:
     43    template<typename... Args> static Ref<DedicatedWorkerThread> create(Args&&... args)
     44    {
     45        return adoptRef(*new DedicatedWorkerThread(std::forward<Args>(args)...));
     46    }
     47    virtual ~DedicatedWorkerThread();
    4748
    48         WorkerObjectProxy& workerObjectProxy() const { return m_workerObjectProxy; }
     49    WorkerObjectProxy& workerObjectProxy() const { return m_workerObjectProxy; }
    4950
    50     protected:
    51         Ref<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& userAgent, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin) override;
    52         void runEventLoop() override;
     51protected:
     52    Ref<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& userAgent, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin) override;
     53    void runEventLoop() override;
    5354
    54     private:
    55         DedicatedWorkerThread(const URL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerObjectProxy&, WorkerThreadStartMode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin* topOrigin);
     55private:
     56    DedicatedWorkerThread(const URL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerObjectProxy&, WorkerThreadStartMode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin* topOrigin, IDBClient::IDBConnectionProxy*);
    5657
    57         WorkerObjectProxy& m_workerObjectProxy;
    58     };
     58    WorkerObjectProxy& m_workerObjectProxy;
     59};
     60
    5961} // namespace WebCore
    60 
    61 #endif // DedicatedWorkerThread_h
  • trunk/Source/WebCore/workers/WorkerGlobalScope.cpp

    r199797 r199853  
    3737#include "Event.h"
    3838#include "ExceptionCode.h"
     39#include "IDBConnectionProxy.h"
    3940#include "InspectorConsoleInstrumentation.h"
    4041#include "MessagePort.h"
     
    6364namespace WebCore {
    6465
    65 WorkerGlobalScope::WorkerGlobalScope(const URL& url, const String& userAgent, WorkerThread& thread, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin)
     66WorkerGlobalScope::WorkerGlobalScope(const URL& url, const String& userAgent, WorkerThread& thread, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin, IDBClient::IDBConnectionProxy* connectionProxy)
    6667    : m_url(url)
    6768    , m_userAgent(userAgent)
     
    7273    , m_eventQueue(*this)
    7374    , m_topOrigin(topOrigin)
     75#if ENABLE(INDEXED_DATABASE)
     76    , m_connectionProxy(connectionProxy)
     77#endif
    7478{
    7579    setSecurityOriginPolicy(SecurityOriginPolicy::create(SecurityOrigin::create(url)));
     
    116120IDBClient::IDBConnectionProxy* WorkerGlobalScope::idbConnectionProxy()
    117121{
    118     // FIXME: Implement
    119 
     122#if ENABLE(INDEXED_DATABASE_IN_WORKERS)
     123    return m_connectionProxy.get();
     124#else
    120125    return nullptr;
     126#endif
    121127}
    122128#endif // ENABLE(INDEXED_DATABASE)
  • trunk/Source/WebCore/workers/WorkerGlobalScope.h

    r199797 r199853  
    5353class WorkerNavigator;
    5454class WorkerThread;
     55
     56namespace IDBClient {
     57class IDBConnectionProxy;
     58}
    5559
    5660class WorkerGlobalScope : public RefCounted<WorkerGlobalScope>, public Supplementable<WorkerGlobalScope>, public ScriptExecutionContext, public EventTargetWithInlineData {
     
    141145
    142146protected:
    143     WorkerGlobalScope(const URL&, const String& userAgent, WorkerThread&, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin);
     147    WorkerGlobalScope(const URL&, const String& userAgent, WorkerThread&, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin, IDBClient::IDBConnectionProxy*);
    144148    void applyContentSecurityPolicyResponseHeaders(const ContentSecurityPolicyResponseHeaders&);
    145149
     
    178182
    179183    RefPtr<SecurityOrigin> m_topOrigin;
     184
     185#if ENABLE(INDEXED_DATABASE)
     186    RefPtr<IDBClient::IDBConnectionProxy> m_connectionProxy;
     187#endif
    180188};
    181189
  • trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp

    r196242 r199853  
    11/*
    2  * Copyright (C) 2008 Apple Inc. All Rights Reserved.
     2 * Copyright (C) 2008, 2016 Apple Inc. All Rights Reserved.
    33 * Copyright (C) 2009 Google Inc. All Rights Reserved.
    44 *
     
    7878    ASSERT(m_scriptExecutionContext);
    7979    Document& document = downcast<Document>(*m_scriptExecutionContext);
    80     RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(scriptURL, userAgent, sourceCode, *this, *this, startMode, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, document.topOrigin());
     80
     81    RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(scriptURL, userAgent, sourceCode, *this, *this, startMode, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, document.topOrigin(), document.idbConnectionProxy());
    8182    workerThreadCreated(thread);
    8283    thread->start();
  • trunk/Source/WebCore/workers/WorkerThread.cpp

    r196242 r199853  
    3131#include "ContentSecurityPolicyResponseHeaders.h"
    3232#include "DedicatedWorkerGlobalScope.h"
     33#include "IDBConnectionProxy.h"
    3334#include "ScriptSourceCode.h"
    3435#include "SecurityOrigin.h"
     
    9394}
    9495
    95 WorkerThread::WorkerThread(const URL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy, WorkerThreadStartMode startMode, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin* topOrigin)
     96WorkerThread::WorkerThread(const URL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy, WorkerThreadStartMode startMode, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin* topOrigin, IDBClient::IDBConnectionProxy* connectionProxy)
    9697    : m_threadID(0)
    9798    , m_workerLoaderProxy(workerLoaderProxy)
     
    100101#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
    101102    , m_notificationClient(0)
     103#endif
     104#if ENABLE(INDEXED_DATABASE)
     105    , m_idbConnectionProxy(connectionProxy)
    102106#endif
    103107{
     
    234238}
    235239
     240IDBClient::IDBConnectionProxy* WorkerThread::idbConnectionProxy()
     241{
     242#if ENABLE(INDEXED_DATABASE)
     243    return m_idbConnectionProxy.get();
     244#else
     245    return nullptr;
     246#endif
     247}
     248
    236249} // namespace WebCore
  • trunk/Source/WebCore/workers/WorkerThread.h

    r196242 r199853  
    11/*
    2  * Copyright (C) 2008 Apple Inc. All Rights Reserved.
     2 * Copyright (C) 2008, 2016 Apple Inc. All Rights Reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2525 */
    2626
    27 #ifndef WorkerThread_h
    28 #define WorkerThread_h
     27#pragma once
    2928
    3029#include "WorkerRunLoop.h"
     
    3635namespace WebCore {
    3736
    38     class ContentSecurityPolicyResponseHeaders;
    39     class URL;
    40     class NotificationClient;
    41     class SecurityOrigin;
    42     class WorkerGlobalScope;
    43     class WorkerLoaderProxy;
    44     class WorkerReportingProxy;
    45     struct WorkerThreadStartupData;
     37class ContentSecurityPolicyResponseHeaders;
     38class URL;
     39class NotificationClient;
     40class SecurityOrigin;
     41class WorkerGlobalScope;
     42class WorkerLoaderProxy;
     43class WorkerReportingProxy;
    4644
    47     enum WorkerThreadStartMode { DontPauseWorkerGlobalScopeOnStart, PauseWorkerGlobalScopeOnStart };
     45enum WorkerThreadStartMode { DontPauseWorkerGlobalScopeOnStart, PauseWorkerGlobalScopeOnStart };
    4846
    49     class WorkerThread : public RefCounted<WorkerThread> {
    50     public:
    51         virtual ~WorkerThread();
     47namespace IDBClient {
     48class IDBConnectionProxy;
     49}
    5250
    53         bool start();
    54         void stop();
     51struct WorkerThreadStartupData;
    5552
    56         ThreadIdentifier threadID() const { return m_threadID; }
    57         WorkerRunLoop& runLoop() { return m_runLoop; }
    58         WorkerLoaderProxy& workerLoaderProxy() const { return m_workerLoaderProxy; }
    59         WorkerReportingProxy& workerReportingProxy() const { return m_workerReportingProxy; }
     53class WorkerThread : public RefCounted<WorkerThread> {
     54public:
     55    virtual ~WorkerThread();
    6056
    61         // Number of active worker threads.
    62         WEBCORE_EXPORT static unsigned workerThreadCount();
    63         static void releaseFastMallocFreeMemoryInAllThreads();
     57    bool start();
     58    void stop();
     59
     60    ThreadIdentifier threadID() const { return m_threadID; }
     61    WorkerRunLoop& runLoop() { return m_runLoop; }
     62    WorkerLoaderProxy& workerLoaderProxy() const { return m_workerLoaderProxy; }
     63    WorkerReportingProxy& workerReportingProxy() const { return m_workerReportingProxy; }
     64
     65    // Number of active worker threads.
     66    WEBCORE_EXPORT static unsigned workerThreadCount();
     67    static void releaseFastMallocFreeMemoryInAllThreads();
    6468
    6569#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
    66         NotificationClient* getNotificationClient() { return m_notificationClient; }
    67         void setNotificationClient(NotificationClient* client) { m_notificationClient = client; }
     70    NotificationClient* getNotificationClient() { return m_notificationClient; }
     71    void setNotificationClient(NotificationClient* client) { m_notificationClient = client; }
    6872#endif
    6973
    70     protected:
    71         WorkerThread(const URL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin* topOrigin);
     74protected:
     75    WorkerThread(const URL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin* topOrigin, IDBClient::IDBConnectionProxy*);
    7276
    73         // Factory method for creating a new worker context for the thread.
    74         virtual Ref<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& userAgent, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin) = 0;
     77    // Factory method for creating a new worker context for the thread.
     78    virtual Ref<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& userAgent, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin) = 0;
    7579
    76         // Executes the event loop for the worker thread. Derived classes can override to perform actions before/after entering the event loop.
    77         virtual void runEventLoop();
     80    // Executes the event loop for the worker thread. Derived classes can override to perform actions before/after entering the event loop.
     81    virtual void runEventLoop();
    7882
    79         WorkerGlobalScope* workerGlobalScope() { return m_workerGlobalScope.get(); }
     83    WorkerGlobalScope* workerGlobalScope() { return m_workerGlobalScope.get(); }
    8084
    81     private:
    82         // Static function executed as the core routine on the new thread. Passed a pointer to a WorkerThread object.
    83         static void workerThreadStart(void*);
    84         void workerThread();
     85    IDBClient::IDBConnectionProxy* idbConnectionProxy();
    8586
    86         ThreadIdentifier m_threadID;
    87         WorkerRunLoop m_runLoop;
    88         WorkerLoaderProxy& m_workerLoaderProxy;
    89         WorkerReportingProxy& m_workerReportingProxy;
     87private:
     88    // Static function executed as the core routine on the new thread. Passed a pointer to a WorkerThread object.
     89    static void workerThreadStart(void*);
     90    void workerThread();
    9091
    91         RefPtr<WorkerGlobalScope> m_workerGlobalScope;
    92         Lock m_threadCreationMutex;
     92    ThreadIdentifier m_threadID;
     93    WorkerRunLoop m_runLoop;
     94    WorkerLoaderProxy& m_workerLoaderProxy;
     95    WorkerReportingProxy& m_workerReportingProxy;
    9396
    94         std::unique_ptr<WorkerThreadStartupData> m_startupData;
     97    RefPtr<WorkerGlobalScope> m_workerGlobalScope;
     98    Lock m_threadCreationMutex;
     99
     100    std::unique_ptr<WorkerThreadStartupData> m_startupData;
    95101
    96102#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
    97         NotificationClient* m_notificationClient;
     103    NotificationClient* m_notificationClient;
    98104#endif
    99     };
     105
     106#if ENABLE(INDEXED_DATABASE)
     107    RefPtr<IDBClient::IDBConnectionProxy> m_idbConnectionProxy;
     108#endif
     109};
    100110
    101111} // namespace WebCore
    102112
    103 #endif // WorkerThread_h
    104 
Note: See TracChangeset for help on using the changeset viewer.