<rdar://problem/13819878> Disable SharedWorker when in multiple web process...
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 18 May 2013 00:05:10 +0000 (00:05 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 18 May 2013 00:05:10 +0000 (00:05 +0000)
        https://bugs.webkit.org/show_bug.cgi?id=116359

        Reviewed by Anders Carlsson.

        This feature was already RuntimeEnabled. Call through layers to get the answer from
        a platform strategy.

        * workers/DefaultSharedWorkerRepository.cpp:
        (WebCore::DefaultSharedWorkerRepository::isAvailable):
        * workers/DefaultSharedWorkerRepository.h:
        * workers/SharedWorkerRepository.cpp:
        (WebCore::SharedWorkerRepository::isAvailable):
        * workers/SharedWorkerStrategy.h:
        (WebCore::SharedWorkerStrategy::isAvailable):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@150310 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/workers/DefaultSharedWorkerRepository.cpp
Source/WebCore/workers/DefaultSharedWorkerRepository.h
Source/WebCore/workers/SharedWorkerRepository.cpp
Source/WebCore/workers/SharedWorkerStrategy.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h

index ee32cf1..65a0782 100644 (file)
@@ -1,3 +1,21 @@
+2013-05-17  Alexey Proskuryakov  <ap@apple.com>
+
+        <rdar://problem/13819878> Disable SharedWorker when in multiple web process model
+        https://bugs.webkit.org/show_bug.cgi?id=116359
+
+        Reviewed by Anders Carlsson.
+
+        This feature was already RuntimeEnabled. Call through layers to get the answer from
+        a platform strategy.
+
+        * workers/DefaultSharedWorkerRepository.cpp:
+        (WebCore::DefaultSharedWorkerRepository::isAvailable):
+        * workers/DefaultSharedWorkerRepository.h:
+        * workers/SharedWorkerRepository.cpp:
+        (WebCore::SharedWorkerRepository::isAvailable):
+        * workers/SharedWorkerStrategy.h:
+        (WebCore::SharedWorkerStrategy::isAvailable):
+
 2013-05-17  Anders Carlsson  <andersca@apple.com>
 
         Move Storage member functions out of line
index 4786b0b..6037c3a 100644 (file)
 #include "MessagePort.h"
 #include "NotImplemented.h"
 #include "PageGroup.h"
+#include "PlatformStrategies.h"
 #include "ScriptCallStack.h"
 #include "SecurityOrigin.h"
 #include "SecurityOriginHash.h"
 #include "SharedWorker.h"
 #include "SharedWorkerContext.h"
 #include "SharedWorkerRepository.h"
+#include "SharedWorkerStrategy.h"
 #include "SharedWorkerThread.h"
 #include "WorkerLoaderProxy.h"
 #include "WorkerReportingProxy.h"
@@ -351,6 +353,11 @@ DefaultSharedWorkerRepository& DefaultSharedWorkerRepository::instance()
     return *instance;
 }
 
+bool DefaultSharedWorkerRepository::isAvailable()
+{
+    return platformStrategies()->sharedWorkerStrategy()->isAvailable();
+}
+
 void DefaultSharedWorkerRepository::workerScriptLoaded(SharedWorkerProxy& proxy, const String& userAgent, const String& workerScript, PassOwnPtr<MessagePortChannel> port, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
 {
     MutexLocker lock(m_lock);
index 75d90e0..705ef47 100644 (file)
@@ -58,6 +58,9 @@ namespace WebCore {
     class DefaultSharedWorkerRepository {
         WTF_MAKE_NONCOPYABLE(DefaultSharedWorkerRepository); WTF_MAKE_FAST_ALLOCATED;
     public:
+        // Returns true if the platform supports SharedWorkers, otherwise false.
+        static bool isAvailable();
+
         // Invoked once the worker script has been loaded to fire up the worker thread.
         void workerScriptLoaded(SharedWorkerProxy&, const String& userAgent, const String& workerScript, PassOwnPtr<MessagePortChannel>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
 
index 7cc177e..df49592 100644 (file)
@@ -38,8 +38,7 @@ namespace WebCore {
 
 bool SharedWorkerRepository::isAvailable()
 {
-    // SharedWorkers are enabled on the default WebKit platform.
-    return true;
+    return DefaultSharedWorkerRepository::instance().isAvailable();
 }
 
 void SharedWorkerRepository::connect(PassRefPtr<SharedWorker> worker, PassOwnPtr<MessagePortChannel> port, const KURL& url, const String& name, ExceptionCode& ec)
index 3e6fbda..a75e1b2 100644 (file)
@@ -30,6 +30,8 @@ namespace WebCore {
     
 class SharedWorkerStrategy {
 public:
+    virtual bool isAvailable() const { return true; }
+
 protected:
     virtual ~SharedWorkerStrategy()
     {
index b8c6f7e..caa705e 100644 (file)
@@ -1,3 +1,16 @@
+2013-05-17  Alexey Proskuryakov  <ap@apple.com>
+
+        <rdar://problem/13819878> Disable SharedWorker when in multiple web process model
+        https://bugs.webkit.org/show_bug.cgi?id=116359
+
+        Reviewed by Anders Carlsson.
+
+        Implement SharedWorkerStrategy::isAvailable.
+
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+        (WebKit::WebPlatformStrategies::isAvailable):
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
+
 2013-05-17  Beth Dakin  <bdakin@apple.com>
 
         Headers and footers will sometimes disappear and re-appear during page loads
index 91faf28..2fb5441 100644 (file)
@@ -304,6 +304,18 @@ void WebPlatformStrategies::populatePluginCache()
 }
 #endif // ENABLE(NETSCAPE_PLUGIN_API)
 
+// SharedWorkerStrategy.
+
+bool WebPlatformStrategies::isAvailable() const
+{
+    // Shared workers do not work across multiple processes, and using network process is tied to multiple secondary process model.
+#if ENABLE(NETWORK_PROCESS)
+    return WebProcess::shared().usesNetworkProcess();
+#else
+    return true;
+#endif
+}
+
 // StorageStrategy
 
 PassRefPtr<StorageNamespace> WebPlatformStrategies::localStorageNamespace(PageGroup* pageGroup)
index 993541b..7262828 100644 (file)
@@ -81,6 +81,9 @@ private:
     virtual void refreshPlugins() OVERRIDE;
     virtual void getPluginInfo(const WebCore::Page*, Vector<WebCore::PluginInfo>&) OVERRIDE;
 
+    // WebCore::SharedWorkerStrategy.
+    virtual bool isAvailable() const OVERRIDE;
+
     // WebCore::StorageStrategy.
     virtual PassRefPtr<WebCore::StorageNamespace> localStorageNamespace(WebCore::PageGroup*) OVERRIDE;
     virtual PassRefPtr<WebCore::StorageNamespace> transientLocalStorageNamespace(WebCore::PageGroup*, WebCore::SecurityOrigin*) OVERRIDE;