summaryrefslogtreecommitdiffstats
path: root/chrome/worker/webworker_stub_base.cc
diff options
context:
space:
mode:
authordimich@google.com <dimich@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-24 23:50:53 +0000
committerdimich@google.com <dimich@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-24 23:50:53 +0000
commitf11030094e99bcb61555dc3bb4c157703dc1d7ea (patch)
tree5f2001f74906cc33a10bb3d6fc3154a26774b47e /chrome/worker/webworker_stub_base.cc
parent0070eab07191eaed49b945da7db9ba8e687612a5 (diff)
downloadchromium_src-f11030094e99bcb61555dc3bb4c157703dc1d7ea.zip
chromium_src-f11030094e99bcb61555dc3bb4c157703dc1d7ea.tar.gz
chromium_src-f11030094e99bcb61555dc3bb4c157703dc1d7ea.tar.bz2
Make sure the workers are given a chance to terminate their thread when the IPC channel fails.
Usually, the ChildThread::OnChannelError() simply kills the message loop. we want to give workers an opportunity to get out of their threads to avoid crashes when main thread destroys globals. BUG=35963 TEST=WorkerTest.StressJSExecution Review URL: http://codereview.chromium.org/647064 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39951 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/worker/webworker_stub_base.cc')
-rw-r--r--chrome/worker/webworker_stub_base.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/chrome/worker/webworker_stub_base.cc b/chrome/worker/webworker_stub_base.cc
index 8ea2a15..b999f44 100644
--- a/chrome/worker/webworker_stub_base.cc
+++ b/chrome/worker/webworker_stub_base.cc
@@ -12,13 +12,19 @@ WebWorkerStubBase::WebWorkerStubBase(int route_id)
: route_id_(route_id),
ALLOW_THIS_IN_INITIALIZER_LIST(client_(route_id, this)) {
+ WorkerThread* workerThread = WorkerThread::current();
+ DCHECK(workerThread);
+ workerThread->AddWorkerStub(this);
// Start processing incoming IPCs for this worker.
- WorkerThread::current()->AddRoute(route_id_, this);
+ workerThread->AddRoute(route_id_, this);
ChildProcess::current()->AddRefProcess();
}
WebWorkerStubBase::~WebWorkerStubBase() {
- WorkerThread::current()->RemoveRoute(route_id_);
+ WorkerThread* workerThread = WorkerThread::current();
+ DCHECK(workerThread);
+ workerThread->RemoveWorkerStub(this);
+ workerThread->RemoveRoute(route_id_);
ChildProcess::current()->ReleaseProcess();
}