summaryrefslogtreecommitdiffstats
path: root/chrome/worker
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-25 07:58:17 +0000
committerrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-25 07:58:17 +0000
commit31af2abddfa0c05ee19de5b4646197fa552c7e49 (patch)
tree2c9efbd2c3b8d4846230a7cb9cb8f8be7c4da2dd /chrome/worker
parent49fa9d59bca4ba0118a3e65f7cad5886cc4d5c3e (diff)
downloadchromium_src-31af2abddfa0c05ee19de5b4646197fa552c7e49.zip
chromium_src-31af2abddfa0c05ee19de5b4646197fa552c7e49.tar.gz
chromium_src-31af2abddfa0c05ee19de5b4646197fa552c7e49.tar.bz2
Revert r39951 - Broke Valgrind - "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" Revert r39997 - Attempted Fix - "Fix a conditional jump depending on an uninitialized value by setting it to false in the ctor." TBR=dimich BUG=none TEST=Valgrind Review URL: http://codereview.chromium.org/661068 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39999 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/worker')
-rw-r--r--chrome/worker/websharedworker_stub.cc4
-rw-r--r--chrome/worker/websharedworker_stub.h1
-rw-r--r--chrome/worker/webworker_stub.cc4
-rw-r--r--chrome/worker/webworker_stub.h1
-rw-r--r--chrome/worker/webworker_stub_base.cc10
-rw-r--r--chrome/worker/worker_thread.cc19
-rw-r--r--chrome/worker/worker_thread.h11
-rw-r--r--chrome/worker/worker_uitest.cc4
8 files changed, 4 insertions, 50 deletions
diff --git a/chrome/worker/websharedworker_stub.cc b/chrome/worker/websharedworker_stub.cc
index 232f842..7c9646e 100644
--- a/chrome/worker/websharedworker_stub.cc
+++ b/chrome/worker/websharedworker_stub.cc
@@ -34,10 +34,6 @@ void WebSharedWorkerStub::OnMessageReceived(const IPC::Message& message) {
IPC_END_MESSAGE_MAP()
}
-void WebSharedWorkerStub::OnChannelError() {
- OnTerminateWorkerContext();
-}
-
void WebSharedWorkerStub::OnStartWorkerContext(
const GURL& url, const string16& user_agent, const string16& source_code) {
// Ignore multiple attempts to start this worker (can happen if two pages
diff --git a/chrome/worker/websharedworker_stub.h b/chrome/worker/websharedworker_stub.h
index 37ab640..b12cd99 100644
--- a/chrome/worker/websharedworker_stub.h
+++ b/chrome/worker/websharedworker_stub.h
@@ -21,7 +21,6 @@ class WebSharedWorkerStub : public WebWorkerStubBase {
// IPC::Channel::Listener implementation.
virtual void OnMessageReceived(const IPC::Message& message);
- virtual void OnChannelError();
private:
virtual ~WebSharedWorkerStub();
diff --git a/chrome/worker/webworker_stub.cc b/chrome/worker/webworker_stub.cc
index 142adcf..33a9b60 100644
--- a/chrome/worker/webworker_stub.cc
+++ b/chrome/worker/webworker_stub.cc
@@ -48,10 +48,6 @@ WebWorkerStub::~WebWorkerStub() {
impl_->clientDestroyed();
}
-void WebWorkerStub::OnChannelError() {
- OnTerminateWorkerContext();
-}
-
void WebWorkerStub::OnMessageReceived(const IPC::Message& message) {
if (!impl_)
return;
diff --git a/chrome/worker/webworker_stub.h b/chrome/worker/webworker_stub.h
index dab69d0..59a46f1 100644
--- a/chrome/worker/webworker_stub.h
+++ b/chrome/worker/webworker_stub.h
@@ -21,7 +21,6 @@ class WebWorkerStub : public WebWorkerStubBase {
// IPC::Channel::Listener implementation.
virtual void OnMessageReceived(const IPC::Message& message);
- virtual void OnChannelError();
private:
virtual ~WebWorkerStub();
diff --git a/chrome/worker/webworker_stub_base.cc b/chrome/worker/webworker_stub_base.cc
index b999f44..8ea2a15 100644
--- a/chrome/worker/webworker_stub_base.cc
+++ b/chrome/worker/webworker_stub_base.cc
@@ -12,19 +12,13 @@ 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->AddRoute(route_id_, this);
+ WorkerThread::current()->AddRoute(route_id_, this);
ChildProcess::current()->AddRefProcess();
}
WebWorkerStubBase::~WebWorkerStubBase() {
- WorkerThread* workerThread = WorkerThread::current();
- DCHECK(workerThread);
- workerThread->RemoveWorkerStub(this);
- workerThread->RemoveRoute(route_id_);
+ WorkerThread::current()->RemoveRoute(route_id_);
ChildProcess::current()->ReleaseProcess();
}
diff --git a/chrome/worker/worker_thread.cc b/chrome/worker/worker_thread.cc
index 0591902..ac8a1c7 100644
--- a/chrome/worker/worker_thread.cc
+++ b/chrome/worker/worker_thread.cc
@@ -62,22 +62,3 @@ void WorkerThread::OnCreateWorker(const GURL& url,
else
new WebWorkerStub(url, route_id);
}
-
-// The browser process is likely dead. Terminate all workers.
-void WorkerThread::OnChannelError() {
- set_on_channel_error_called(true);
-
- for (WorkerStubsList::iterator it = worker_stubs_.begin();
- it != worker_stubs_.end(); ++it) {
- (*it)->OnChannelError();
- }
-}
-
-void WorkerThread::RemoveWorkerStub(WebWorkerStubBase* stub) {
- worker_stubs_.erase(stub);
-}
-
-void WorkerThread::AddWorkerStub(WebWorkerStubBase* stub) {
- worker_stubs_.insert(stub);
-}
-
diff --git a/chrome/worker/worker_thread.h b/chrome/worker/worker_thread.h
index 0a0feae..040f0db 100644
--- a/chrome/worker/worker_thread.h
+++ b/chrome/worker/worker_thread.h
@@ -5,12 +5,9 @@
#ifndef CHROME_WORKER_WORKER_THREAD_H_
#define CHROME_WORKER_WORKER_THREAD_H_
-#include <set>
-
#include "chrome/common/child_thread.h"
class GURL;
-class WebWorkerStubBase;
class WorkerWebKitClientImpl;
class WorkerThread : public ChildThread {
@@ -21,22 +18,14 @@ class WorkerThread : public ChildThread {
// Returns the one worker thread.
static WorkerThread* current();
- // Invoked from stub constructors/destructors. Stubs own themselves.
- void AddWorkerStub(WebWorkerStubBase* stub);
- void RemoveWorkerStub(WebWorkerStubBase* stub);
-
private:
virtual void OnControlMessageReceived(const IPC::Message& msg);
- virtual void OnChannelError();
void OnCreateWorker(
const GURL& url, bool is_shared, const string16& name, int route_id);
scoped_ptr<WorkerWebKitClientImpl> webkit_client_;
- typedef std::set<WebWorkerStubBase*> WorkerStubsList;
- WorkerStubsList worker_stubs_;
-
DISALLOW_COPY_AND_ASSIGN(WorkerThread);
};
diff --git a/chrome/worker/worker_uitest.cc b/chrome/worker/worker_uitest.cc
index d63ba36..2a1f952 100644
--- a/chrome/worker/worker_uitest.cc
+++ b/chrome/worker/worker_uitest.cc
@@ -181,8 +181,8 @@ TEST_F(WorkerTest, SharedWorkerHttpAuth) {
}
-// http://crbug.com/35963
-#if defined(OS_LINUX)
+// All kinds of crashes on Linux and Mac http://crbug.com/22898
+#if defined(OS_LINUX) || defined(OS_MACOSX)
#define StressJSExecution DISABLED_StressJSExecution
#endif