summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
Diffstat (limited to 'webkit')
-rw-r--r--webkit/api/public/WebKitClient.h7
-rw-r--r--webkit/api/public/WebWorkerClient.h6
-rw-r--r--webkit/glue/webkitclient_impl.h3
-rw-r--r--webkit/glue/webworker_impl.h2
-rw-r--r--webkit/glue/webworkerclient_impl.cc15
-rw-r--r--webkit/glue/webworkerclient_impl.h3
-rw-r--r--webkit/tools/test_shell/test_worker/test_webworker.h3
7 files changed, 28 insertions, 11 deletions
diff --git a/webkit/api/public/WebKitClient.h b/webkit/api/public/WebKitClient.h
index 112e5ff..5b136d5 100644
--- a/webkit/api/public/WebKitClient.h
+++ b/webkit/api/public/WebKitClient.h
@@ -44,8 +44,6 @@ namespace WebKit {
class WebURL;
struct WebPluginInfo;
template <typename T> class WebVector;
- class WebWorker;
- class WebWorkerClient;
class WebKitClient {
public:
@@ -129,11 +127,6 @@ namespace WebKit {
// Callable from a background WebKit thread.
virtual void callOnMainThread(void (*func)()) = 0;
-
-
- // WebWorkers ----------------------------------------------------------
-
- virtual WebWorker* createWorker(WebWorkerClient*) = 0;
};
} // namespace WebKit
diff --git a/webkit/api/public/WebWorkerClient.h b/webkit/api/public/WebWorkerClient.h
index dd46de2..6c6f0db 100644
--- a/webkit/api/public/WebWorkerClient.h
+++ b/webkit/api/public/WebWorkerClient.h
@@ -35,8 +35,11 @@
namespace WebKit {
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:
virtual void postMessageToWorkerObject(const WebString&) = 0;
@@ -57,6 +60,9 @@ namespace WebKit {
virtual void reportPendingActivity(bool hasPendingActivity) = 0;
virtual void workerContextDestroyed() = 0;
+
+ // This can be called on any thread to create a nested worker.
+ virtual WebKit::WebWorker* createWorker(WebKit::WebWorkerClient* client) = 0;
};
} // namespace WebKit
diff --git a/webkit/glue/webkitclient_impl.h b/webkit/glue/webkitclient_impl.h
index d820ee8..679cb61 100644
--- a/webkit/glue/webkitclient_impl.h
+++ b/webkit/glue/webkitclient_impl.h
@@ -33,9 +33,6 @@ class WebKitClientImpl : public WebKit::WebKitClient {
virtual void stopSharedTimer();
virtual void callOnMainThread(void (*func)());
virtual void suddenTerminationChanged(bool enabled) { }
- virtual WebKit::WebWorker* createWorker(WebKit::WebWorkerClient* client) {
- return NULL;
- }
private:
void DoTimeout() {
diff --git a/webkit/glue/webworker_impl.h b/webkit/glue/webworker_impl.h
index f1c6910..4477a2c 100644
--- a/webkit/glue/webworker_impl.h
+++ b/webkit/glue/webworker_impl.h
@@ -55,6 +55,8 @@ class WebWorkerImpl: public WebCore::WorkerObjectProxy,
virtual void postMessageToWorkerContext(const WebKit::WebString& message);
virtual void workerObjectDestroyed();
+ WebKit::WebWorkerClient* client() { return client_; }
+
// Executes the given task on the main thread.
static void DispatchTaskToMainThread(
PassRefPtr<WebCore::ScriptExecutionContext::Task> task);
diff --git a/webkit/glue/webworkerclient_impl.cc b/webkit/glue/webworkerclient_impl.cc
index 216b78c..5e5cf23 100644
--- a/webkit/glue/webworkerclient_impl.cc
+++ b/webkit/glue/webworkerclient_impl.cc
@@ -12,8 +12,11 @@
#include "FrameLoaderClient.h"
#include "GenericWorkerTask.h"
#include "ScriptExecutionContext.h"
+#include "WorkerContextExecutionProxy.h"
#include "WorkerMessagingProxy.h"
#include "Worker.h"
+#include "WorkerContext.h"
+#include "WorkerThread.h"
#include <wtf/Threading.h>
#undef LOG
@@ -71,7 +74,17 @@ WebCore::WorkerContextProxy* WebCore::WorkerContextProxy::create(
frame_loader_client->webframe()->GetWebViewImpl()->delegate();
webworker = webview_delegate->CreateWebWorker(proxy);
} else {
- webworker = WebKit::webKitClient()->createWorker(proxy);
+ WebCore::WorkerContextExecutionProxy* current_context =
+ WebCore::WorkerContextExecutionProxy::retrieve();
+ if (!current_context) {
+ NOTREACHED();
+ return NULL;
+ }
+
+ WebCore::WorkerObjectProxy* worker_object_proxy =
+ current_context->workerContext()->thread()->workerObjectProxy();
+ WebWorkerImpl* impl = reinterpret_cast<WebWorkerImpl*>(worker_object_proxy);
+ webworker = impl->client()->createWorker(proxy);
}
proxy->set_webworker(webworker);
diff --git a/webkit/glue/webworkerclient_impl.h b/webkit/glue/webworkerclient_impl.h
index 685eac9..f76ed5e 100644
--- a/webkit/glue/webworkerclient_impl.h
+++ b/webkit/glue/webworkerclient_impl.h
@@ -59,6 +59,9 @@ class WebWorkerClientImpl : public WebCore::WorkerContextProxy,
virtual void confirmMessageFromWorkerObject(bool has_pending_activity);
virtual void reportPendingActivity(bool has_pending_activity);
virtual void workerContextDestroyed();
+ virtual WebKit::WebWorker* createWorker(WebKit::WebWorkerClient* client) {
+ return NULL;
+ }
private:
virtual ~WebWorkerClientImpl();
diff --git a/webkit/tools/test_shell/test_worker/test_webworker.h b/webkit/tools/test_shell/test_worker/test_webworker.h
index 1071775..171b09c 100644
--- a/webkit/tools/test_shell/test_worker/test_webworker.h
+++ b/webkit/tools/test_shell/test_worker/test_webworker.h
@@ -48,6 +48,9 @@ class TestWebWorker : public WebKit::WebWorker,
virtual void confirmMessageFromWorkerObject(bool has_pending_activity);
virtual void reportPendingActivity(bool has_pending_activity);
virtual void workerContextDestroyed();
+ virtual WebKit::WebWorker* createWorker(WebKit::WebWorkerClient* client) {
+ return NULL;
+ }
private:
friend class base::RefCounted<TestWebWorker>;