Diff
Modified: trunk/Source/WebKit/chromium/ChangeLog (92801 => 92802)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-08-10 23:19:30 UTC (rev 92801)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-08-10 23:51:29 UTC (rev 92802)
@@ -1,3 +1,37 @@
+2011-08-10 Dmitry Lomov <dslo...@google.com>
+
+ [Chromium] Decouple implementation of allowFileSystem, openFileSystem and allowDatabase from WebWorkerBase.
+ https://bugs.webkit.org/show_bug.cgi?id=65997.
+
+ This patch moves implementation of allowFileSystem, openFileSystem and allowDatabase from
+ WebWorkerBase to respectively LocalFileSystemChromium and DatabaseObserver,
+ parameterizing them with relevant data from WebWorker.
+
+ Reviewed by Jian Li.
+
+ * src/DatabaseObserver.cpp: Move allowDatabase from WebWorkerBase and update the caller.
+ (WebKit::AllowDatabaseMainThreadBridge::create):
+ (WebKit::AllowDatabaseMainThreadBridge::cancel):
+ (WebKit::AllowDatabaseMainThreadBridge::result):
+ (WebKit::AllowDatabaseMainThreadBridge::signalCompleted):
+ (WebKit::AllowDatabaseMainThreadBridge::AllowDatabaseMainThreadBridge):
+ (WebKit::AllowDatabaseMainThreadBridge::allowDatabaseTask):
+ (WebKit::AllowDatabaseMainThreadBridge::didComplete):
+ (WebKit::allowDatabaseForWorker):
+ (WebCore::DatabaseObserver::canEstablishDatabase):
+ * src/LocalFileSystemChromium.cpp: Move allowFileSystem and openFileSystem from WebWorkerBase and update the caller.
+ (WebCore::openFileSystemHelper):
+ * src/WebWorkerBase.cpp: Move allowFileSystem, openFileSystem and allowDatabase to LocalFileSystemChromium and DatabaseObserver resp.
+ * src/WebWorkerBase.h:
+ (WebKit::WebWorkerBase::webView):
+ * src/WorkerFileSystemCallbacksBridge.cpp: Generalized WorkerFileSystemCallbacksBridge to work on WorkerLoaderProxy, not on WebWorkerBase.
+ (WebKit::WorkerFileSystemCallbacksBridge::stop):
+ (WebKit::WorkerFileSystemCallbacksBridge::WorkerFileSystemCallbacksBridge):
+ (WebKit::WorkerFileSystemCallbacksBridge::dispatchTaskToMainThread):
+ (WebKit::WorkerFileSystemCallbacksBridge::mayPostTaskToWorker):
+ * src/WorkerFileSystemCallbacksBridge.h:
+ (WebKit::WorkerFileSystemCallbacksBridge::create):
+
2011-08-10 Vsevolod Vlasov <vse...@chromium.org>
Web Inspector: Remove Network.initialContentSet from protocol, store workers content on backend.
Modified: trunk/Source/WebKit/chromium/src/DatabaseObserver.cpp (92801 => 92802)
--- trunk/Source/WebKit/chromium/src/DatabaseObserver.cpp 2011-08-10 23:19:30 UTC (rev 92801)
+++ trunk/Source/WebKit/chromium/src/DatabaseObserver.cpp 2011-08-10 23:51:29 UTC (rev 92802)
@@ -34,8 +34,11 @@
#if ENABLE(DATABASE)
#include "AbstractDatabase.h"
+#include "CrossThreadCopier.h"
+#include "CrossThreadTask.h"
#include "Document.h"
#include "ScriptExecutionContext.h"
+#include "WebCommonWorkerClient.h"
#include "WebDatabase.h"
#include "WebDatabaseObserver.h"
#include "WebFrameClient.h"
@@ -45,10 +48,107 @@
#include "WebViewImpl.h"
#include "WebWorkerImpl.h"
#include "WorkerContext.h"
+#include "WorkerLoaderProxy.h"
+#include "WorkerScriptController.h"
#include "WorkerThread.h"
using namespace WebKit;
+namespace {
+
+#if ENABLE(WORKERS)
+
+static const char allowDatabaseMode[] = "allowDatabaseMode";
+
+// This class is used to route the result of the WebWorkerBase::allowDatabase
+// call back to the worker context.
+class AllowDatabaseMainThreadBridge : public ThreadSafeRefCounted<AllowDatabaseMainThreadBridge> {
+public:
+ static PassRefPtr<AllowDatabaseMainThreadBridge> create(WebCore::WorkerLoaderProxy* workerLoaderProxy, const WTF::String& mode, WebCommonWorkerClient* commonClient, WebFrame* frame, const WTF::String& name, const WTF::String& displayName, unsigned long estimatedSize)
+ {
+ return adoptRef(new AllowDatabaseMainThreadBridge(workerLoaderProxy, mode, commonClient, frame, name, displayName, estimatedSize));
+ }
+
+ // These methods are invoked on the worker context.
+ void cancel()
+ {
+ MutexLocker locker(m_mutex);
+ m_workerLoaderProxy = 0;
+ }
+
+ bool result()
+ {
+ return m_result;
+ }
+
+ // This method is invoked on the main thread.
+ void signalCompleted(bool result)
+ {
+ MutexLocker locker(m_mutex);
+ if (m_workerLoaderProxy)
+ m_workerLoaderProxy->postTaskForModeToWorkerContext(
+ createCallbackTask(&didComplete, WebCore::AllowCrossThreadAccess(this), result),
+ m_mode);
+ }
+
+private:
+ AllowDatabaseMainThreadBridge(WebCore::WorkerLoaderProxy* workerLoaderProxy, const WTF::String& mode, WebCommonWorkerClient* commonClient, WebFrame* frame, const WTF::String& name, const WTF::String& displayName, unsigned long estimatedSize)
+ : m_workerLoaderProxy(workerLoaderProxy)
+ , m_mode(mode)
+ {
+ WebWorkerBase::dispatchTaskToMainThread(
+ createCallbackTask(&allowDatabaseTask, WebCore::AllowCrossThreadAccess(commonClient),
+ WebCore::AllowCrossThreadAccess(frame),
+ String(name), String(displayName), estimatedSize,
+ WebCore::AllowCrossThreadAccess(this)));
+ }
+
+ static void allowDatabaseTask(WebCore::ScriptExecutionContext* context, WebCommonWorkerClient* commonClient, WebFrame* frame, const WTF::String name, const WTF::String displayName, unsigned long estimatedSize, PassRefPtr<AllowDatabaseMainThreadBridge> bridge)
+ {
+ if (commonClient)
+ bridge->signalCompleted(commonClient->allowDatabase(frame, name, displayName, estimatedSize));
+ else
+ bridge->signalCompleted(false);
+ }
+
+ static void didComplete(WebCore::ScriptExecutionContext* context, PassRefPtr<AllowDatabaseMainThreadBridge> bridge, bool result)
+ {
+ bridge->m_result = result;
+ }
+
+ bool m_result;
+ Mutex m_mutex;
+ WebCore::WorkerLoaderProxy* m_workerLoaderProxy;
+ WTF::String m_mode;
+};
+
+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();
+ WebCore::WorkerThread* workerThread = workerContext->thread();
+ WebCore::WorkerRunLoop& runLoop = workerThread->runLoop();
+ WebCore::WorkerLoaderProxy* workerLoaderProxy = &workerThread->workerLoaderProxy();
+
+ // Create a unique mode just for this synchronous call.
+ String mode = allowDatabaseMode;
+ mode.append(String::number(runLoop.createUniqueId()));
+
+ RefPtr<AllowDatabaseMainThreadBridge> bridge = AllowDatabaseMainThreadBridge::create(workerLoaderProxy, mode, commonClient, frame, String(name), String(displayName), estimatedSize);
+
+ // Either the bridge returns, or the queue gets terminated.
+ if (runLoop.runInMode(workerContext, mode) == MessageQueueTerminated) {
+ bridge->cancel();
+ return false;
+ }
+
+ return bridge->result();
+}
+
+#endif
+
+}
+
namespace WebCore {
bool DatabaseObserver::canEstablishDatabase(ScriptExecutionContext* scriptExecutionContext, const String& name, const String& displayName, unsigned long estimatedSize)
@@ -66,7 +166,7 @@
WorkerContext* workerContext = static_cast<WorkerContext*>(scriptExecutionContext);
WorkerLoaderProxy* workerLoaderProxy = &workerContext->thread()->workerLoaderProxy();
WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerLoaderProxy);
- return webWorker->allowDatabase(0, name, displayName, estimatedSize);
+ return allowDatabaseForWorker(webWorker->commonClient(), webWorker->webView()->mainFrame(), name, displayName, estimatedSize);
#else
ASSERT_NOT_REACHED();
#endif
Modified: trunk/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp (92801 => 92802)
--- trunk/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp 2011-08-10 23:19:30 UTC (rev 92801)
+++ trunk/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp 2011-08-10 23:51:29 UTC (rev 92802)
@@ -40,6 +40,7 @@
#include "FileSystemCallback.h"
#include "FileSystemCallbacks.h"
#include "PlatformString.h"
+#include "WebCommonWorkerClient.h"
#include "WebFileError.h"
#include "WebFileSystem.h"
#include "WebFileSystemCallbacksImpl.h"
@@ -49,6 +50,7 @@
#include "WebViewImpl.h"
#include "WebWorkerImpl.h"
#include "WorkerContext.h"
+#include "WorkerFileSystemCallbacksBridge.h"
#include "WorkerThread.h"
#include <wtf/Threading.h>
@@ -69,6 +71,116 @@
CreateIfNotPresent
};
+#if ENABLE(WORKERS)
+
+static const char allowFileSystemMode[] = "allowFileSystemMode";
+static const char openFileSystemMode[] = "openFileSystemMode";
+
+// This class is used to route the result of the WebWorkerBase::allowFileSystem
+// call back to the worker context.
+class AllowFileSystemMainThreadBridge : public ThreadSafeRefCounted<AllowFileSystemMainThreadBridge> {
+public:
+ static PassRefPtr<AllowFileSystemMainThreadBridge> create(WebCore::WorkerLoaderProxy* workerLoaderProxy, const WTF::String& mode, WebCommonWorkerClient* commonClient)
+ {
+ return adoptRef(new AllowFileSystemMainThreadBridge(workerLoaderProxy, mode, commonClient));
+ }
+
+ // These methods are invoked on the worker context.
+ void cancel()
+ {
+ MutexLocker locker(m_mutex);
+ m_workerLoaderProxy = 0;
+ }
+
+ bool result()
+ {
+ return m_result;
+ }
+
+ // This method is invoked on the main thread.
+ void signalCompleted(bool result)
+ {
+ MutexLocker locker(m_mutex);
+ if (m_workerLoaderProxy)
+ m_workerLoaderProxy->postTaskForModeToWorkerContext(
+ createCallbackTask(&didComplete, AllowCrossThreadAccess(this), result), m_mode);
+ }
+
+private:
+ AllowFileSystemMainThreadBridge(WebCore::WorkerLoaderProxy* workerLoaderProxy, const WTF::String& mode, WebCommonWorkerClient* commonClient)
+ : m_workerLoaderProxy(workerLoaderProxy)
+ , m_mode(mode)
+ {
+ WebWorkerBase::dispatchTaskToMainThread(
+ createCallbackTask(&allowFileSystemTask, AllowCrossThreadAccess(commonClient),
+ AllowCrossThreadAccess(this)));
+ }
+
+ static void allowFileSystemTask(WebCore::ScriptExecutionContext* context, WebCommonWorkerClient* commonClient, PassRefPtr<AllowFileSystemMainThreadBridge> bridge)
+ {
+ if (commonClient)
+ bridge->signalCompleted(commonClient->allowFileSystem());
+ else
+ bridge->signalCompleted(false);
+ }
+
+ static void didComplete(WebCore::ScriptExecutionContext* context, PassRefPtr<AllowFileSystemMainThreadBridge> bridge, bool result)
+ {
+ bridge->m_result = result;
+ }
+
+ bool m_result;
+ Mutex m_mutex;
+ WebCore::WorkerLoaderProxy* m_workerLoaderProxy;
+ WTF::String m_mode;
+};
+
+bool allowFileSystemForWorker(WebCommonWorkerClient* commonClient)
+{
+ WorkerScriptController* controller = WorkerScriptController::controllerForContext();
+ WorkerContext* workerContext = controller->workerContext();
+ WebCore::WorkerThread* workerThread = workerContext->thread();
+ WorkerRunLoop& runLoop = workerThread->runLoop();
+ WebCore::WorkerLoaderProxy* workerLoaderProxy = &workerThread->workerLoaderProxy();
+
+ // Create a unique mode just for this synchronous call.
+ String mode = allowFileSystemMode;
+ mode.append(String::number(runLoop.createUniqueId()));
+
+ RefPtr<AllowFileSystemMainThreadBridge> bridge = AllowFileSystemMainThreadBridge::create(workerLoaderProxy, mode, commonClient);
+
+ // Either the bridge returns, or the queue gets terminated.
+ if (runLoop.runInMode(workerContext, mode) == MessageQueueTerminated) {
+ bridge->cancel();
+ return false;
+ }
+
+ return bridge->result();
+}
+
+void openFileSystemForWorker(WebCommonWorkerClient* commonClient, WebFileSystem::Type type, long long size, bool create, WebFileSystemCallbacks* callbacks, bool synchronous)
+{
+ WorkerScriptController* controller = WorkerScriptController::controllerForContext();
+ WorkerContext* workerContext = controller->workerContext();
+ WebCore::WorkerThread* workerThread = workerContext->thread();
+ WorkerRunLoop& runLoop = workerThread->runLoop();
+ WebCore::WorkerLoaderProxy* workerLoaderProxy = &workerThread->workerLoaderProxy();
+
+ // Create a unique mode for this openFileSystem call.
+ String mode = openFileSystemMode;
+ mode.append(String::number(runLoop.createUniqueId()));
+
+ RefPtr<WorkerFileSystemCallbacksBridge> bridge = WorkerFileSystemCallbacksBridge::create(workerLoaderProxy, workerContext, callbacks);
+ bridge->postOpenFileSystemToMainThread(commonClient, type, size, create, mode);
+
+ if (synchronous) {
+ if (runLoop.runInMode(workerContext, mode) == MessageQueueTerminated)
+ bridge->stop();
+ }
+}
+
+#endif // ENABLE(WORKERS)
+
} // namespace
static void openFileSystemNotAllowed(ScriptExecutionContext*, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
@@ -93,10 +205,10 @@
WorkerContext* workerContext = static_cast<WorkerContext*>(context);
WorkerLoaderProxy* workerLoaderProxy = &workerContext->thread()->workerLoaderProxy();
WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerLoaderProxy);
- if (!webWorker->allowFileSystem())
+ if (!allowFileSystemForWorker(webWorker->commonClient()))
allowed = false;
else
- webWorker->openFileSystemForWorker(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();
#endif
Modified: trunk/Source/WebKit/chromium/src/WebWorkerBase.cpp (92801 => 92802)
--- trunk/Source/WebKit/chromium/src/WebWorkerBase.cpp 2011-08-10 23:19:30 UTC (rev 92801)
+++ trunk/Source/WebKit/chromium/src/WebWorkerBase.cpp 2011-08-10 23:51:29 UTC (rev 92802)
@@ -49,8 +49,7 @@
#include "WebWorkerClient.h"
#include "WorkerContext.h"
-#include "WorkerFileSystemCallbacksBridge.h"
-#include "WorkerScriptController.h"
+#include "WorkerLoaderProxy.h"
#include "WorkerThread.h"
#include <wtf/MainThread.h>
@@ -60,134 +59,6 @@
#if ENABLE(WORKERS)
-static const char allowDatabaseMode[] = "allowDatabaseMode";
-static const char allowFileSystemMode[] = "allowFileSystemMode";
-static const char openFileSystemMode[] = "openFileSystemMode";
-
-namespace {
-
-// This class is used to route the result of the WebWorkerBase::allowDatabase
-// call back to the worker context.
-class AllowDatabaseMainThreadBridge : public ThreadSafeRefCounted<AllowDatabaseMainThreadBridge> {
-public:
- static PassRefPtr<AllowDatabaseMainThreadBridge> create(WebWorkerBase* worker, const WTF::String& mode, WebCommonWorkerClient* commonClient, WebFrame* frame, const WTF::String& name, const WTF::String& displayName, unsigned long estimatedSize)
- {
- return adoptRef(new AllowDatabaseMainThreadBridge(worker, mode, commonClient, frame, name, displayName, estimatedSize));
- }
-
- // These methods are invoked on the worker context.
- void cancel()
- {
- MutexLocker locker(m_mutex);
- m_worker = 0;
- }
-
- bool result()
- {
- return m_result;
- }
-
- // This method is invoked on the main thread.
- void signalCompleted(bool result)
- {
- MutexLocker locker(m_mutex);
- if (m_worker)
- m_worker->postTaskForModeToWorkerContext(
- createCallbackTask(&didComplete, AllowCrossThreadAccess(this), result), m_mode);
- }
-
-private:
- AllowDatabaseMainThreadBridge(WebWorkerBase* worker, const WTF::String& mode, WebCommonWorkerClient* commonClient, WebFrame* frame, const WTF::String& name, const WTF::String& displayName, unsigned long estimatedSize)
- : m_worker(worker)
- , m_mode(mode)
- {
- worker->dispatchTaskToMainThread(
- createCallbackTask(&allowDatabaseTask, AllowCrossThreadAccess(commonClient),
- AllowCrossThreadAccess(frame),
- String(name), String(displayName), estimatedSize,
- AllowCrossThreadAccess(this)));
- }
-
- static void allowDatabaseTask(WebCore::ScriptExecutionContext* context, WebCommonWorkerClient* commonClient, WebFrame* frame, const WTF::String name, const WTF::String displayName, unsigned long estimatedSize, PassRefPtr<AllowDatabaseMainThreadBridge> bridge)
- {
- if (!commonClient)
- bridge->signalCompleted(false);
- else
- bridge->signalCompleted(commonClient->allowDatabase(frame, name, displayName, estimatedSize));
- }
-
- static void didComplete(WebCore::ScriptExecutionContext* context, PassRefPtr<AllowDatabaseMainThreadBridge> bridge, bool result)
- {
- bridge->m_result = result;
- }
-
- bool m_result;
- Mutex m_mutex;
- WebWorkerBase* m_worker;
- WTF::String m_mode;
-};
-
-// This class is used to route the result of the WebWorkerBase::allowFileSystem
-// call back to the worker context.
-class AllowFileSystemMainThreadBridge : public ThreadSafeRefCounted<AllowFileSystemMainThreadBridge> {
-public:
- static PassRefPtr<AllowFileSystemMainThreadBridge> create(WebWorkerBase* worker, const WTF::String& mode, WebCommonWorkerClient* commonClient)
- {
- return adoptRef(new AllowFileSystemMainThreadBridge(worker, mode, commonClient));
- }
-
- // These methods are invoked on the worker context.
- void cancel()
- {
- MutexLocker locker(m_mutex);
- m_worker = 0;
- }
-
- bool result()
- {
- return m_result;
- }
-
- // This method is invoked on the main thread.
- void signalCompleted(bool result)
- {
- MutexLocker locker(m_mutex);
- if (m_worker)
- m_worker->postTaskForModeToWorkerContext(
- createCallbackTask(&didComplete, AllowCrossThreadAccess(this), result), m_mode);
- }
-
-private:
- AllowFileSystemMainThreadBridge(WebWorkerBase* worker, const WTF::String& mode, WebCommonWorkerClient* commonClient)
- : m_worker(worker)
- , m_mode(mode)
- {
- worker->dispatchTaskToMainThread(
- createCallbackTask(&allowFileSystemTask, AllowCrossThreadAccess(commonClient),
- AllowCrossThreadAccess(this)));
- }
-
- static void allowFileSystemTask(WebCore::ScriptExecutionContext* context, WebCommonWorkerClient* commonClient, PassRefPtr<AllowFileSystemMainThreadBridge> bridge)
- {
- if (!commonClient)
- bridge->signalCompleted(false);
- else
- bridge->signalCompleted(commonClient->allowFileSystem());
- }
-
- static void didComplete(WebCore::ScriptExecutionContext* context, PassRefPtr<AllowFileSystemMainThreadBridge> bridge, bool result)
- {
- bridge->m_result = result;
- }
-
- bool m_result;
- Mutex m_mutex;
- WebWorkerBase* m_worker;
- WTF::String m_mode;
-};
-
-}
-
// 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
@@ -285,70 +156,6 @@
return 0;
}
-bool WebWorkerBase::allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize)
-{
- WorkerRunLoop& runLoop = m_workerThread->runLoop();
- WorkerScriptController* controller = WorkerScriptController::controllerForContext();
- WorkerContext* workerContext = controller->workerContext();
-
- // Create a unique mode just for this synchronous call.
- String mode = allowDatabaseMode;
- mode.append(String::number(runLoop.createUniqueId()));
-
- RefPtr<AllowDatabaseMainThreadBridge> bridge = AllowDatabaseMainThreadBridge::create(this, mode, commonClient(), m_webView->mainFrame(), String(name), String(displayName), estimatedSize);
-
- // Either the bridge returns, or the queue gets terminated.
- if (runLoop.runInMode(workerContext, mode) == MessageQueueTerminated) {
- bridge->cancel();
- return false;
- }
-
- return bridge->result();
-}
-
-#if ENABLE(FILE_SYSTEM)
-
-bool WebWorkerBase::allowFileSystem()
-{
- WorkerRunLoop& runLoop = m_workerThread->runLoop();
- WorkerScriptController* controller = WorkerScriptController::controllerForContext();
- WorkerContext* workerContext = controller->workerContext();
-
- // Create a unique mode just for this synchronous call.
- String mode = allowFileSystemMode;
- mode.append(String::number(runLoop.createUniqueId()));
-
- RefPtr<AllowFileSystemMainThreadBridge> bridge = AllowFileSystemMainThreadBridge::create(this, mode, commonClient());
-
- // Either the bridge returns, or the queue gets terminated.
- if (runLoop.runInMode(workerContext, mode) == MessageQueueTerminated) {
- bridge->cancel();
- return false;
- }
-
- return bridge->result();
-}
-
-void WebWorkerBase::openFileSystemForWorker(WebFileSystem::Type type, long long size, bool create, WebFileSystemCallbacks* callbacks, bool synchronous)
-{
- WorkerRunLoop& runLoop = m_workerThread->runLoop();
- WorkerScriptController* controller = WorkerScriptController::controllerForContext();
- WorkerContext* workerContext = controller->workerContext();
-
- // Create a unique mode for this openFileSystem call.
- String mode = openFileSystemMode;
- mode.append(String::number(runLoop.createUniqueId()));
-
- RefPtr<WorkerFileSystemCallbacksBridge> bridge = WorkerFileSystemCallbacksBridge::create(this, workerContext, callbacks);
- bridge->postOpenFileSystemToMainThread(commonClient(), type, size, create, mode);
-
- if (synchronous) {
- if (runLoop.runInMode(workerContext, mode) == MessageQueueTerminated)
- bridge->stop();
- }
-}
-#endif
-
// WorkerObjectProxy -----------------------------------------------------------
void WebWorkerBase::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> message,
Modified: trunk/Source/WebKit/chromium/src/WebWorkerBase.h (92801 => 92802)
--- trunk/Source/WebKit/chromium/src/WebWorkerBase.h 2011-08-10 23:19:30 UTC (rev 92801)
+++ trunk/Source/WebKit/chromium/src/WebWorkerBase.h 2011-08-10 23:51:29 UTC (rev 92802)
@@ -89,21 +89,15 @@
virtual void didCreateDataSource(WebFrame*, WebDataSource*);
virtual WebApplicationCacheHost* createApplicationCacheHost(WebFrame*, WebApplicationCacheHostClient*);
- // Controls whether access to Web Databases is allowed for this worker.
- bool allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize);
-
-#if ENABLE(FILE_SYSTEM)
- // Controls whether access to File System is allowed for this worker.
- bool allowFileSystem();
- void openFileSystemForWorker(WebFileSystem::Type, long long size, bool create, WebFileSystemCallbacks*, bool synchronous);
-#endif
-
// Executes the given task on the main thread.
static void dispatchTaskToMainThread(PassOwnPtr<WebCore::ScriptExecutionContext::Task>);
+ WebView* webView() const { return m_webView; }
+
+ virtual WebCommonWorkerClient* commonClient() = 0;
+
protected:
virtual WebWorkerClient* client() = 0;
- virtual WebCommonWorkerClient* commonClient() = 0;
void setWorkerThread(PassRefPtr<WebCore::WorkerThread> thread) { m_workerThread = thread; }
WebCore::WorkerThread* workerThread() { return m_workerThread.get(); }
Modified: trunk/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp (92801 => 92802)
--- trunk/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp 2011-08-10 23:19:30 UTC (rev 92801)
+++ trunk/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp 2011-08-10 23:51:29 UTC (rev 92802)
@@ -43,6 +43,7 @@
#include "WebURL.h"
#include "WebWorkerBase.h"
#include "WorkerContext.h"
+#include "WorkerLoaderProxy.h"
#include "WorkerScriptController.h"
#include "WorkerThread.h"
#include <wtf/MainThread.h>
@@ -147,7 +148,7 @@
{
ASSERT(m_workerContext->isContextThread());
MutexLocker locker(m_mutex);
- m_worker = 0;
+ m_workerLoaderProxy = 0;
if (m_callbacksOnWorkerThread) {
m_callbacksOnWorkerThread->didFail(WebFileErrorAbort);
@@ -337,9 +338,9 @@
AllowCrossThreadAccess(this), entries, hasMore), mode);
}
-WorkerFileSystemCallbacksBridge::WorkerFileSystemCallbacksBridge(WebWorkerBase* worker, ScriptExecutionContext* scriptExecutionContext, WebFileSystemCallbacks* callbacks)
+WorkerFileSystemCallbacksBridge::WorkerFileSystemCallbacksBridge(WebCore::WorkerLoaderProxy* workerLoaderProxy, ScriptExecutionContext* scriptExecutionContext, WebFileSystemCallbacks* callbacks)
: WorkerContext::Observer(static_cast<WorkerContext*>(scriptExecutionContext))
- , m_worker(worker)
+ , m_workerLoaderProxy(workerLoaderProxy)
, m_workerContext(scriptExecutionContext)
, m_callbacksOnWorkerThread(callbacks)
{
@@ -399,9 +400,9 @@
void WorkerFileSystemCallbacksBridge::dispatchTaskToMainThread(PassOwnPtr<WebCore::ScriptExecutionContext::Task> task)
{
- ASSERT(m_worker);
+ ASSERT(m_workerLoaderProxy);
ASSERT(m_workerContext->isContextThread());
- m_worker->dispatchTaskToMainThread(createCallbackTask(&runTaskOnMainThread, RefPtr<WorkerFileSystemCallbacksBridge>(this).release(), task));
+ WebWorkerBase::dispatchTaskToMainThread(createCallbackTask(&runTaskOnMainThread, RefPtr<WorkerFileSystemCallbacksBridge>(this).release(), task));
}
void WorkerFileSystemCallbacksBridge::mayPostTaskToWorker(PassOwnPtr<ScriptExecutionContext::Task> task, const String& mode)
@@ -413,8 +414,8 @@
// is very important, to ensure that the m_mutex is still valid when it gets unlocked.)
RefPtr<WorkerFileSystemCallbacksBridge> bridge = adoptRef(this);
MutexLocker locker(m_mutex);
- if (m_worker)
- m_worker->postTaskForModeToWorkerContext(createCallbackTask(&runTaskOnWorkerThread, bridge, task), mode);
+ if (m_workerLoaderProxy)
+ m_workerLoaderProxy->postTaskForModeToWorkerContext(createCallbackTask(&runTaskOnWorkerThread, bridge, task), mode);
}
} // namespace WebCore
Modified: trunk/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h (92801 => 92802)
--- trunk/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h 2011-08-10 23:19:30 UTC (rev 92801)
+++ trunk/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h 2011-08-10 23:51:29 UTC (rev 92802)
@@ -43,6 +43,10 @@
#include <wtf/PassRefPtr.h>
#include <wtf/Threading.h>
+namespace WebCore {
+class WorkerLoaderProxy;
+}
+
namespace WebKit {
class AsyncFileSystem;
@@ -50,7 +54,6 @@
class ThreadableCallbacksBridgeWrapper;
class WebCommonWorkerClient;
class WebFileSystemCallbacks;
-class WebWorkerBase;
struct WebFileInfo;
struct WebFileSystemEntry;
@@ -78,9 +81,9 @@
void stop();
- static PassRefPtr<WorkerFileSystemCallbacksBridge> create(WebWorkerBase* worker, WebCore::ScriptExecutionContext* workerContext, WebFileSystemCallbacks* callbacks)
+ static PassRefPtr<WorkerFileSystemCallbacksBridge> create(WebCore::WorkerLoaderProxy* workerLoaderProxy, WebCore::ScriptExecutionContext* workerContext, WebFileSystemCallbacks* callbacks)
{
- return adoptRef(new WorkerFileSystemCallbacksBridge(worker, workerContext, callbacks));
+ return adoptRef(new WorkerFileSystemCallbacksBridge(workerLoaderProxy, workerContext, callbacks));
}
// Methods that create an instance and post an initial request task to the main thread. They must be called on the worker thread.
@@ -104,7 +107,7 @@
void didReadDirectoryOnMainThread(const WebVector<WebFileSystemEntry>&, bool hasMore, const String& mode);
private:
- WorkerFileSystemCallbacksBridge(WebWorkerBase*, WebCore::ScriptExecutionContext*, WebFileSystemCallbacks*);
+ WorkerFileSystemCallbacksBridge(WebCore::WorkerLoaderProxy*, WebCore::ScriptExecutionContext*, WebFileSystemCallbacks*);
// Methods that are to be called on the main thread.
static void openFileSystemOnMainThread(WebCore::ScriptExecutionContext*, WebCommonWorkerClient*, WebFileSystem::Type, long long size, bool create, WorkerFileSystemCallbacksBridge*, const String& mode);
@@ -135,7 +138,7 @@
void mayPostTaskToWorker(PassOwnPtr<WebCore::ScriptExecutionContext::Task>, const String& mode);
Mutex m_mutex;
- WebWorkerBase* m_worker;
+ WebCore::WorkerLoaderProxy* m_workerLoaderProxy;
WebCore::ScriptExecutionContext* m_workerContext;
// This is self-destructed and must be fired on the worker thread.