WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Missing file
66509.patch (text/plain), 81.66 KB, created by
Dmitry Lomov
on 2011-12-28 15:39:22 PST
(
hide
)
Description:
Missing file
Filename:
MIME Type:
Creator:
Dmitry Lomov
Created:
2011-12-28 15:39:22 PST
Size:
81.66 KB
patch
obsolete
>diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog >index 1a5201d..02bccb9 100644 >--- a/Source/WebKit/chromium/ChangeLog >+++ b/Source/WebKit/chromium/ChangeLog >@@ -1,3 +1,87 @@ >+2011-12-28 Dmitry Lomov <dslomov@google.com> >+ >+ [WebWorkers][Chromium] Remove remains of cross-process dedicated worker implementation. >+ https://bugs.webkit.org/show_bug.cgi?id=66509 >+ Just renames, merges and removal of dead code. Here are the list of renames: >+ - WebCommonWorkerClient merged with WebWorkerClient and renamed to WebSharedWorkerClient >+ - NewWebCommonWorkerClient renamed to WebCommonWorkerClient >+ - WebWorkerBase merged into WebSharedWorkerImpl >+ - NewWebWorkerBase renamed into WebWorkerBase >+ WebWorkerClient.h has a "#define WebWorkerClient WebSharedWorkerClient" to keep chromium building. >+ Will be removed after coordinated patch in chromium. >+ >+ Reviewed by David Levin. >+ >+ * WebKit.gyp: >+ * public/WebCommonWorkerClient.h: >+ * public/WebSharedWorker.h: >+ * public/WebSharedWorkerClient.h: Copied from Source/WebKit/chromium/public/WebCommonWorkerClient.h. >+ (WebKit::WebSharedWorkerClient::postConsoleMessageToWorkerObject): >+ (WebKit::WebSharedWorkerClient::allowFileSystem): >+ (WebKit::WebSharedWorkerClient::openFileSystem): >+ (WebKit::WebSharedWorkerClient::dispatchDevToolsMessage): >+ (WebKit::WebSharedWorkerClient::saveDevToolsAgentState): >+ (WebKit::WebSharedWorkerClient::~WebSharedWorkerClient): >+ * public/WebWorkerClient.h: >+ * src/DatabaseObserver.cpp: >+ (WebKit::AllowDatabaseMainThreadBridge::create): >+ (WebKit::AllowDatabaseMainThreadBridge::AllowDatabaseMainThreadBridge): >+ (WebKit::AllowDatabaseMainThreadBridge::allowDatabaseTask): >+ (WebKit::allowDatabaseForWorker): >+ (WebCore::DatabaseObserver::canEstablishDatabase): >+ * src/IDBFactoryBackendProxy.cpp: >+ (WebKit::IDBFactoryBackendProxy::openFromWorker): >+ * src/LocalFileSystemChromium.cpp: >+ (WebCore::openFileSystemHelper): >+ * src/WebSharedWorkerImpl.cpp: >+ (WebKit::initializeWebKitStaticValues): >+ (WebKit::WebSharedWorkerImpl::WebSharedWorkerImpl): >+ (WebKit::WebSharedWorkerImpl::~WebSharedWorkerImpl): >+ (WebKit::WebSharedWorkerImpl::stopWorkerThread): >+ (WebKit::WebSharedWorkerImpl::initializeLoader): >+ (WebKit::WebSharedWorkerImpl::didCreateDataSource): >+ (WebKit::WebSharedWorkerImpl::createApplicationCacheHost): >+ (WebKit::WebSharedWorkerImpl::postMessageToWorkerObject): >+ (WebKit::WebSharedWorkerImpl::postMessageTask): >+ (WebKit::WebSharedWorkerImpl::postExceptionToWorkerObject): >+ (WebKit::WebSharedWorkerImpl::postExceptionTask): >+ (WebKit::WebSharedWorkerImpl::postConsoleMessageToWorkerObject): >+ (WebKit::WebSharedWorkerImpl::postConsoleMessageTask): >+ (WebKit::WebSharedWorkerImpl::postMessageToPageInspector): >+ (WebKit::WebSharedWorkerImpl::postMessageToPageInspectorTask): >+ (WebKit::WebSharedWorkerImpl::updateInspectorStateCookie): >+ (WebKit::WebSharedWorkerImpl::updateInspectorStateCookieTask): >+ (WebKit::WebSharedWorkerImpl::confirmMessageFromWorkerObject): >+ (WebKit::WebSharedWorkerImpl::confirmMessageTask): >+ (WebKit::WebSharedWorkerImpl::reportPendingActivity): >+ (WebKit::WebSharedWorkerImpl::reportPendingActivityTask): >+ (WebKit::WebSharedWorkerImpl::workerContextClosed): >+ (WebKit::WebSharedWorkerImpl::workerContextClosedTask): >+ (WebKit::WebSharedWorkerImpl::workerContextDestroyed): >+ (WebKit::WebSharedWorkerImpl::workerContextDestroyedTask): >+ (WebKit::WebSharedWorkerImpl::postTaskToLoader): >+ (WebKit::WebSharedWorkerImpl::postTaskForModeToWorkerContext): >+ (WebKit::WebSharedWorker::create): >+ * src/WebSharedWorkerImpl.h: >+ (WebKit::WebSharedWorkerImpl::view): >+ (WebKit::WebSharedWorkerImpl::commonClient): >+ (WebKit::WebSharedWorkerImpl::client): >+ (WebKit::WebSharedWorkerImpl::setWorkerThread): >+ (WebKit::WebSharedWorkerImpl::workerThread): >+ * src/WebWorkerBase.cpp: >+ (WebKit::invokeTaskMethod): >+ (WebKit::WebWorkerBase::dispatchTaskToMainThread): >+ * src/WebWorkerBase.h: >+ * src/WebWorkerClientImpl.cpp: >+ * src/WebWorkerClientImpl.h: >+ (WebKit::WebWorkerClientImpl::commonClient): >+ * src/WebWorkerImpl.cpp: Removed. >+ * src/WebWorkerImpl.h: Removed. >+ * src/WorkerFileSystemCallbacksBridge.cpp: >+ (WebKit::WorkerFileSystemCallbacksBridge::postOpenFileSystemToMainThread): >+ (WebKit::WorkerFileSystemCallbacksBridge::openFileSystemOnMainThread): >+ * src/WorkerFileSystemCallbacksBridge.h: >+ > 2011-12-28 Sheriff Bot <webkit.review.bot@gmail.com> > > Unreviewed, rolling out r103620. >diff --git a/Source/WebKit/chromium/WebKit.gyp b/Source/WebKit/chromium/WebKit.gyp >index 2ba4f44..d2c2701 100644 >--- a/Source/WebKit/chromium/WebKit.gyp >+++ b/Source/WebKit/chromium/WebKit.gyp >@@ -235,6 +235,7 @@ > 'public/WebSecurityPolicy.h', > 'public/WebSelectElement.h', > 'public/WebSettings.h', >+ 'public/WebSharedWorkerClient.h', > 'public/WebSharedWorker.h', > 'public/WebSharedWorkerRepository.h', > 'public/WebSocket.h', >@@ -665,8 +666,6 @@ > 'src/WebWorkerBase.h', > 'src/WebWorkerClientImpl.cpp', > 'src/WebWorkerClientImpl.h', >- 'src/WebWorkerImpl.cpp', >- 'src/WebWorkerImpl.h', > 'src/WebWorkerRunLoop.cpp', > 'src/WorkerAsyncFileSystemChromium.cpp', > 'src/WorkerAsyncFileSystemChromium.h', >diff --git a/Source/WebKit/chromium/public/WebCommonWorkerClient.h b/Source/WebKit/chromium/public/WebCommonWorkerClient.h >index a794539..2ffb54d 100644 >--- a/Source/WebKit/chromium/public/WebCommonWorkerClient.h >+++ b/Source/WebKit/chromium/public/WebCommonWorkerClient.h >@@ -44,7 +44,7 @@ class WebString; > class WebWorker; > class WebWorkerClient; > >-class NewWebCommonWorkerClient { >+class WebCommonWorkerClient { > public: > // Called on the main webkit thread before opening a web database. > virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize) = 0; >@@ -56,66 +56,6 @@ public: > virtual void openFileSystem(WebFileSystem::Type, long long size, bool create, WebFileSystemCallbacks*) = 0; > }; > >-// Provides an interface back to the in-page script object for a worker. >-// This interface contains common APIs used by both shared and dedicated >-// workers. >-// All functions are expected to be called back on the thread that created >-// the Worker object, unless noted. >-class WebCommonWorkerClient : public NewWebCommonWorkerClient { >-public: >- virtual void postExceptionToWorkerObject( >- const WebString& errorString, int lineNumber, >- const WebString& sourceURL) = 0; >- >- // FIXME: the below is for compatibility only and should be >- // removed once Chromium is updated to remove message >- // destination parameter <http://webkit.org/b/37155>. >- virtual void postConsoleMessageToWorkerObject(int, int sourceIdentifier, int messageType, int messageLevel, >- const WebString& message, int lineNumber, const WebString& sourceURL) = 0; >- >- virtual void postConsoleMessageToWorkerObject(int sourceIdentifier, int messageType, int messageLevel, >- const WebString& message, int lineNumber, const WebString& sourceURL) >- { >- postConsoleMessageToWorkerObject(0, sourceIdentifier, messageType, messageLevel, >- message, lineNumber, sourceURL); >- } >- >- virtual void workerContextClosed() = 0; >- virtual void workerContextDestroyed() = 0; >- >- // Returns the notification presenter for this worker context. Pointer >- // is owned by the object implementing WebCommonWorkerClient. >- virtual WebNotificationPresenter* notificationPresenter() = 0; >- >- // This can be called on any thread to create a nested WebWorker. >- // WebSharedWorkers are not instantiated via this API - instead >- // they are created via the WebSharedWorkerRepository. >- virtual WebWorker* createWorker(WebWorkerClient* client) = 0; >- >- // Called on the main webkit thread in the worker process during initialization. >- virtual WebApplicationCacheHost* createApplicationCacheHost(WebApplicationCacheHostClient*) = 0; >- >- // Called on the main webkit thread before opening a web database. >- virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize) = 0; >- >- // Called on the main webkit thread before opening a file system. >- virtual bool allowFileSystem() >- { >- return true; >- } >- >- // Called on the main webkit thread before opening a file system. >- virtual void openFileSystem(WebFileSystem::Type, long long size, bool create, WebFileSystemCallbacks*) >- { >- WEBKIT_ASSERT_NOT_REACHED(); >- } >- >- virtual void dispatchDevToolsMessage(const WebString&) { } >- virtual void saveDevToolsAgentState(const WebString&) { } >- >-protected: >- ~WebCommonWorkerClient() { } >-}; > > } // namespace WebKit > >diff --git a/Source/WebKit/chromium/public/WebFrameClient.h b/Source/WebKit/chromium/public/WebFrameClient.h >index b213229..0bf3057 100644 >--- a/Source/WebKit/chromium/public/WebFrameClient.h >+++ b/Source/WebKit/chromium/public/WebFrameClient.h >@@ -67,7 +67,7 @@ class WebURLLoader; > class WebURLRequest; > class WebURLResponse; > class WebWorker; >-class WebWorkerClient; >+class WebSharedWorkerClient; > struct WebPluginParams; > struct WebRect; > struct WebSize; >@@ -81,7 +81,7 @@ public: > virtual WebPlugin* createPlugin(WebFrame*, const WebPluginParams&) { return 0; } > > // May return null. >- virtual WebWorker* createWorker(WebFrame*, WebWorkerClient*) { return 0; } >+ virtual WebWorker* createWorker(WebFrame*, WebSharedWorkerClient*) { return 0; } > > // May return null. > virtual WebSharedWorker* createSharedWorker(WebFrame*, const WebURL&, const WebString&, unsigned long long) { return 0; } >diff --git a/Source/WebKit/chromium/public/WebSharedWorker.h b/Source/WebKit/chromium/public/WebSharedWorker.h >index 7d5d003..447f7f4 100644 >--- a/Source/WebKit/chromium/public/WebSharedWorker.h >+++ b/Source/WebKit/chromium/public/WebSharedWorker.h >@@ -41,7 +41,7 @@ namespace WebKit { > > class WebString; > class WebMessagePortChannel; >-class WebCommonWorkerClient; >+class WebSharedWorkerClient; > class WebURL; > > // This is the interface to a SharedWorker thread. >@@ -49,7 +49,7 @@ class WebURL; > class WebSharedWorker { > public: > // Invoked from the worker thread to instantiate a WebSharedWorker that interacts with the WebKit worker components. >- WEBKIT_EXPORT static WebSharedWorker* create(WebCommonWorkerClient*); >+ WEBKIT_EXPORT static WebSharedWorker* create(WebSharedWorkerClient*); > > virtual ~WebSharedWorker() {}; > >diff --git a/Source/WebKit/chromium/public/WebSharedWorkerClient.h b/Source/WebKit/chromium/public/WebSharedWorkerClient.h >new file mode 100644 >index 0000000..01700c6 >--- /dev/null >+++ b/Source/WebKit/chromium/public/WebSharedWorkerClient.h >@@ -0,0 +1,111 @@ >+/* >+ * Copyright (C) 2009 Google Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions are >+ * met: >+ * >+ * * Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * * Redistributions in binary form must reproduce the above >+ * copyright notice, this list of conditions and the following disclaimer >+ * in the documentation and/or other materials provided with the >+ * distribution. >+ * * Neither the name of Google Inc. nor the names of its >+ * contributors may be used to endorse or promote products derived from >+ * this software without specific prior written permission. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (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 WebSharedWorkerClient_h >+#define WebSharedWorkerClient_h >+ >+#include "WebCommonWorkerClient.h" >+#include "WebMessagePortChannel.h" >+ >+namespace WebKit { >+ >+class WebNotificationPresenter; >+class WebString; >+class WebWorker; >+ >+// Provides an interface back to the in-page script object for a worker. >+// All functions are expected to be called back on the thread that created >+// the Worker object, unless noted. >+class WebSharedWorkerClient : public WebCommonWorkerClient { >+public: >+ virtual void postMessageToWorkerObject( >+ const WebString&, >+ const WebMessagePortChannelArray&) = 0; >+ >+ virtual void confirmMessageFromWorkerObject(bool hasPendingActivity) = 0; >+ virtual void reportPendingActivity(bool hasPendingActivity) = 0; >+ >+ virtual void postExceptionToWorkerObject( >+ const WebString& errorString, int lineNumber, >+ const WebString& sourceURL) = 0; >+ >+ // FIXME: the below is for compatibility only and should be >+ // removed once Chromium is updated to remove message >+ // destination parameter <http://webkit.org/b/37155>. >+ virtual void postConsoleMessageToWorkerObject(int, int sourceIdentifier, int messageType, int messageLevel, >+ const WebString& message, int lineNumber, const WebString& sourceURL) = 0; >+ >+ virtual void postConsoleMessageToWorkerObject(int sourceIdentifier, int messageType, int messageLevel, >+ const WebString& message, int lineNumber, const WebString& sourceURL) >+ { >+ postConsoleMessageToWorkerObject(0, sourceIdentifier, messageType, messageLevel, >+ message, lineNumber, sourceURL); >+ } >+ >+ virtual void workerContextClosed() = 0; >+ virtual void workerContextDestroyed() = 0; >+ >+ // Returns the notification presenter for this worker context. Pointer >+ // is owned by the object implementing WebCommonWorkerClient. >+ virtual WebNotificationPresenter* notificationPresenter() = 0; >+ >+ // This can be called on any thread to create a nested WebWorker. >+ // WebSharedWorkers are not instantiated via this API - instead >+ // they are created via the WebSharedWorkerRepository. >+ virtual WebWorker* createWorker(WebSharedWorkerClient*) = 0; >+ >+ // Called on the main webkit thread in the worker process during initialization. >+ virtual WebApplicationCacheHost* createApplicationCacheHost(WebApplicationCacheHostClient*) = 0; >+ >+ // Called on the main webkit thread before opening a web database. >+ virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize) = 0; >+ >+ // Called on the main webkit thread before opening a file system. >+ virtual bool allowFileSystem() >+ { >+ return true; >+ } >+ >+ // Called on the main webkit thread before opening a file system. >+ virtual void openFileSystem(WebFileSystem::Type, long long size, bool create, WebFileSystemCallbacks*) >+ { >+ WEBKIT_ASSERT_NOT_REACHED(); >+ } >+ >+ virtual void dispatchDevToolsMessage(const WebString&) { } >+ virtual void saveDevToolsAgentState(const WebString&) { } >+ >+protected: >+ ~WebSharedWorkerClient() { } >+}; >+ >+} // namespace WebKit >+ >+#endif >diff --git a/Source/WebKit/chromium/public/WebWorkerClient.h b/Source/WebKit/chromium/public/WebWorkerClient.h >index eb2e63e..596999d 100644 >--- a/Source/WebKit/chromium/public/WebWorkerClient.h >+++ b/Source/WebKit/chromium/public/WebWorkerClient.h >@@ -31,31 +31,8 @@ > #ifndef WebWorkerClient_h > #define WebWorkerClient_h > >-#include "WebCommonWorkerClient.h" >-#include "WebMessagePortChannel.h" >+#include "WebSharedWorkerClient.h" > >-namespace WebKit { >- >-class WebNotificationPresenter; >-class WebString; >-class WebWorker; >- >-// Provides an interface back to the in-page script object for a worker. >-// All functions are expected to be called back on the thread that created >-// the Worker object, unless noted. >-class WebWorkerClient : public WebCommonWorkerClient { >-public: >- virtual void postMessageToWorkerObject( >- const WebString&, >- const WebMessagePortChannelArray&) = 0; >- >- virtual void confirmMessageFromWorkerObject(bool hasPendingActivity) = 0; >- virtual void reportPendingActivity(bool hasPendingActivity) = 0; >- >-protected: >- ~WebWorkerClient() { } >-}; >- >-} // namespace WebKit >+#define WebWorkerClient WebSharedWorkerClient > > #endif >diff --git a/Source/WebKit/chromium/src/DatabaseObserver.cpp b/Source/WebKit/chromium/src/DatabaseObserver.cpp >index 187b55e..40b5048 100644 >--- a/Source/WebKit/chromium/src/DatabaseObserver.cpp >+++ b/Source/WebKit/chromium/src/DatabaseObserver.cpp >@@ -64,7 +64,7 @@ static const char allowDatabaseMode[] = "allowDatabaseMode"; > // call back to the worker context. > class AllowDatabaseMainThreadBridge : public ThreadSafeRefCounted<AllowDatabaseMainThreadBridge> { > public: >- static PassRefPtr<AllowDatabaseMainThreadBridge> create(WebCore::WorkerLoaderProxy* workerLoaderProxy, const String& mode, NewWebCommonWorkerClient* commonClient, WebFrame* frame, const String& name, const String& displayName, unsigned long estimatedSize) >+ static PassRefPtr<AllowDatabaseMainThreadBridge> create(WebCore::WorkerLoaderProxy* workerLoaderProxy, const String& mode, WebCommonWorkerClient* commonClient, WebFrame* frame, const String& name, const String& displayName, unsigned long estimatedSize) > { > return adoptRef(new AllowDatabaseMainThreadBridge(workerLoaderProxy, mode, commonClient, frame, name, displayName, estimatedSize)); > } >@@ -91,7 +91,7 @@ public: > } > > private: >- AllowDatabaseMainThreadBridge(WebCore::WorkerLoaderProxy* workerLoaderProxy, const String& mode, NewWebCommonWorkerClient* commonClient, WebFrame* frame, const String& name, const String& displayName, unsigned long estimatedSize) >+ AllowDatabaseMainThreadBridge(WebCore::WorkerLoaderProxy* workerLoaderProxy, const String& mode, WebCommonWorkerClient* commonClient, WebFrame* frame, const String& name, const String& displayName, unsigned long estimatedSize) > : m_workerLoaderProxy(workerLoaderProxy) > { > WebWorkerBase::dispatchTaskToMainThread( >@@ -101,7 +101,7 @@ private: > this)); > } > >- static void allowDatabaseTask(WebCore::ScriptExecutionContext* context, const String mode, NewWebCommonWorkerClient* commonClient, WebFrame* frame, const String name, const String displayName, unsigned long estimatedSize, PassRefPtr<AllowDatabaseMainThreadBridge> bridge) >+ static void allowDatabaseTask(WebCore::ScriptExecutionContext* context, const String mode, WebCommonWorkerClient* commonClient, WebFrame* frame, const String name, const String displayName, unsigned long estimatedSize, PassRefPtr<AllowDatabaseMainThreadBridge> bridge) > { > bool allowDatabase = commonClient ? commonClient->allowDatabase(frame, name, displayName, estimatedSize) : false; > bridge->signalCompleted(mode, allowDatabase); >@@ -117,7 +117,7 @@ private: > WebCore::WorkerLoaderProxy* m_workerLoaderProxy; > }; > >-bool allowDatabaseForWorker(NewWebCommonWorkerClient* commonClient, WebFrame* frame, const WebString& name, const WebString& displayName, unsigned long estimatedSize) >+bool allowDatabaseForWorker(WebCommonWorkerClient* commonClient, WebFrame* frame, const WebString& name, const WebString& displayName, unsigned long estimatedSize) > { > WebCore::WorkerScriptController* controller = WebCore::WorkerScriptController::controllerForContext(); > WebCore::WorkerContext* workerContext = controller->workerContext(); >@@ -164,8 +164,8 @@ bool DatabaseObserver::canEstablishDatabase(ScriptExecutionContext* scriptExecut > #if ENABLE(WORKERS) > WorkerContext* workerContext = static_cast<WorkerContext*>(scriptExecutionContext); > WorkerLoaderProxy* workerLoaderProxy = &workerContext->thread()->workerLoaderProxy(); >- NewWebWorkerBase* webWorker = static_cast<NewWebWorkerBase*>(workerLoaderProxy); >- return allowDatabaseForWorker(webWorker->newCommonClient(), webWorker->view()->mainFrame(), name, displayName, estimatedSize); >+ WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerLoaderProxy); >+ return allowDatabaseForWorker(webWorker->commonClient(), webWorker->view()->mainFrame(), name, displayName, estimatedSize); > #else > ASSERT_NOT_REACHED(); > #endif >diff --git a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp >index 7ae6e61..c22309b 100755 >--- a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp >+++ b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp >@@ -99,7 +99,7 @@ void IDBFactoryBackendProxy::openFromWorker(const String& name, IDBCallbacks* ca > return; > } > WorkerLoaderProxy* workerLoaderProxy = &context->thread()->workerLoaderProxy(); >- NewWebWorkerBase* webWorker = static_cast<NewWebWorkerBase*>(workerLoaderProxy); >+ WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerLoaderProxy); > WebFrame* webFrame = webWorker->view()->mainFrame(); > m_webIDBFactory->open(name, new WebIDBCallbacksImpl(callbacks), origin, webFrame, dataDir); > #endif >diff --git a/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp b/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp >index 757ef82..9e0e730 100644 >--- a/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp >+++ b/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp >@@ -79,7 +79,7 @@ static const char openFileSystemMode[] = "openFileSystemMode"; > // call back to the worker context. > class AllowFileSystemMainThreadBridge : public ThreadSafeRefCounted<AllowFileSystemMainThreadBridge> { > public: >- static PassRefPtr<AllowFileSystemMainThreadBridge> create(WebCore::WorkerLoaderProxy* workerLoaderProxy, const WTF::String& mode, NewWebCommonWorkerClient* commonClient) >+ static PassRefPtr<AllowFileSystemMainThreadBridge> create(WebCore::WorkerLoaderProxy* workerLoaderProxy, const WTF::String& mode, WebCommonWorkerClient* commonClient) > { > return adoptRef(new AllowFileSystemMainThreadBridge(workerLoaderProxy, mode, commonClient)); > } >@@ -106,7 +106,7 @@ public: > } > > private: >- AllowFileSystemMainThreadBridge(WebCore::WorkerLoaderProxy* workerLoaderProxy, const WTF::String& mode, NewWebCommonWorkerClient* commonClient) >+ AllowFileSystemMainThreadBridge(WebCore::WorkerLoaderProxy* workerLoaderProxy, const WTF::String& mode, WebCommonWorkerClient* commonClient) > : m_workerLoaderProxy(workerLoaderProxy) > , m_mode(mode) > { >@@ -115,7 +115,7 @@ private: > AllowCrossThreadAccess(this))); > } > >- static void allowFileSystemTask(WebCore::ScriptExecutionContext* context, NewWebCommonWorkerClient* commonClient, PassRefPtr<AllowFileSystemMainThreadBridge> bridge) >+ static void allowFileSystemTask(WebCore::ScriptExecutionContext* context, WebCommonWorkerClient* commonClient, PassRefPtr<AllowFileSystemMainThreadBridge> bridge) > { > if (commonClient) > bridge->signalCompleted(commonClient->allowFileSystem()); >@@ -134,7 +134,7 @@ private: > WTF::String m_mode; > }; > >-bool allowFileSystemForWorker(NewWebCommonWorkerClient* commonClient) >+bool allowFileSystemForWorker(WebCommonWorkerClient* commonClient) > { > WorkerScriptController* controller = WorkerScriptController::controllerForContext(); > WorkerContext* workerContext = controller->workerContext(); >@@ -157,7 +157,7 @@ bool allowFileSystemForWorker(NewWebCommonWorkerClient* commonClient) > return bridge->result(); > } > >-void openFileSystemForWorker(NewWebCommonWorkerClient* commonClient, WebFileSystem::Type type, long long size, bool create, WebFileSystemCallbacks* callbacks, bool synchronous) >+void openFileSystemForWorker(WebCommonWorkerClient* commonClient, WebFileSystem::Type type, long long size, bool create, WebFileSystemCallbacks* callbacks, bool synchronous) > { > WorkerScriptController* controller = WorkerScriptController::controllerForContext(); > WorkerContext* workerContext = controller->workerContext(); >@@ -203,11 +203,11 @@ static void openFileSystemHelper(ScriptExecutionContext* context, AsyncFileSyste > #if ENABLE(WORKERS) > WorkerContext* workerContext = static_cast<WorkerContext*>(context); > WorkerLoaderProxy* workerLoaderProxy = &workerContext->thread()->workerLoaderProxy(); >- NewWebWorkerBase* webWorker = static_cast<NewWebWorkerBase*>(workerLoaderProxy); >- if (!allowFileSystemForWorker(webWorker->newCommonClient())) >+ WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerLoaderProxy); >+ if (!allowFileSystemForWorker(webWorker->commonClient())) > allowed = false; > else >- openFileSystemForWorker(webWorker->newCommonClient(), static_cast<WebFileSystem::Type>(type), size, create == CreateIfNotPresent, new WebFileSystemCallbacksImpl(callbacks, type, context, synchronous), synchronous); >+ openFileSystemForWorker(webWorker->commonClient(), static_cast<WebFileSystem::Type>(type), size, create == CreateIfNotPresent, new WebFileSystemCallbacksImpl(callbacks, type, context, synchronous), synchronous); > > #else > ASSERT_NOT_REACHED(); >diff --git a/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp b/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp >index 1445f8e..231aaac 100644 >--- a/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp >+++ b/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp >@@ -32,36 +32,302 @@ > #include "WebSharedWorkerImpl.h" > > #include "CrossThreadTask.h" >+#include "DatabaseTask.h" >+#include "Document.h" > #include "KURL.h" > #include "MessageEvent.h" > #include "MessagePortChannel.h" > #include "PlatformMessagePortChannel.h" >+#include "SecurityOrigin.h" > #include "ScriptExecutionContext.h" > #include "SharedWorkerContext.h" > #include "SharedWorkerThread.h" >+#include "WebDataSourceImpl.h" >+#include "WebFileError.h" >+#include "WebFrameClient.h" >+#include "WebFrameImpl.h" >+#include "WebMessagePortChannel.h" >+#include "WebRuntimeFeatures.h" >+#include "WebSettings.h" >+#include "WebSharedWorkerClient.h" >+#include "WebView.h" >+#include "WorkerContext.h" > #include "WorkerDebuggerAgent.h" > #include "WorkerInspectorController.h" >- >-#include "WebMessagePortChannel.h" >+#include "WorkerLoaderProxy.h" >+#include "WorkerThread.h" > #include "platform/WebString.h" > #include "platform/WebURL.h" >+#include <wtf/MainThread.h> > > using namespace WebCore; > > namespace WebKit { > > #if ENABLE(SHARED_WORKERS) >+// This function is called on the main thread to force to initialize some static >+// values used in WebKit before any worker thread is started. This is because in >+// our worker processs, we do not run any WebKit code in main thread and thus >+// when multiple workers try to start at the same time, we might hit crash due >+// to contention for initializing static values. >+static void initializeWebKitStaticValues() >+{ >+ static bool initialized = false; >+ if (!initialized) { >+ initialized = true; >+ // Note that we have to pass a URL with valid protocol in order to follow >+ // the path to do static value initializations. >+ RefPtr<SecurityOrigin> origin = >+ SecurityOrigin::create(KURL(ParsedURLString, "http://localhost")); >+ origin.release(); >+ } >+} > >-WebSharedWorkerImpl::WebSharedWorkerImpl(WebCommonWorkerClient* client) >- : m_client(client) >+WebSharedWorkerImpl::WebSharedWorkerImpl(WebSharedWorkerClient* client) >+ : m_webView(0) >+ , m_askedToTerminate(false) >+ , m_client(client) > , m_pauseWorkerContextOnStart(false) > { >+ initializeWebKitStaticValues(); > } > > WebSharedWorkerImpl::~WebSharedWorkerImpl() > { >+ ASSERT(m_webView); >+ WebFrameImpl* webFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); >+ if (webFrame) >+ webFrame->setClient(0); >+ m_webView->close(); >+} >+ >+void WebSharedWorkerImpl::stopWorkerThread() >+{ >+ if (m_askedToTerminate) >+ return; >+ m_askedToTerminate = true; >+ if (m_workerThread) >+ m_workerThread->stop(); >+} >+ >+void WebSharedWorkerImpl::initializeLoader(const WebURL& url) >+{ >+ // Create 'shadow page'. This page is never displayed, it is used to proxy the >+ // loading requests from the worker context to the rest of WebKit and Chromium >+ // infrastructure. >+ ASSERT(!m_webView); >+ m_webView = WebView::create(0); >+ m_webView->settings()->setOfflineWebApplicationCacheEnabled(WebRuntimeFeatures::isApplicationCacheEnabled()); >+ // FIXME: Settings information should be passed to the Worker process from Browser process when the worker >+ // is created (similar to RenderThread::OnCreateNewView). >+ m_webView->settings()->setHixie76WebSocketProtocolEnabled(false); >+ m_webView->initializeMainFrame(this); >+ >+ WebFrameImpl* webFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); >+ >+ // Construct substitute data source for the 'shadow page'. We only need it >+ // to have same origin as the worker so the loading checks work correctly. >+ CString content(""); >+ int len = static_cast<int>(content.length()); >+ RefPtr<SharedBuffer> buf(SharedBuffer::create(content.data(), len)); >+ SubstituteData substData(buf, String("text/html"), String("UTF-8"), KURL()); >+ webFrame->frame()->loader()->load(ResourceRequest(url), substData, false); >+ >+ // This document will be used as 'loading context' for the worker. >+ m_loadingDocument = webFrame->frame()->document(); >+} >+ >+void WebSharedWorkerImpl::didCreateDataSource(WebFrame*, WebDataSource* ds) >+{ >+ // Tell the loader to load the data into the 'shadow page' synchronously, >+ // so we can grab the resulting Document right after load. >+ static_cast<WebDataSourceImpl*>(ds)->setDeferMainResourceDataLoad(false); >+} >+ >+WebApplicationCacheHost* WebSharedWorkerImpl::createApplicationCacheHost(WebFrame*, WebApplicationCacheHostClient* appcacheHostClient) >+{ >+ if (client()) >+ return client()->createApplicationCacheHost(appcacheHostClient); >+ return 0; >+} >+ >+// WorkerObjectProxy ----------------------------------------------------------- >+ >+void WebSharedWorkerImpl::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> message, >+ PassOwnPtr<MessagePortChannelArray> channels) >+{ >+ WebWorkerBase::dispatchTaskToMainThread(createCallbackTask(&postMessageTask, AllowCrossThreadAccess(this), >+ message->toWireString(), channels)); >+} >+ >+void WebSharedWorkerImpl::postMessageTask(ScriptExecutionContext* context, >+ WebSharedWorkerImpl* thisPtr, >+ String message, >+ PassOwnPtr<MessagePortChannelArray> channels) >+{ >+ if (!thisPtr->client()) >+ return; >+ >+ WebMessagePortChannelArray webChannels(channels ? channels->size() : 0); >+ for (size_t i = 0; i < webChannels.size(); ++i) { >+ webChannels[i] = (*channels)[i]->channel()->webChannelRelease(); >+ webChannels[i]->setClient(0); >+ } >+ >+ thisPtr->client()->postMessageToWorkerObject(message, webChannels); >+} >+ >+void WebSharedWorkerImpl::postExceptionToWorkerObject(const String& errorMessage, >+ int lineNumber, >+ const String& sourceURL) >+{ >+ WebWorkerBase::dispatchTaskToMainThread( >+ createCallbackTask(&postExceptionTask, AllowCrossThreadAccess(this), >+ errorMessage, lineNumber, >+ sourceURL)); >+} >+ >+void WebSharedWorkerImpl::postExceptionTask(ScriptExecutionContext* context, >+ WebSharedWorkerImpl* thisPtr, >+ const String& errorMessage, >+ int lineNumber, const String& sourceURL) >+{ >+ if (!thisPtr->client()) >+ return; >+ >+ thisPtr->client()->postExceptionToWorkerObject(errorMessage, >+ lineNumber, >+ sourceURL); >+} >+ >+void WebSharedWorkerImpl::postConsoleMessageToWorkerObject(MessageSource source, >+ MessageType type, >+ MessageLevel level, >+ const String& message, >+ int lineNumber, >+ const String& sourceURL) >+{ >+ WebWorkerBase::dispatchTaskToMainThread(createCallbackTask(&postConsoleMessageTask, AllowCrossThreadAccess(this), >+ source, type, level, >+ message, lineNumber, sourceURL)); >+} >+ >+void WebSharedWorkerImpl::postConsoleMessageTask(ScriptExecutionContext* context, >+ WebSharedWorkerImpl* thisPtr, >+ int source, >+ int type, int level, >+ const String& message, >+ int lineNumber, >+ const String& sourceURL) >+{ >+ if (!thisPtr->client()) >+ return; >+ thisPtr->client()->postConsoleMessageToWorkerObject(source, >+ type, level, message, >+ lineNumber, sourceURL); >+} >+ >+void WebSharedWorkerImpl::postMessageToPageInspector(const String& message) >+{ >+ WebWorkerBase::dispatchTaskToMainThread(createCallbackTask(&postMessageToPageInspectorTask, AllowCrossThreadAccess(this), message)); > } > >+void WebSharedWorkerImpl::postMessageToPageInspectorTask(ScriptExecutionContext*, WebSharedWorkerImpl* thisPtr, const String& message) >+{ >+ if (!thisPtr->client()) >+ return; >+ thisPtr->client()->dispatchDevToolsMessage(message); >+} >+ >+void WebSharedWorkerImpl::updateInspectorStateCookie(const WTF::String& cookie) >+{ >+ WebWorkerBase::dispatchTaskToMainThread(createCallbackTask(&updateInspectorStateCookieTask, AllowCrossThreadAccess(this), cookie)); >+} >+ >+void WebSharedWorkerImpl::updateInspectorStateCookieTask(ScriptExecutionContext*, WebSharedWorkerImpl* thisPtr, const String& cookie) >+{ >+ if (!thisPtr->client()) >+ return; >+ thisPtr->client()->saveDevToolsAgentState(cookie); >+} >+ >+void WebSharedWorkerImpl::confirmMessageFromWorkerObject(bool hasPendingActivity) >+{ >+ WebWorkerBase::dispatchTaskToMainThread(createCallbackTask(&confirmMessageTask, AllowCrossThreadAccess(this), >+ hasPendingActivity)); >+} >+ >+void WebSharedWorkerImpl::confirmMessageTask(ScriptExecutionContext* context, >+ WebSharedWorkerImpl* thisPtr, >+ bool hasPendingActivity) >+{ >+ if (!thisPtr->client()) >+ return; >+ thisPtr->client()->confirmMessageFromWorkerObject(hasPendingActivity); >+} >+ >+void WebSharedWorkerImpl::reportPendingActivity(bool hasPendingActivity) >+{ >+ WebWorkerBase::dispatchTaskToMainThread(createCallbackTask(&reportPendingActivityTask, >+ AllowCrossThreadAccess(this), >+ hasPendingActivity)); >+} >+ >+void WebSharedWorkerImpl::reportPendingActivityTask(ScriptExecutionContext* context, >+ WebSharedWorkerImpl* thisPtr, >+ bool hasPendingActivity) >+{ >+ if (!thisPtr->client()) >+ return; >+ thisPtr->client()->reportPendingActivity(hasPendingActivity); >+} >+ >+void WebSharedWorkerImpl::workerContextClosed() >+{ >+ WebWorkerBase::dispatchTaskToMainThread(createCallbackTask(&workerContextClosedTask, >+ AllowCrossThreadAccess(this))); >+} >+ >+void WebSharedWorkerImpl::workerContextClosedTask(ScriptExecutionContext* context, >+ WebSharedWorkerImpl* thisPtr) >+{ >+ if (thisPtr->client()) >+ thisPtr->client()->workerContextClosed(); >+ >+ thisPtr->stopWorkerThread(); >+} >+ >+void WebSharedWorkerImpl::workerContextDestroyed() >+{ >+ WebWorkerBase::dispatchTaskToMainThread(createCallbackTask(&workerContextDestroyedTask, >+ AllowCrossThreadAccess(this))); >+} >+ >+void WebSharedWorkerImpl::workerContextDestroyedTask(ScriptExecutionContext* context, >+ WebSharedWorkerImpl* thisPtr) >+{ >+ if (thisPtr->client()) >+ thisPtr->client()->workerContextDestroyed(); >+ // The lifetime of this proxy is controlled by the worker context. >+ delete thisPtr; >+} >+ >+// WorkerLoaderProxy ----------------------------------------------------------- >+ >+void WebSharedWorkerImpl::postTaskToLoader(PassOwnPtr<ScriptExecutionContext::Task> task) >+{ >+ ASSERT(m_loadingDocument->isDocument()); >+ m_loadingDocument->postTask(task); >+} >+ >+void WebSharedWorkerImpl::postTaskForModeToWorkerContext( >+ PassOwnPtr<ScriptExecutionContext::Task> task, const String& mode) >+{ >+ m_workerThread->runLoop().postTaskForMode(task, mode); >+} >+ >+ >+ > bool WebSharedWorkerImpl::isStarted() > { > // Should not ever be called from the worker thread (this API is only called on WebSharedWorkerProxy on the renderer thread). >@@ -177,19 +443,10 @@ void WebSharedWorkerImpl::dispatchDevToolsMessage(const WebString& message) > workerThread()->runLoop().postTaskForMode(createCallbackTask(dispatchOnInspectorBackendTask, String(message)), WorkerDebuggerAgent::debuggerTaskMode); > } > >-WebWorkerClient* WebSharedWorkerImpl::client() >-{ >- // We should never be asked for a WebWorkerClient (only dedicated workers have an associated WebWorkerClient). >- // It should not be possible for SharedWorkerContext to generate an API call outside those supported by WebCommonWorkerClient. >- ASSERT_NOT_REACHED(); >- return 0; >-} >- >-WebSharedWorker* WebSharedWorker::create(WebCommonWorkerClient* client) >+WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) > { > return new WebSharedWorkerImpl(client); > } >- > #endif // ENABLE(SHARED_WORKERS) > > } // namespace WebKit >diff --git a/Source/WebKit/chromium/src/WebSharedWorkerImpl.h b/Source/WebKit/chromium/src/WebSharedWorkerImpl.h >index 437bb2b..83d361a 100644 >--- a/Source/WebKit/chromium/src/WebSharedWorkerImpl.h >+++ b/Source/WebKit/chromium/src/WebSharedWorkerImpl.h >@@ -34,20 +34,64 @@ > #include "WebSharedWorker.h" > > #if ENABLE(SHARED_WORKERS) >- > #include "ScriptExecutionContext.h" >- >+#include "WebCommonWorkerClient.h" >+#include "WebFrameClient.h" > #include "WebWorkerBase.h" >+#include "WebWorkerClient.h" >+#include "WorkerLoaderProxy.h" >+#include "WorkerObjectProxy.h" >+#include "WorkerThread.h" >+#include <wtf/PassOwnPtr.h> >+#include <wtf/RefPtr.h> > >-namespace WebKit { > >+namespace WebKit { >+class WebApplicationCacheHost; >+class WebApplicationCacheHostClient; >+class WebWorkerClient; >+class WebSecurityOrigin; >+class WebString; >+class WebURL; >+class WebView; >+class WebWorker; >+class WebSharedWorkerClient; > // This class is used by the worker process code to talk to the WebCore::SharedWorker implementation. > // It can't use it directly since it uses WebKit types, so this class converts the data types. > // When the WebCore::SharedWorker object wants to call WebCore::WorkerReportingProxy, this class will > // convert to Chrome data types first and then call the supplied WebCommonWorkerClient. >-class WebSharedWorkerImpl : public WebWorkerBase, public WebSharedWorker { >+class WebSharedWorkerImpl : public WebCore::WorkerObjectProxy >+ , public WebWorkerBase >+ , public WebFrameClient >+ , public WebSharedWorker { > public: >- explicit WebSharedWorkerImpl(WebCommonWorkerClient* client); >+ explicit WebSharedWorkerImpl(WebSharedWorkerClient*); >+ >+ virtual void postMessageToWorkerObject( >+ PassRefPtr<WebCore::SerializedScriptValue>, >+ PassOwnPtr<WebCore::MessagePortChannelArray>); >+ virtual void postExceptionToWorkerObject( >+ const WTF::String&, int, const WTF::String&); >+ virtual void postConsoleMessageToWorkerObject( >+ WebCore::MessageSource, WebCore::MessageType, >+ WebCore::MessageLevel, const WTF::String&, int, const WTF::String&); >+ virtual void postMessageToPageInspector(const WTF::String&); >+ virtual void updateInspectorStateCookie(const WTF::String&); >+ virtual void confirmMessageFromWorkerObject(bool); >+ virtual void reportPendingActivity(bool); >+ virtual void workerContextClosed(); >+ virtual void workerContextDestroyed(); >+ virtual WebView* view() const { return m_webView; } >+ >+ // WebCore::WorkerLoaderProxy methods: >+ virtual void postTaskToLoader(PassOwnPtr<WebCore::ScriptExecutionContext::Task>); >+ virtual void postTaskForModeToWorkerContext( >+ PassOwnPtr<WebCore::ScriptExecutionContext::Task>, const WTF::String& mode); >+ >+ // WebFrameClient methods to support resource loading thru the 'shadow page'. >+ virtual void didCreateDataSource(WebFrame*, WebDataSource*); >+ virtual WebApplicationCacheHost* createApplicationCacheHost(WebFrame*, WebApplicationCacheHostClient*); >+ > > // WebSharedWorker methods: > virtual bool isStarted(); >@@ -63,19 +107,72 @@ public: > virtual void detachDevTools(); > virtual void dispatchDevToolsMessage(const WebString&); > >- // WebWorkerBase methods: >- WebWorkerClient* client(); >- WebCommonWorkerClient* commonClient() { return m_client; } > > // NewWebWorkerBase methods: >- NewWebCommonWorkerClient* newCommonClient() { return m_client; } >+ WebCommonWorkerClient* commonClient() { return m_client; } > > private: > virtual ~WebSharedWorkerImpl(); > >- static void connectTask(WebCore::ScriptExecutionContext*, PassOwnPtr<WebCore::MessagePortChannel>); >+ WebSharedWorkerClient* client() { return m_client; } >+ >+ void setWorkerThread(PassRefPtr<WebCore::WorkerThread> thread) { m_workerThread = thread; } >+ WebCore::WorkerThread* workerThread() { return m_workerThread.get(); } >+ >+ // Shuts down the worker thread. >+ void stopWorkerThread(); > >- WebCommonWorkerClient* m_client; >+ // Creates the shadow loader used for worker network requests. >+ void initializeLoader(const WebURL&); >+ >+ >+ static void connectTask(WebCore::ScriptExecutionContext*, PassOwnPtr<WebCore::MessagePortChannel>); >+ // Tasks that are run on the main thread. >+ static void postMessageTask( >+ WebCore::ScriptExecutionContext*, >+ WebSharedWorkerImpl* thisPtr, >+ WTF::String message, >+ PassOwnPtr<WebCore::MessagePortChannelArray> channels); >+ static void postExceptionTask( >+ WebCore::ScriptExecutionContext*, >+ WebSharedWorkerImpl* thisPtr, >+ const WTF::String& message, >+ int lineNumber, >+ const WTF::String& sourceURL); >+ static void postConsoleMessageTask( >+ WebCore::ScriptExecutionContext*, >+ WebSharedWorkerImpl* thisPtr, >+ int source, >+ int type, >+ int level, >+ const WTF::String& message, >+ int lineNumber, >+ const WTF::String& sourceURL); >+ static void postMessageToPageInspectorTask(WebCore::ScriptExecutionContext*, WebSharedWorkerImpl*, const WTF::String&); >+ static void updateInspectorStateCookieTask(WebCore::ScriptExecutionContext*, WebSharedWorkerImpl* thisPtr, const WTF::String& cookie); >+ static void confirmMessageTask( >+ WebCore::ScriptExecutionContext*, >+ WebSharedWorkerImpl* thisPtr, >+ bool hasPendingActivity); >+ static void reportPendingActivityTask( >+ WebCore::ScriptExecutionContext*, >+ WebSharedWorkerImpl* thisPtr, >+ bool hasPendingActivity); >+ static void workerContextClosedTask( >+ WebCore::ScriptExecutionContext*, >+ WebSharedWorkerImpl* thisPtr); >+ static void workerContextDestroyedTask( >+ WebCore::ScriptExecutionContext*, >+ WebSharedWorkerImpl* thisPtr); >+ >+ // 'shadow page' - created to proxy loading requests from the worker. >+ RefPtr<WebCore::ScriptExecutionContext> m_loadingDocument; >+ WebView* m_webView; >+ bool m_askedToTerminate; >+ >+ RefPtr<WebCore::WorkerThread> m_workerThread; >+ >+ WebSharedWorkerClient* m_client; > bool m_pauseWorkerContextOnStart; > }; > >diff --git a/Source/WebKit/chromium/src/WebWorkerBase.cpp b/Source/WebKit/chromium/src/WebWorkerBase.cpp >index 93f840c..b12db7d 100644 >--- a/Source/WebKit/chromium/src/WebWorkerBase.cpp >+++ b/Source/WebKit/chromium/src/WebWorkerBase.cpp >@@ -32,20 +32,7 @@ > #include "WebWorkerBase.h" > > #include "CrossThreadTask.h" >-#include "DatabaseTask.h" >-#include "Document.h" >-#include "MessagePortChannel.h" >-#include "PlatformMessagePortChannel.h" >-#include "SecurityOrigin.h" > >-#include "WebDataSourceImpl.h" >-#include "WebFileError.h" >-#include "WebFrameClient.h" >-#include "WebFrameImpl.h" >-#include "WebMessagePortChannel.h" >-#include "WebRuntimeFeatures.h" >-#include "WebSettings.h" >-#include "WebView.h" > #include "WebWorkerClient.h" > > #include "WorkerContext.h" >@@ -59,82 +46,7 @@ namespace WebKit { > > #if ENABLE(WORKERS) > >-// This function is called on the main thread to force to initialize some static >-// values used in WebKit before any worker thread is started. This is because in >-// our worker processs, we do not run any WebKit code in main thread and thus >-// when multiple workers try to start at the same time, we might hit crash due >-// to contention for initializing static values. >-static void initializeWebKitStaticValues() >-{ >- static bool initialized = false; >- if (!initialized) { >- initialized = true; >- // Note that we have to pass a URL with valid protocol in order to follow >- // the path to do static value initializations. >- RefPtr<SecurityOrigin> origin = >- SecurityOrigin::create(KURL(ParsedURLString, "http://localhost")); >- origin.release(); >- } >-} >- >-WebWorkerBase::WebWorkerBase() >- : m_webView(0) >- , m_askedToTerminate(false) >-{ >- initializeWebKitStaticValues(); >-} >- >-WebWorkerBase::~WebWorkerBase() >-{ >- ASSERT(m_webView); >- WebFrameImpl* webFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); >- if (webFrame) >- webFrame->setClient(0); >- m_webView->close(); >-} >- >-void WebWorkerBase::stopWorkerThread() >-{ >- if (m_askedToTerminate) >- return; >- m_askedToTerminate = true; >- if (m_workerThread) >- m_workerThread->stop(); >-} >- >-void WebWorkerBase::initializeLoader(const WebURL& url) >-{ >- // Create 'shadow page'. This page is never displayed, it is used to proxy the >- // loading requests from the worker context to the rest of WebKit and Chromium >- // infrastructure. >- ASSERT(!m_webView); >- m_webView = WebView::create(0); >- m_webView->settings()->setOfflineWebApplicationCacheEnabled(WebRuntimeFeatures::isApplicationCacheEnabled()); >- // FIXME: Settings information should be passed to the Worker process from Browser process when the worker >- // is created (similar to RenderThread::OnCreateNewView). >- m_webView->settings()->setHixie76WebSocketProtocolEnabled(false); >- m_webView->initializeMainFrame(this); >- >- WebFrameImpl* webFrame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); >- >- // Construct substitute data source for the 'shadow page'. We only need it >- // to have same origin as the worker so the loading checks work correctly. >- CString content(""); >- int len = static_cast<int>(content.length()); >- RefPtr<SharedBuffer> buf(SharedBuffer::create(content.data(), len)); >- SubstituteData substData(buf, String("text/html"), String("UTF-8"), KURL()); >- webFrame->frame()->loader()->load(ResourceRequest(url), substData, false); >- >- // This document will be used as 'loading context' for the worker. >- m_loadingDocument = webFrame->frame()->document(); >-} >- >-void WebWorkerBase::dispatchTaskToMainThread(PassOwnPtr<ScriptExecutionContext::Task> task) >-{ >- callOnMainThread(invokeTaskMethod, task.leakPtr()); >-} >- >-void WebWorkerBase::invokeTaskMethod(void* param) >+static void invokeTaskMethod(void* param) > { > ScriptExecutionContext::Task* task = > static_cast<ScriptExecutionContext::Task*>(param); >@@ -142,193 +54,10 @@ void WebWorkerBase::invokeTaskMethod(void* param) > delete task; > } > >-void WebWorkerBase::didCreateDataSource(WebFrame*, WebDataSource* ds) >-{ >- // Tell the loader to load the data into the 'shadow page' synchronously, >- // so we can grab the resulting Document right after load. >- static_cast<WebDataSourceImpl*>(ds)->setDeferMainResourceDataLoad(false); >-} >- >-WebApplicationCacheHost* WebWorkerBase::createApplicationCacheHost(WebFrame*, WebApplicationCacheHostClient* appcacheHostClient) >-{ >- if (commonClient()) >- return commonClient()->createApplicationCacheHost(appcacheHostClient); >- return 0; >-} >- >-// WorkerObjectProxy ----------------------------------------------------------- >- >-void WebWorkerBase::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> message, >- PassOwnPtr<MessagePortChannelArray> channels) >-{ >- dispatchTaskToMainThread(createCallbackTask(&postMessageTask, AllowCrossThreadAccess(this), >- message->toWireString(), channels)); >-} >- >-void WebWorkerBase::postMessageTask(ScriptExecutionContext* context, >- WebWorkerBase* thisPtr, >- String message, >- PassOwnPtr<MessagePortChannelArray> channels) >-{ >- if (!thisPtr->client()) >- return; >- >- WebMessagePortChannelArray webChannels(channels ? channels->size() : 0); >- for (size_t i = 0; i < webChannels.size(); ++i) { >- webChannels[i] = (*channels)[i]->channel()->webChannelRelease(); >- webChannels[i]->setClient(0); >- } >- >- thisPtr->client()->postMessageToWorkerObject(message, webChannels); >-} >- >-void WebWorkerBase::postExceptionToWorkerObject(const String& errorMessage, >- int lineNumber, >- const String& sourceURL) >-{ >- dispatchTaskToMainThread( >- createCallbackTask(&postExceptionTask, AllowCrossThreadAccess(this), >- errorMessage, lineNumber, >- sourceURL)); >-} >- >-void WebWorkerBase::postExceptionTask(ScriptExecutionContext* context, >- WebWorkerBase* thisPtr, >- const String& errorMessage, >- int lineNumber, const String& sourceURL) >-{ >- if (!thisPtr->commonClient()) >- return; >- >- thisPtr->commonClient()->postExceptionToWorkerObject(errorMessage, >- lineNumber, >- sourceURL); >-} >- >-void WebWorkerBase::postConsoleMessageToWorkerObject(MessageSource source, >- MessageType type, >- MessageLevel level, >- const String& message, >- int lineNumber, >- const String& sourceURL) >-{ >- dispatchTaskToMainThread(createCallbackTask(&postConsoleMessageTask, AllowCrossThreadAccess(this), >- source, type, level, >- message, lineNumber, sourceURL)); >-} > >-void WebWorkerBase::postConsoleMessageTask(ScriptExecutionContext* context, >- WebWorkerBase* thisPtr, >- int source, >- int type, int level, >- const String& message, >- int lineNumber, >- const String& sourceURL) >-{ >- if (!thisPtr->commonClient()) >- return; >- thisPtr->commonClient()->postConsoleMessageToWorkerObject(source, >- type, level, message, >- lineNumber, sourceURL); >-} >- >-void WebWorkerBase::postMessageToPageInspector(const String& message) >-{ >- dispatchTaskToMainThread(createCallbackTask(&postMessageToPageInspectorTask, AllowCrossThreadAccess(this), message)); >-} >- >-void WebWorkerBase::postMessageToPageInspectorTask(ScriptExecutionContext*, WebWorkerBase* thisPtr, const String& message) >-{ >- if (!thisPtr->commonClient()) >- return; >- thisPtr->commonClient()->dispatchDevToolsMessage(message); >-} >- >-void WebWorkerBase::updateInspectorStateCookie(const WTF::String& cookie) >-{ >- dispatchTaskToMainThread(createCallbackTask(&updateInspectorStateCookieTask, AllowCrossThreadAccess(this), cookie)); >-} >- >-void WebWorkerBase::updateInspectorStateCookieTask(ScriptExecutionContext*, WebWorkerBase* thisPtr, const String& cookie) >-{ >- if (!thisPtr->commonClient()) >- return; >- thisPtr->commonClient()->saveDevToolsAgentState(cookie); >-} >- >-void WebWorkerBase::confirmMessageFromWorkerObject(bool hasPendingActivity) >-{ >- dispatchTaskToMainThread(createCallbackTask(&confirmMessageTask, AllowCrossThreadAccess(this), >- hasPendingActivity)); >-} >- >-void WebWorkerBase::confirmMessageTask(ScriptExecutionContext* context, >- WebWorkerBase* thisPtr, >- bool hasPendingActivity) >-{ >- if (!thisPtr->client()) >- return; >- thisPtr->client()->confirmMessageFromWorkerObject(hasPendingActivity); >-} >- >-void WebWorkerBase::reportPendingActivity(bool hasPendingActivity) >-{ >- dispatchTaskToMainThread(createCallbackTask(&reportPendingActivityTask, >- AllowCrossThreadAccess(this), >- hasPendingActivity)); >-} >- >-void WebWorkerBase::reportPendingActivityTask(ScriptExecutionContext* context, >- WebWorkerBase* thisPtr, >- bool hasPendingActivity) >-{ >- if (!thisPtr->client()) >- return; >- thisPtr->client()->reportPendingActivity(hasPendingActivity); >-} >- >-void WebWorkerBase::workerContextClosed() >-{ >- dispatchTaskToMainThread(createCallbackTask(&workerContextClosedTask, >- AllowCrossThreadAccess(this))); >-} >- >-void WebWorkerBase::workerContextClosedTask(ScriptExecutionContext* context, >- WebWorkerBase* thisPtr) >-{ >- if (thisPtr->commonClient()) >- thisPtr->commonClient()->workerContextClosed(); >- >- thisPtr->stopWorkerThread(); >-} >- >-void WebWorkerBase::workerContextDestroyed() >-{ >- dispatchTaskToMainThread(createCallbackTask(&workerContextDestroyedTask, >- AllowCrossThreadAccess(this))); >-} >- >-void WebWorkerBase::workerContextDestroyedTask(ScriptExecutionContext* context, >- WebWorkerBase* thisPtr) >-{ >- if (thisPtr->commonClient()) >- thisPtr->commonClient()->workerContextDestroyed(); >- // The lifetime of this proxy is controlled by the worker context. >- delete thisPtr; >-} >- >-// WorkerLoaderProxy ----------------------------------------------------------- >- >-void WebWorkerBase::postTaskToLoader(PassOwnPtr<ScriptExecutionContext::Task> task) >-{ >- ASSERT(m_loadingDocument->isDocument()); >- m_loadingDocument->postTask(task); >-} >- >-void WebWorkerBase::postTaskForModeToWorkerContext( >- PassOwnPtr<ScriptExecutionContext::Task> task, const String& mode) >+void WebWorkerBase::dispatchTaskToMainThread(PassOwnPtr<ScriptExecutionContext::Task> task) > { >- m_workerThread->runLoop().postTaskForMode(task, mode); >+ callOnMainThread(invokeTaskMethod, task.leakPtr()); > } > > #endif // ENABLE(WORKERS) >diff --git a/Source/WebKit/chromium/src/WebWorkerBase.h b/Source/WebKit/chromium/src/WebWorkerBase.h >index 93599f4..c43c639 100644 >--- a/Source/WebKit/chromium/src/WebWorkerBase.h >+++ b/Source/WebKit/chromium/src/WebWorkerBase.h >@@ -35,138 +35,26 @@ > > #include "ScriptExecutionContext.h" > #include "WebCommonWorkerClient.h" >-#include "WebFrameClient.h" > #include "WorkerLoaderProxy.h" > #include "WorkerObjectProxy.h" >-#include "WorkerThread.h" > #include <wtf/PassOwnPtr.h> > #include <wtf/RefPtr.h> > >-namespace WebCore { >-class WorkerThread; >-} > > namespace WebKit { >-class WebApplicationCacheHost; >-class WebApplicationCacheHostClient; >-class WebCommonWorkerClient; >-class WebSecurityOrigin; >-class WebString; >-class WebURL; > class WebView; >-class WebWorker; >-class WebWorkerClient; > > // Base class for WebSharedWorkerImpl, WebWorkerClientImpl and (defunct) WebWorkerImpl > // containing common interface for shared workers and dedicated in-proc workers implementation. > // > // FIXME: Rename this class into WebWorkerBase, merge existing WebWorkerBase and WebSharedWorker. >-class NewWebWorkerBase : public WebCore::WorkerLoaderProxy { >+class WebWorkerBase : public WebCore::WorkerLoaderProxy { > public: >- virtual NewWebCommonWorkerClient* newCommonClient() = 0; >+ virtual WebCommonWorkerClient* commonClient() = 0; > virtual WebView* view() const = 0; >-}; >- >-// Base class for WebSharedWorkerImpl and WebWorkerImpl. It contains common >-// code used by both implementation classes, including implementations of the >-// WorkerObjectProxy and WorkerLoaderProxy interfaces. >-class WebWorkerBase : public WebCore::WorkerObjectProxy >- , public NewWebWorkerBase >- , public WebFrameClient { >-public: >- WebWorkerBase(); >- virtual ~WebWorkerBase(); >- >- // WebCommonWorkerBase methods: >- virtual void postMessageToWorkerObject( >- PassRefPtr<WebCore::SerializedScriptValue>, >- PassOwnPtr<WebCore::MessagePortChannelArray>); >- virtual void postExceptionToWorkerObject( >- const WTF::String&, int, const WTF::String&); >- virtual void postConsoleMessageToWorkerObject( >- WebCore::MessageSource, WebCore::MessageType, >- WebCore::MessageLevel, const WTF::String&, int, const WTF::String&); >- virtual void postMessageToPageInspector(const WTF::String&); >- virtual void updateInspectorStateCookie(const WTF::String&); >- virtual void confirmMessageFromWorkerObject(bool); >- virtual void reportPendingActivity(bool); >- virtual void workerContextClosed(); >- virtual void workerContextDestroyed(); >- virtual WebView* view() const { return m_webView; } >- >- // WebCore::WorkerLoaderProxy methods: >- virtual void postTaskToLoader(PassOwnPtr<WebCore::ScriptExecutionContext::Task>); >- virtual void postTaskForModeToWorkerContext( >- PassOwnPtr<WebCore::ScriptExecutionContext::Task>, const WTF::String& mode); >- >- // WebFrameClient methods to support resource loading thru the 'shadow page'. >- virtual void didCreateDataSource(WebFrame*, WebDataSource*); >- virtual WebApplicationCacheHost* createApplicationCacheHost(WebFrame*, WebApplicationCacheHostClient*); > > // Executes the given task on the main thread. > static void dispatchTaskToMainThread(PassOwnPtr<WebCore::ScriptExecutionContext::Task>); >- >-protected: >- virtual WebCommonWorkerClient* commonClient() = 0; >- virtual WebWorkerClient* client() = 0; >- >- void setWorkerThread(PassRefPtr<WebCore::WorkerThread> thread) { m_workerThread = thread; } >- WebCore::WorkerThread* workerThread() { return m_workerThread.get(); } >- >- // Shuts down the worker thread. >- void stopWorkerThread(); >- >- // Creates the shadow loader used for worker network requests. >- void initializeLoader(const WebURL&); >- >-private: >- // Function used to invoke tasks on the main thread. >- static void invokeTaskMethod(void*); >- >- // Tasks that are run on the main thread. >- static void postMessageTask( >- WebCore::ScriptExecutionContext* context, >- WebWorkerBase* thisPtr, >- WTF::String message, >- PassOwnPtr<WebCore::MessagePortChannelArray> channels); >- static void postExceptionTask( >- WebCore::ScriptExecutionContext* context, >- WebWorkerBase* thisPtr, >- const WTF::String& message, >- int lineNumber, >- const WTF::String& sourceURL); >- static void postConsoleMessageTask( >- WebCore::ScriptExecutionContext* context, >- WebWorkerBase* thisPtr, >- int source, >- int type, >- int level, >- const WTF::String& message, >- int lineNumber, >- const WTF::String& sourceURL); >- static void postMessageToPageInspectorTask(WebCore::ScriptExecutionContext*, WebWorkerBase*, const WTF::String&); >- static void updateInspectorStateCookieTask(WebCore::ScriptExecutionContext*, WebWorkerBase* thisPtr, const WTF::String& cookie); >- static void confirmMessageTask( >- WebCore::ScriptExecutionContext* context, >- WebWorkerBase* thisPtr, >- bool hasPendingActivity); >- static void reportPendingActivityTask( >- WebCore::ScriptExecutionContext* context, >- WebWorkerBase* thisPtr, >- bool hasPendingActivity); >- static void workerContextClosedTask( >- WebCore::ScriptExecutionContext* context, >- WebWorkerBase* thisPtr); >- static void workerContextDestroyedTask( >- WebCore::ScriptExecutionContext* context, >- WebWorkerBase* thisPtr); >- >- // 'shadow page' - created to proxy loading requests from the worker. >- RefPtr<WebCore::ScriptExecutionContext> m_loadingDocument; >- WebView* m_webView; >- bool m_askedToTerminate; >- >- RefPtr<WebCore::WorkerThread> m_workerThread; > }; > > } // namespace WebKit >diff --git a/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp b/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp >index 5b9f320..5090aff 100644 >--- a/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp >+++ b/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp >@@ -63,7 +63,6 @@ > #include "platform/WebURL.h" > #include "WebViewImpl.h" > #include "WebWorker.h" >-#include "WebWorkerImpl.h" > > using namespace WebCore; > >diff --git a/Source/WebKit/chromium/src/WebWorkerClientImpl.h b/Source/WebKit/chromium/src/WebWorkerClientImpl.h >index 7006a94..5189ad1 100644 >--- a/Source/WebKit/chromium/src/WebWorkerClientImpl.h >+++ b/Source/WebKit/chromium/src/WebWorkerClientImpl.h >@@ -58,8 +58,8 @@ class WebFrameImpl; > // In essence, this class wraps WorkerMessagingProxy. > class WebWorkerClientImpl : public WebCore::WorkerContextProxy > , public WebCore::WorkerObjectProxy >- , public NewWebWorkerBase >- , public NewWebCommonWorkerClient { >+ , public WebWorkerBase >+ , public WebCommonWorkerClient { > public: > // WebCore::WorkerContextProxy Factory. > static WebCore::WorkerContextProxy* createWorkerContextProxy(WebCore::Worker*); >@@ -107,7 +107,7 @@ public: > WebFileSystemCallbacks*); > > // WebCommentWorkerBase methods: >- virtual NewWebCommonWorkerClient* newCommonClient() { return this; } >+ virtual WebCommonWorkerClient* commonClient() { return this; } > virtual WebView* view() const; > > private: >diff --git a/Source/WebKit/chromium/src/WebWorkerImpl.cpp b/Source/WebKit/chromium/src/WebWorkerImpl.cpp >deleted file mode 100644 >index dcbfeee..0000000 >--- a/Source/WebKit/chromium/src/WebWorkerImpl.cpp >+++ /dev/null >@@ -1,163 +0,0 @@ >-/* >- * Copyright (C) 2009 Google Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions are >- * met: >- * >- * * Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * * Redistributions in binary form must reproduce the above >- * copyright notice, this list of conditions and the following disclaimer >- * in the documentation and/or other materials provided with the >- * distribution. >- * * Neither the name of Google Inc. nor the names of its >- * contributors may be used to endorse or promote products derived from >- * this software without specific prior written permission. >- * >- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "WebWorkerImpl.h" >- >-#include "CrossThreadTask.h" >-#include "DedicatedWorkerContext.h" >-#include "DedicatedWorkerThread.h" >-#include "KURL.h" >-#include "MessageEvent.h" >-#include "MessagePort.h" >-#include "MessagePortChannel.h" >-#include "ScriptExecutionContext.h" >-#include "SecurityOrigin.h" >-#include "SerializedScriptValue.h" >-#include "SubstituteData.h" >-#include <wtf/OwnPtr.h> >-#include <wtf/Threading.h> >- >-#include "PlatformMessagePortChannel.h" >-#include "WebMessagePortChannel.h" >-#include "platform/WebString.h" >-#include "platform/WebURL.h" >-#include "WebWorkerClient.h" >- >-using namespace WebCore; >- >-namespace WebKit { >- >-#if ENABLE(WORKERS) >- >-WebWorker* WebWorker::create(WebWorkerClient* client) >-{ >- return new WebWorkerImpl(client); >-} >- >- >-WebWorkerImpl::WebWorkerImpl(WebWorkerClient* client) >- : m_client(client) >-{ >-} >- >-WebWorkerImpl::~WebWorkerImpl() >-{ >-} >- >-NewWebCommonWorkerClient* WebWorkerImpl::newCommonClient() >-{ >- return m_client; >-} >- >-WebCommonWorkerClient* WebWorkerImpl::commonClient() >-{ >- return m_client; >-} >- >-void WebWorkerImpl::postMessageToWorkerContextTask(WebCore::ScriptExecutionContext* context, >- WebWorkerImpl* thisPtr, >- const String& message, >- PassOwnPtr<MessagePortChannelArray> channels) >-{ >- ASSERT(context->isWorkerContext()); >- DedicatedWorkerContext* workerContext = >- static_cast<DedicatedWorkerContext*>(context); >- >- OwnPtr<MessagePortArray> ports = >- MessagePort::entanglePorts(*context, channels); >- RefPtr<SerializedScriptValue> serializedMessage = >- SerializedScriptValue::createFromWire(message); >- workerContext->dispatchEvent(MessageEvent::create( >- ports.release(), serializedMessage.release())); >- thisPtr->confirmMessageFromWorkerObject(workerContext->hasPendingActivity()); >-} >- >-// WebWorker ------------------------------------------------------------------- >- >-void WebWorkerImpl::startWorkerContext(const WebURL& scriptUrl, >- const WebString& userAgent, >- const WebString& sourceCode) >-{ >- initializeLoader(scriptUrl); >- setWorkerThread(DedicatedWorkerThread::create(scriptUrl, userAgent, sourceCode, *this, *this, DontPauseWorkerContextOnStart)); >- // Worker initialization means a pending activity. >- reportPendingActivity(true); >- workerThread()->start(); >-} >- >-void WebWorkerImpl::terminateWorkerContext() >-{ >- stopWorkerThread(); >-} >- >-void WebWorkerImpl::postMessageToWorkerContext(const WebString& message, >- const WebMessagePortChannelArray& webChannels) >-{ >- OwnPtr<MessagePortChannelArray> channels; >- if (webChannels.size()) { >- channels = adoptPtr(new MessagePortChannelArray(webChannels.size())); >- for (size_t i = 0; i < webChannels.size(); ++i) { >- RefPtr<PlatformMessagePortChannel> platform_channel = >- PlatformMessagePortChannel::create(webChannels[i]); >- webChannels[i]->setClient(platform_channel.get()); >- (*channels)[i] = MessagePortChannel::create(platform_channel); >- } >- } >- >- workerThread()->runLoop().postTask( >- createCallbackTask(&postMessageToWorkerContextTask, >- AllowCrossThreadAccess(this), String(message), channels.release())); >-} >- >-void WebWorkerImpl::workerObjectDestroyed() >-{ >- // Worker object in the renderer was destroyed, perhaps a result of GC. >- // For us, it's a signal to start terminating the WorkerContext too. >- // FIXME: when 'kill a worker' html5 spec algorithm is implemented, it >- // should be used here instead of 'terminate a worker'. >- terminateWorkerContext(); >-} >- >-void WebWorkerImpl::clientDestroyed() >-{ >- m_client = 0; >-} >- >-#else >- >-WebWorker* WebWorker::create(WebWorkerClient* client) >-{ >- return 0; >-} >- >-#endif // ENABLE(WORKERS) >- >-} // namespace WebKit >diff --git a/Source/WebKit/chromium/src/WebWorkerImpl.h b/Source/WebKit/chromium/src/WebWorkerImpl.h >deleted file mode 100644 >index 4f052a7..0000000 >--- a/Source/WebKit/chromium/src/WebWorkerImpl.h >+++ /dev/null >@@ -1,84 +0,0 @@ >-/* >- * Copyright (C) 2009 Google Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions are >- * met: >- * >- * * Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * * Redistributions in binary form must reproduce the above >- * copyright notice, this list of conditions and the following disclaimer >- * in the documentation and/or other materials provided with the >- * distribution. >- * * Neither the name of Google Inc. nor the names of its >- * contributors may be used to endorse or promote products derived from >- * this software without specific prior written permission. >- * >- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (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 WebWorkerImpl_h >-#define WebWorkerImpl_h >- >-#include "WebWorker.h" >- >-#if ENABLE(WORKERS) >- >-#include "ScriptExecutionContext.h" >- >-#include "WebWorkerBase.h" >- >-namespace WebKit { >- >-// This class is used by the worker process code to talk to the WebCore::Worker >-// implementation. It can't use it directly since it uses WebKit types, so this >-// class converts the data types. When the WebCore::Worker object wants to call >-// WebCore::WorkerObjectProxy, this class will conver to Chrome data types first >-// and then call the supplied WebWorkerClient. >-class WebWorkerImpl : public WebWorkerBase, public WebWorker { >-public: >- explicit WebWorkerImpl(WebWorkerClient* client); >- >- // WebWorker methods: >- virtual void startWorkerContext(const WebURL&, const WebString&, const WebString&); >- virtual void terminateWorkerContext(); >- virtual void postMessageToWorkerContext(const WebString&, const WebMessagePortChannelArray&); >- virtual void workerObjectDestroyed(); >- virtual void clientDestroyed(); >- >- // WebWorkerBase methods: >- virtual WebWorkerClient* client() { return m_client; } >- virtual WebCommonWorkerClient* commonClient(); >- >- // NewWebWorkerBase methods: >- virtual NewWebCommonWorkerClient* newCommonClient(); >- >-private: >- virtual ~WebWorkerImpl(); >- >- // Tasks that are run on the worker thread. >- static void postMessageToWorkerContextTask( >- WebCore::ScriptExecutionContext* context, >- WebWorkerImpl* thisPtr, >- const WTF::String& message, >- PassOwnPtr<WebCore::MessagePortChannelArray> channels); >- >- WebWorkerClient* m_client; >-}; >- >-} // namespace WebKit >- >-#endif // ENABLE(WORKERS) >- >-#endif >diff --git a/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp b/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp >index 523ef75..8ce5e69 100644 >--- a/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp >+++ b/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp >@@ -156,7 +156,7 @@ void WorkerFileSystemCallbacksBridge::stop() > } > } > >-void WorkerFileSystemCallbacksBridge::postOpenFileSystemToMainThread(NewWebCommonWorkerClient* commonClient, WebFileSystem::Type type, long long size, bool create, const String& mode) >+void WorkerFileSystemCallbacksBridge::postOpenFileSystemToMainThread(WebCommonWorkerClient* commonClient, WebFileSystem::Type type, long long size, bool create, const String& mode) > { > dispatchTaskToMainThread( > createCallbackTask(&openFileSystemOnMainThread, >@@ -251,7 +251,7 @@ void WorkerFileSystemCallbacksBridge::postReadDirectoryToMainThread(WebFileSyste > AllowCrossThreadAccess(this), mode)); > } > >-void WorkerFileSystemCallbacksBridge::openFileSystemOnMainThread(ScriptExecutionContext*, NewWebCommonWorkerClient* commonClient, WebFileSystem::Type type, long long size, bool create, WorkerFileSystemCallbacksBridge* bridge, const String& mode) >+void WorkerFileSystemCallbacksBridge::openFileSystemOnMainThread(ScriptExecutionContext*, WebCommonWorkerClient* commonClient, WebFileSystem::Type type, long long size, bool create, WorkerFileSystemCallbacksBridge* bridge, const String& mode) > { > if (!commonClient) > bridge->didFailOnMainThread(WebFileErrorAbort, mode); >diff --git a/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h b/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h >index 8ae7eb3..9c44cb1 100644 >--- a/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h >+++ b/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h >@@ -51,7 +51,7 @@ namespace WebKit { > > class AsyncFileSystem; > class MainThreadFileSystemCallbacks; >-class NewWebCommonWorkerClient; >+class WebCommonWorkerClient; > class ThreadableCallbacksBridgeWrapper; > class WebFileSystemCallbacks; > struct WebFileInfo; >@@ -87,7 +87,7 @@ public: > } > > // Methods that create an instance and post an initial request task to the main thread. They must be called on the worker thread. >- void postOpenFileSystemToMainThread(NewWebCommonWorkerClient*, WebFileSystem::Type, long long size, bool create, const String& mode); >+ void postOpenFileSystemToMainThread(WebCommonWorkerClient*, WebFileSystem::Type, long long size, bool create, const String& mode); > void postMoveToMainThread(WebFileSystem*, const WebCore::KURL& srcPath, const WebCore::KURL& destPath, const String& mode); > void postCopyToMainThread(WebFileSystem*, const WebCore::KURL& srcPath, const WebCore::KURL& destPath, const String& mode); > void postRemoveToMainThread(WebFileSystem*, const WebCore::KURL& path, const String& mode); >@@ -110,7 +110,7 @@ private: > WorkerFileSystemCallbacksBridge(WebCore::WorkerLoaderProxy*, WebCore::ScriptExecutionContext*, WebFileSystemCallbacks*); > > // Methods that are to be called on the main thread. >- static void openFileSystemOnMainThread(WebCore::ScriptExecutionContext*, NewWebCommonWorkerClient*, WebFileSystem::Type, long long size, bool create, WorkerFileSystemCallbacksBridge*, const String& mode); >+ static void openFileSystemOnMainThread(WebCore::ScriptExecutionContext*, WebCommonWorkerClient*, WebFileSystem::Type, long long size, bool create, WorkerFileSystemCallbacksBridge*, const String& mode); > static void moveOnMainThread(WebCore::ScriptExecutionContext*, WebFileSystem*, const WebCore::KURL& srcPath, const WebCore::KURL& destPath, WorkerFileSystemCallbacksBridge*, const String& mode); > static void copyOnMainThread(WebCore::ScriptExecutionContext*, WebFileSystem*, const WebCore::KURL& srcPath, const WebCore::KURL& destPath, WorkerFileSystemCallbacksBridge*, const String& mode); > static void removeOnMainThread(WebCore::ScriptExecutionContext*, WebFileSystem*, const WebCore::KURL& path, WorkerFileSystemCallbacksBridge*, const String& mode); >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index d294bef..f315e11 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,22 @@ >+2011-12-28 Dmitry Lomov <dslomov@google.com> >+ >+ >+ [WebWorkers][Chromium] Remove remains of cross-process dedicated worker implementation. >+ https://bugs.webkit.org/show_bug.cgi?id=66509 >+ Just renames, merges and removal of dead code. Here are the list of renames: >+ - WebCommonWorkerClient merged with WebWorkerClient and renamed to WebSharedWorkerClient >+ - NewWebCommonWorkerClient renamed to WebCommonWorkerClient >+ - WebWorkerBase merged into WebSharedWorkerImpl >+ - NewWebWorkerBase renamed into WebWorkerBase >+ >+ Reviewed by David Levin. >+ >+ * DumpRenderTree/chromium/TestWebWorker.h: >+ (TestWebWorker::createWorker): >+ * DumpRenderTree/chromium/WebViewHost.cpp: >+ (WebViewHost::createWorker): >+ * DumpRenderTree/chromium/WebViewHost.h: >+ > 2011-12-28 Sheriff Bot <webkit.review.bot@gmail.com> > > Unreviewed, rolling out r103620. >diff --git a/Tools/DumpRenderTree/chromium/TestWebWorker.h b/Tools/DumpRenderTree/chromium/TestWebWorker.h >index 71bffce..ad82a87 100644 >--- a/Tools/DumpRenderTree/chromium/TestWebWorker.h >+++ b/Tools/DumpRenderTree/chromium/TestWebWorker.h >@@ -32,8 +32,8 @@ > #define TestWebWorker_h > > #include "WebMessagePortChannel.h" >+#include "WebSharedWorkerClient.h" > #include "WebWorker.h" >-#include "WebWorkerClient.h" > #include <wtf/RefCounted.h> > > namespace WebKit { >@@ -43,7 +43,7 @@ class WebURL; > } > > class TestWebWorker : public WebKit::WebWorker, >- public WebKit::WebWorkerClient, >+ public WebKit::WebSharedWorkerClient, > public WTF::RefCounted<TestWebWorker> { > public: > TestWebWorker() >@@ -80,7 +80,7 @@ public: > // Releases the reference held for worker context object. > deref(); > } >- virtual WebKit::WebWorker* createWorker(WebKit::WebWorkerClient*) { return 0; } >+ virtual WebKit::WebWorker* createWorker(WebKit::WebSharedWorkerClient*) { return 0; } > virtual WebKit::WebNotificationPresenter* notificationPresenter() { return 0; } > virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(WebKit::WebApplicationCacheHostClient*) { return 0; } > virtual bool allowDatabase(WebKit::WebFrame*, const WebKit::WebString&, const WebKit::WebString&, unsigned long) { return true; } >diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.cpp b/Tools/DumpRenderTree/chromium/WebViewHost.cpp >index ffe3b16..24bd48f 100644 >--- a/Tools/DumpRenderTree/chromium/WebViewHost.cpp >+++ b/Tools/DumpRenderTree/chromium/WebViewHost.cpp >@@ -836,7 +836,7 @@ WebPlugin* WebViewHost::createPlugin(WebFrame* frame, const WebPluginParams& par > return webkit_support::CreateWebPlugin(frame, params); > } > >-WebWorker* WebViewHost::createWorker(WebFrame*, WebWorkerClient*) >+WebWorker* WebViewHost::createWorker(WebFrame*, WebSharedWorkerClient*) > { > return new TestWebWorker(); > } >diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.h b/Tools/DumpRenderTree/chromium/WebViewHost.h >index 922163a..a2f7bca 100644 >--- a/Tools/DumpRenderTree/chromium/WebViewHost.h >+++ b/Tools/DumpRenderTree/chromium/WebViewHost.h >@@ -55,6 +55,7 @@ class WebDeviceOrientationClientMock; > class WebGeolocationClient; > class WebGeolocationClientMock; > class WebGeolocationServiceMock; >+class WebSharedWorkerClient; > class WebSpeechInputController; > class WebSpeechInputControllerMock; > class WebSpeechInputListener; >@@ -173,7 +174,7 @@ class WebViewHost : public WebKit::WebSpellCheckClient, public WebKit::WebViewCl > > // WebKit::WebFrameClient > virtual WebKit::WebPlugin* createPlugin(WebKit::WebFrame*, const WebKit::WebPluginParams&); >- virtual WebKit::WebWorker* createWorker(WebKit::WebFrame*, WebKit::WebWorkerClient*); >+ virtual WebKit::WebWorker* createWorker(WebKit::WebFrame*, WebKit::WebSharedWorkerClient*); > virtual WebKit::WebMediaPlayer* createMediaPlayer(WebKit::WebFrame*, WebKit::WebMediaPlayerClient*); > virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(WebKit::WebFrame*, WebKit::WebApplicationCacheHostClient*); > virtual void loadURLExternally(WebKit::WebFrame*, const WebKit::WebURLRequest&, WebKit::WebNavigationPolicy);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 66509
:
120377
|
120395
|
120402
|
120405
|
120702
| 120704