summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/webworker_proxy.cc
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-01 21:20:47 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-01 21:20:47 +0000
commitec775ef9b36dbcb5ebbd4fa550443bfa94c53a9f (patch)
tree5400ae2c5876e13aeeec2ab6ebcfc54f3f479840 /chrome/renderer/webworker_proxy.cc
parent4b5d64ff3d7d95247ed4f078d8bf585a1726794d (diff)
downloadchromium_src-ec775ef9b36dbcb5ebbd4fa550443bfa94c53a9f.zip
chromium_src-ec775ef9b36dbcb5ebbd4fa550443bfa94c53a9f.tar.gz
chromium_src-ec775ef9b36dbcb5ebbd4fa550443bfa94c53a9f.tar.bz2
Run workers in separate processes.
Review URL: http://codereview.chromium.org/99016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15098 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/webworker_proxy.cc')
-rw-r--r--chrome/renderer/webworker_proxy.cc17
1 files changed, 9 insertions, 8 deletions
diff --git a/chrome/renderer/webworker_proxy.cc b/chrome/renderer/webworker_proxy.cc
index 5e553a2..60fcebb 100644
--- a/chrome/renderer/webworker_proxy.cc
+++ b/chrome/renderer/webworker_proxy.cc
@@ -4,9 +4,9 @@
#include "chrome/renderer/webworker_proxy.h"
+#include "chrome/common/child_thread.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/worker_messages.h"
-#include "chrome/renderer/render_thread.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURL.h"
#include "third_party/WebKit/WebKit/chromium/public/WebWorkerClient.h"
@@ -16,8 +16,10 @@ using WebKit::WebWorkerClient;
WebWorkerProxy::WebWorkerProxy(
WebWorkerClient* client,
+ ChildThread* child_thread,
int render_view_route_id)
: route_id_(MSG_ROUTING_NONE),
+ child_thread_(child_thread),
render_view_route_id_(render_view_route_id),
client_(client) {
}
@@ -29,13 +31,12 @@ void WebWorkerProxy::startWorkerContext(
const WebURL& script_url,
const WebString& user_agent,
const WebString& source_code) {
- RenderThread::current()->Send(
- new ViewHostMsg_CreateDedicatedWorker(
- script_url, render_view_route_id_, &route_id_));
+ child_thread_->Send(new ViewHostMsg_CreateDedicatedWorker(
+ script_url, render_view_route_id_, &route_id_));
if (route_id_ == MSG_ROUTING_NONE)
return;
- RenderThread::current()->AddRoute(route_id_, this);
+ child_thread_->AddRoute(route_id_, this);
Send(new WorkerMsg_StartWorkerContext(
route_id_, script_url, user_agent, source_code));
@@ -49,7 +50,7 @@ void WebWorkerProxy::startWorkerContext(
void WebWorkerProxy::terminateWorkerContext() {
if (route_id_ != MSG_ROUTING_NONE) {
Send(new WorkerMsg_TerminateWorkerContext(route_id_));
- RenderThread::current()->RemoveRoute(route_id_);
+ child_thread_->RemoveRoute(route_id_);
route_id_ = MSG_ROUTING_NONE;
}
}
@@ -60,8 +61,8 @@ void WebWorkerProxy::postMessageToWorkerContext(
}
void WebWorkerProxy::workerObjectDestroyed() {
- client_ = NULL;
Send(new WorkerMsg_WorkerObjectDestroyed(route_id_));
+ delete this;
}
bool WebWorkerProxy::Send(IPC::Message* message) {
@@ -75,7 +76,7 @@ bool WebWorkerProxy::Send(IPC::Message* message) {
// TODO(jabdelmalek): handle sync messages if we need them.
IPC::Message* wrapped_msg = new ViewHostMsg_ForwardToWorker(*message);
delete message;
- return RenderThread::current()->Send(wrapped_msg);
+ return child_thread_->Send(wrapped_msg);
}
void WebWorkerProxy::OnMessageReceived(const IPC::Message& message) {