Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(910)

Side by Side Diff: content/worker/websharedworker_stub.cc

Issue 23496052: Kill worker process by way of a sync IPC message before it cleans up. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix comment Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/worker/websharedworker_stub.h" 5 #include "content/worker/websharedworker_stub.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "content/child/child_process.h" 8 #include "content/child/child_process.h"
9 #include "content/child/child_thread.h" 9 #include "content/child/child_thread.h"
10 #include "content/child/fileapi/file_system_dispatcher.h" 10 #include "content/child/fileapi/file_system_dispatcher.h"
(...skipping 27 matching lines...) Expand all
38 // TODO(atwilson): Add support for NaCl when they support MessagePorts. 38 // TODO(atwilson): Add support for NaCl when they support MessagePorts.
39 impl_ = WebKit::WebSharedWorker::create(client()); 39 impl_ = WebKit::WebSharedWorker::create(client());
40 worker_devtools_agent_.reset(new SharedWorkerDevToolsAgent(route_id, impl_)); 40 worker_devtools_agent_.reset(new SharedWorkerDevToolsAgent(route_id, impl_));
41 client()->set_devtools_agent(worker_devtools_agent_.get()); 41 client()->set_devtools_agent(worker_devtools_agent_.get());
42 } 42 }
43 43
44 WebSharedWorkerStub::~WebSharedWorkerStub() { 44 WebSharedWorkerStub::~WebSharedWorkerStub() {
45 impl_->clientDestroyed(); 45 impl_->clientDestroyed();
46 WorkerThread* worker_thread = WorkerThread::current(); 46 WorkerThread* worker_thread = WorkerThread::current();
47 DCHECK(worker_thread); 47 DCHECK(worker_thread);
48
49 // Send an IPC message to kill the worker process.
50 bool result = false;
51 worker_thread->Send(new WorkerProcessHostMsg_ForceKillWorker(
michaeln 2013/09/12 00:22:11 I think WorkerThread::Shutdown() would be a better
Mustafa Acer 2013/09/12 00:29:14 I started with that, but the route_id being remove
52 route_id_,
53 base::GetCurrentProcessHandle(),
54 &result));
55
48 worker_thread->RemoveWorkerStub(this); 56 worker_thread->RemoveWorkerStub(this);
49 worker_thread->RemoveRoute(route_id_); 57 worker_thread->RemoveRoute(route_id_);
50 ChildProcess::current()->ReleaseProcess(); 58 ChildProcess::current()->ReleaseProcess();
51 } 59 }
52 60
53 void WebSharedWorkerStub::Shutdown() { 61 void WebSharedWorkerStub::Shutdown() {
54 // The worker has exited - free ourselves and the client. 62 // The worker has exited - free ourselves and the client.
55 delete this; 63 delete this;
56 } 64 }
57 65
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 132
125 void WebSharedWorkerStub::OnTerminateWorkerContext() { 133 void WebSharedWorkerStub::OnTerminateWorkerContext() {
126 impl_->terminateWorkerContext(); 134 impl_->terminateWorkerContext();
127 135
128 // Call the client to make sure context exits. 136 // Call the client to make sure context exits.
129 EnsureWorkerContextTerminates(); 137 EnsureWorkerContextTerminates();
130 started_ = false; 138 started_ = false;
131 } 139 }
132 140
133 } // namespace content 141 } // namespace content
OLDNEW
« content/browser/worker_host/worker_process_host.h ('K') | « content/common/worker_messages.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698