Title: [199853] trunk
Revision
199853
Author
beid...@apple.com
Date
2016-04-21 18:03:39 -0700 (Thu, 21 Apr 2016)

Log 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:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (199852 => 199853)


--- trunk/LayoutTests/ChangeLog	2016-04-22 00:50:09 UTC (rev 199852)
+++ trunk/LayoutTests/ChangeLog	2016-04-22 01:03:39 UTC (rev 199853)
@@ -1,3 +1,12 @@
+2016-04-21  Brady Eidson  <beid...@apple.com>
+
+        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.
+
+        * storage/indexeddb/modern/workers-enable-expected.txt:
+
 2016-04-21  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: sourceMappingURL not loaded in generated script

Modified: trunk/LayoutTests/storage/indexeddb/modern/workers-enable-expected.txt (199852 => 199853)


--- trunk/LayoutTests/storage/indexeddb/modern/workers-enable-expected.txt	2016-04-22 00:50:09 UTC (rev 199852)
+++ trunk/LayoutTests/storage/indexeddb/modern/workers-enable-expected.txt	2016-04-22 01:03:39 UTC (rev 199853)
@@ -5,8 +5,8 @@
 
 Starting worker: resources/workers-enable.js
 PASS [Worker] self.indexedDB is defined.
-FAIL [Worker] self.indexedDB should be non-null. Was null
-FAIL [Worker] self.indexedDB instanceof IDBFactory should be true. Was false.
+PASS [Worker] self.indexedDB is non-null.
+PASS [Worker] self.indexedDB instanceof IDBFactory is true
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/Source/WebCore/ChangeLog (199852 => 199853)


--- trunk/Source/WebCore/ChangeLog	2016-04-22 00:50:09 UTC (rev 199852)
+++ trunk/Source/WebCore/ChangeLog	2016-04-22 01:03:39 UTC (rev 199853)
@@ -1,3 +1,50 @@
+2016-04-21  Brady Eidson  <beid...@apple.com>
+
+        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.
+
+        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):
+
 2016-04-21  Anders Carlsson  <ander...@apple.com>
 
         Fix crashes when loading SVG images.

Modified: trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp (199852 => 199853)


--- trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp	2016-04-22 00:50:09 UTC (rev 199852)
+++ trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp	2016-04-22 01:03:39 UTC (rev 199853)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -40,16 +41,16 @@
 
 namespace WebCore {
 
-Ref<DedicatedWorkerGlobalScope> DedicatedWorkerGlobalScope::create(const URL& url, const String& userAgent, DedicatedWorkerThread& thread, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin)
+Ref<DedicatedWorkerGlobalScope> DedicatedWorkerGlobalScope::create(const URL& url, const String& userAgent, DedicatedWorkerThread& thread, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin, IDBClient::IDBConnectionProxy* connectionProxy)
 {
-    Ref<DedicatedWorkerGlobalScope> context = adoptRef(*new DedicatedWorkerGlobalScope(url, userAgent, thread, shouldBypassMainWorldContentSecurityPolicy, topOrigin));
+    Ref<DedicatedWorkerGlobalScope> context = adoptRef(*new DedicatedWorkerGlobalScope(url, userAgent, thread, shouldBypassMainWorldContentSecurityPolicy, topOrigin, connectionProxy));
     if (!shouldBypassMainWorldContentSecurityPolicy)
         context->applyContentSecurityPolicyResponseHeaders(contentSecurityPolicyResponseHeaders);
     return context;
 }
 
-DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope(const URL& url, const String& userAgent, DedicatedWorkerThread& thread, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin)
-    : WorkerGlobalScope(url, userAgent, thread, shouldBypassMainWorldContentSecurityPolicy, topOrigin)
+DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope(const URL& url, const String& userAgent, DedicatedWorkerThread& thread, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin, IDBClient::IDBConnectionProxy* connectionProxy)
+    : WorkerGlobalScope(url, userAgent, thread, shouldBypassMainWorldContentSecurityPolicy, topOrigin, connectionProxy)
 {
 }
 

Modified: trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h (199852 => 199853)


--- trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h	2016-04-22 00:50:09 UTC (rev 199852)
+++ trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h	2016-04-22 01:03:39 UTC (rev 199853)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -28,8 +29,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef DedicatedWorkerGlobalScope_h
-#define DedicatedWorkerGlobalScope_h
+#pragma once
 
 #include "MessagePort.h"
 #include "WorkerGlobalScope.h"
@@ -42,7 +42,7 @@
     class DedicatedWorkerGlobalScope : public WorkerGlobalScope {
     public:
         typedef WorkerGlobalScope Base;
-        static Ref<DedicatedWorkerGlobalScope> create(const URL&, const String& userAgent, DedicatedWorkerThread&, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin);
+        static Ref<DedicatedWorkerGlobalScope> create(const URL&, const String& userAgent, DedicatedWorkerThread&, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin, IDBClient::IDBConnectionProxy*);
         virtual ~DedicatedWorkerGlobalScope();
 
         bool isDedicatedWorkerGlobalScope() const override { return true; }
@@ -60,9 +60,7 @@
         DedicatedWorkerThread& thread();
 
     private:
-        DedicatedWorkerGlobalScope(const URL&, const String& userAgent, DedicatedWorkerThread&, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin);
+        DedicatedWorkerGlobalScope(const URL&, const String& userAgent, DedicatedWorkerThread&, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin, IDBClient::IDBConnectionProxy*);
     };
 
 } // namespace WebCore
-
-#endif // DedicatedWorkerGlobalScope_h

Modified: trunk/Source/WebCore/workers/DedicatedWorkerThread.cpp (199852 => 199853)


--- trunk/Source/WebCore/workers/DedicatedWorkerThread.cpp	2016-04-22 00:50:09 UTC (rev 199852)
+++ trunk/Source/WebCore/workers/DedicatedWorkerThread.cpp	2016-04-22 01:03:39 UTC (rev 199853)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -29,7 +30,6 @@
  */
 
 #include "config.h"
-
 #include "DedicatedWorkerThread.h"
 
 #include "DedicatedWorkerGlobalScope.h"
@@ -38,8 +38,8 @@
 
 namespace WebCore {
 
-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)
-    : WorkerThread(url, userAgent, sourceCode, workerLoaderProxy, workerObjectProxy, startMode, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, topOrigin)
+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, IDBClient::IDBConnectionProxy* connectionProxy)
+    : WorkerThread(url, userAgent, sourceCode, workerLoaderProxy, workerObjectProxy, startMode, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, topOrigin, connectionProxy)
     , m_workerObjectProxy(workerObjectProxy)
 {
 }
@@ -50,7 +50,7 @@
 
 Ref<WorkerGlobalScope> DedicatedWorkerThread::createWorkerGlobalScope(const URL& url, const String& userAgent, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin)
 {
-    return DedicatedWorkerGlobalScope::create(url, userAgent, *this, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, topOrigin);
+    return DedicatedWorkerGlobalScope::create(url, userAgent, *this, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, topOrigin, idbConnectionProxy());
 }
 
 void DedicatedWorkerThread::runEventLoop()

Modified: trunk/Source/WebCore/workers/DedicatedWorkerThread.h (199852 => 199853)


--- trunk/Source/WebCore/workers/DedicatedWorkerThread.h	2016-04-22 00:50:09 UTC (rev 199852)
+++ trunk/Source/WebCore/workers/DedicatedWorkerThread.h	2016-04-22 01:03:39 UTC (rev 199853)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -27,35 +28,34 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-#ifndef DedicatedWorkerThread_h
-#define DedicatedWorkerThread_h
 
+#pragma once
+
 #include "WorkerThread.h"
 
 namespace WebCore {
 
-    class ContentSecurityPolicyResponseHeaders;
-    class WorkerObjectProxy;
+class ContentSecurityPolicyResponseHeaders;
+class WorkerObjectProxy;
 
-    class DedicatedWorkerThread : public WorkerThread {
-    public:
-        template<typename... Args> static Ref<DedicatedWorkerThread> create(Args&&... args)
-        {
-            return adoptRef(*new DedicatedWorkerThread(std::forward<Args>(args)...));
-        }
-        virtual ~DedicatedWorkerThread();
+class DedicatedWorkerThread : public WorkerThread {
+public:
+    template<typename... Args> static Ref<DedicatedWorkerThread> create(Args&&... args)
+    {
+        return adoptRef(*new DedicatedWorkerThread(std::forward<Args>(args)...));
+    }
+    virtual ~DedicatedWorkerThread();
 
-        WorkerObjectProxy& workerObjectProxy() const { return m_workerObjectProxy; }
+    WorkerObjectProxy& workerObjectProxy() const { return m_workerObjectProxy; }
 
-    protected:
-        Ref<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& userAgent, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin) override;
-        void runEventLoop() override;
+protected:
+    Ref<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& userAgent, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin) override;
+    void runEventLoop() override;
 
-    private:
-        DedicatedWorkerThread(const URL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerObjectProxy&, WorkerThreadStartMode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin* topOrigin);
+private:
+    DedicatedWorkerThread(const URL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerObjectProxy&, WorkerThreadStartMode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin* topOrigin, IDBClient::IDBConnectionProxy*);
 
-        WorkerObjectProxy& m_workerObjectProxy;
-    };
+    WorkerObjectProxy& m_workerObjectProxy;
+};
+
 } // namespace WebCore
-
-#endif // DedicatedWorkerThread_h

Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.cpp (199852 => 199853)


--- trunk/Source/WebCore/workers/WorkerGlobalScope.cpp	2016-04-22 00:50:09 UTC (rev 199852)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.cpp	2016-04-22 01:03:39 UTC (rev 199853)
@@ -36,6 +36,7 @@
 #include "ErrorEvent.h"
 #include "Event.h"
 #include "ExceptionCode.h"
+#include "IDBConnectionProxy.h"
 #include "InspectorConsoleInstrumentation.h"
 #include "MessagePort.h"
 #include "ScheduledAction.h"
@@ -62,7 +63,7 @@
 
 namespace WebCore {
 
-WorkerGlobalScope::WorkerGlobalScope(const URL& url, const String& userAgent, WorkerThread& thread, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin)
+WorkerGlobalScope::WorkerGlobalScope(const URL& url, const String& userAgent, WorkerThread& thread, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin, IDBClient::IDBConnectionProxy* connectionProxy)
     : m_url(url)
     , m_userAgent(userAgent)
     , m_script(std::make_unique<WorkerScriptController>(this))
@@ -71,6 +72,9 @@
     , m_shouldBypassMainWorldContentSecurityPolicy(shouldBypassMainWorldContentSecurityPolicy)
     , m_eventQueue(*this)
     , m_topOrigin(topOrigin)
+#if ENABLE(INDEXED_DATABASE)
+    , m_connectionProxy(connectionProxy)
+#endif
 {
     setSecurityOriginPolicy(SecurityOriginPolicy::create(SecurityOrigin::create(url)));
     setContentSecurityPolicy(std::make_unique<ContentSecurityPolicy>(*this));
@@ -115,9 +119,11 @@
 #if ENABLE(INDEXED_DATABASE)
 IDBClient::IDBConnectionProxy* WorkerGlobalScope::idbConnectionProxy()
 {
-    // FIXME: Implement
-
+#if ENABLE(INDEXED_DATABASE_IN_WORKERS)
+    return m_connectionProxy.get();
+#else
     return nullptr;
+#endif
 }
 #endif // ENABLE(INDEXED_DATABASE)
 

Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.h (199852 => 199853)


--- trunk/Source/WebCore/workers/WorkerGlobalScope.h	2016-04-22 00:50:09 UTC (rev 199852)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.h	2016-04-22 01:03:39 UTC (rev 199853)
@@ -53,6 +53,10 @@
 class WorkerNavigator;
 class WorkerThread;
 
+namespace IDBClient {
+class IDBConnectionProxy;
+}
+
 class WorkerGlobalScope : public RefCounted<WorkerGlobalScope>, public Supplementable<WorkerGlobalScope>, public ScriptExecutionContext, public EventTargetWithInlineData {
 public:
     virtual ~WorkerGlobalScope();
@@ -140,7 +144,7 @@
 #endif
 
 protected:
-    WorkerGlobalScope(const URL&, const String& userAgent, WorkerThread&, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin);
+    WorkerGlobalScope(const URL&, const String& userAgent, WorkerThread&, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin, IDBClient::IDBConnectionProxy*);
     void applyContentSecurityPolicyResponseHeaders(const ContentSecurityPolicyResponseHeaders&);
 
     void logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, int columnNumber, RefPtr<Inspector::ScriptCallStack>&&) override;
@@ -177,6 +181,10 @@
     mutable WorkerEventQueue m_eventQueue;
 
     RefPtr<SecurityOrigin> m_topOrigin;
+
+#if ENABLE(INDEXED_DATABASE)
+    RefPtr<IDBClient::IDBConnectionProxy> m_connectionProxy;
+#endif
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp (199852 => 199853)


--- trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp	2016-04-22 00:50:09 UTC (rev 199852)
+++ trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp	2016-04-22 01:03:39 UTC (rev 199853)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008, 2016 Apple Inc. All Rights Reserved.
  * Copyright (C) 2009 Google Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -77,7 +77,8 @@
     // FIXME: This need to be revisited when we support nested worker one day
     ASSERT(m_scriptExecutionContext);
     Document& document = downcast<Document>(*m_scriptExecutionContext);
-    RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(scriptURL, userAgent, sourceCode, *this, *this, startMode, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, document.topOrigin());
+
+    RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(scriptURL, userAgent, sourceCode, *this, *this, startMode, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, document.topOrigin(), document.idbConnectionProxy());
     workerThreadCreated(thread);
     thread->start();
 }

Modified: trunk/Source/WebCore/workers/WorkerThread.cpp (199852 => 199853)


--- trunk/Source/WebCore/workers/WorkerThread.cpp	2016-04-22 00:50:09 UTC (rev 199852)
+++ trunk/Source/WebCore/workers/WorkerThread.cpp	2016-04-22 01:03:39 UTC (rev 199853)
@@ -30,6 +30,7 @@
 
 #include "ContentSecurityPolicyResponseHeaders.h"
 #include "DedicatedWorkerGlobalScope.h"
+#include "IDBConnectionProxy.h"
 #include "ScriptSourceCode.h"
 #include "SecurityOrigin.h"
 #include "ThreadGlobalData.h"
@@ -92,7 +93,7 @@
 {
 }
 
-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)
+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, IDBClient::IDBConnectionProxy* connectionProxy)
     : m_threadID(0)
     , m_workerLoaderProxy(workerLoaderProxy)
     , m_workerReportingProxy(workerReportingProxy)
@@ -100,6 +101,9 @@
 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
     , m_notificationClient(0)
 #endif
+#if ENABLE(INDEXED_DATABASE)
+    , m_idbConnectionProxy(connectionProxy)
+#endif
 {
     std::lock_guard<StaticLock> lock(threadSetMutex);
 
@@ -233,4 +237,13 @@
     }
 }
 
+IDBClient::IDBConnectionProxy* WorkerThread::idbConnectionProxy()
+{
+#if ENABLE(INDEXED_DATABASE)
+    return m_idbConnectionProxy.get();
+#else
+    return nullptr;
+#endif
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/workers/WorkerThread.h (199852 => 199853)


--- trunk/Source/WebCore/workers/WorkerThread.h	2016-04-22 00:50:09 UTC (rev 199852)
+++ trunk/Source/WebCore/workers/WorkerThread.h	2016-04-22 01:03:39 UTC (rev 199853)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008, 2016 Apple Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -24,8 +24,7 @@
  *
  */
 
-#ifndef WorkerThread_h
-#define WorkerThread_h
+#pragma once
 
 #include "WorkerRunLoop.h"
 #include <memory>
@@ -35,70 +34,79 @@
 
 namespace WebCore {
 
-    class ContentSecurityPolicyResponseHeaders;
-    class URL;
-    class NotificationClient;
-    class SecurityOrigin;
-    class WorkerGlobalScope;
-    class WorkerLoaderProxy;
-    class WorkerReportingProxy;
-    struct WorkerThreadStartupData;
+class ContentSecurityPolicyResponseHeaders;
+class URL;
+class NotificationClient;
+class SecurityOrigin;
+class WorkerGlobalScope;
+class WorkerLoaderProxy;
+class WorkerReportingProxy;
 
-    enum WorkerThreadStartMode { DontPauseWorkerGlobalScopeOnStart, PauseWorkerGlobalScopeOnStart };
+enum WorkerThreadStartMode { DontPauseWorkerGlobalScopeOnStart, PauseWorkerGlobalScopeOnStart };
 
-    class WorkerThread : public RefCounted<WorkerThread> {
-    public:
-        virtual ~WorkerThread();
+namespace IDBClient {
+class IDBConnectionProxy;
+}
 
-        bool start();
-        void stop();
+struct WorkerThreadStartupData;
 
-        ThreadIdentifier threadID() const { return m_threadID; }
-        WorkerRunLoop& runLoop() { return m_runLoop; }
-        WorkerLoaderProxy& workerLoaderProxy() const { return m_workerLoaderProxy; }
-        WorkerReportingProxy& workerReportingProxy() const { return m_workerReportingProxy; }
+class WorkerThread : public RefCounted<WorkerThread> {
+public:
+    virtual ~WorkerThread();
 
-        // Number of active worker threads.
-        WEBCORE_EXPORT static unsigned workerThreadCount();
-        static void releaseFastMallocFreeMemoryInAllThreads();
+    bool start();
+    void stop();
 
+    ThreadIdentifier threadID() const { return m_threadID; }
+    WorkerRunLoop& runLoop() { return m_runLoop; }
+    WorkerLoaderProxy& workerLoaderProxy() const { return m_workerLoaderProxy; }
+    WorkerReportingProxy& workerReportingProxy() const { return m_workerReportingProxy; }
+
+    // Number of active worker threads.
+    WEBCORE_EXPORT static unsigned workerThreadCount();
+    static void releaseFastMallocFreeMemoryInAllThreads();
+
 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
-        NotificationClient* getNotificationClient() { return m_notificationClient; }
-        void setNotificationClient(NotificationClient* client) { m_notificationClient = client; }
+    NotificationClient* getNotificationClient() { return m_notificationClient; }
+    void setNotificationClient(NotificationClient* client) { m_notificationClient = client; }
 #endif
 
-    protected:
-        WorkerThread(const URL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin* topOrigin);
+protected:
+    WorkerThread(const URL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin* topOrigin, IDBClient::IDBConnectionProxy*);
 
-        // Factory method for creating a new worker context for the thread.
-        virtual Ref<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& userAgent, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin) = 0;
+    // Factory method for creating a new worker context for the thread.
+    virtual Ref<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& userAgent, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin) = 0;
 
-        // Executes the event loop for the worker thread. Derived classes can override to perform actions before/after entering the event loop.
-        virtual void runEventLoop();
+    // Executes the event loop for the worker thread. Derived classes can override to perform actions before/after entering the event loop.
+    virtual void runEventLoop();
 
-        WorkerGlobalScope* workerGlobalScope() { return m_workerGlobalScope.get(); }
+    WorkerGlobalScope* workerGlobalScope() { return m_workerGlobalScope.get(); }
 
-    private:
-        // Static function executed as the core routine on the new thread. Passed a pointer to a WorkerThread object.
-        static void workerThreadStart(void*);
-        void workerThread();
+    IDBClient::IDBConnectionProxy* idbConnectionProxy();
 
-        ThreadIdentifier m_threadID;
-        WorkerRunLoop m_runLoop;
-        WorkerLoaderProxy& m_workerLoaderProxy;
-        WorkerReportingProxy& m_workerReportingProxy;
+private:
+    // Static function executed as the core routine on the new thread. Passed a pointer to a WorkerThread object.
+    static void workerThreadStart(void*);
+    void workerThread();
 
-        RefPtr<WorkerGlobalScope> m_workerGlobalScope;
-        Lock m_threadCreationMutex;
+    ThreadIdentifier m_threadID;
+    WorkerRunLoop m_runLoop;
+    WorkerLoaderProxy& m_workerLoaderProxy;
+    WorkerReportingProxy& m_workerReportingProxy;
 
-        std::unique_ptr<WorkerThreadStartupData> m_startupData;
+    RefPtr<WorkerGlobalScope> m_workerGlobalScope;
+    Lock m_threadCreationMutex;
 
+    std::unique_ptr<WorkerThreadStartupData> m_startupData;
+
 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
-        NotificationClient* m_notificationClient;
+    NotificationClient* m_notificationClient;
 #endif
-    };
 
+#if ENABLE(INDEXED_DATABASE)
+    RefPtr<IDBClient::IDBConnectionProxy> m_idbConnectionProxy;
+#endif
+};
+
 } // namespace WebCore
 
-#endif // WorkerThread_h
-
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to