diff options
author | dimich@google.com <dimich@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-24 23:50:53 +0000 |
---|---|---|
committer | dimich@google.com <dimich@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-24 23:50:53 +0000 |
commit | f11030094e99bcb61555dc3bb4c157703dc1d7ea (patch) | |
tree | 5f2001f74906cc33a10bb3d6fc3154a26774b47e /chrome/worker/worker_thread.h | |
parent | 0070eab07191eaed49b945da7db9ba8e687612a5 (diff) | |
download | chromium_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/worker_thread.h')
-rw-r--r-- | chrome/worker/worker_thread.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/chrome/worker/worker_thread.h b/chrome/worker/worker_thread.h index 040f0db..0a0feae 100644 --- a/chrome/worker/worker_thread.h +++ b/chrome/worker/worker_thread.h @@ -5,9 +5,12 @@ #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 { @@ -18,14 +21,22 @@ 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); }; |