OLD | NEW |
---|---|
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/websharedworkerclient_proxy.h" | 5 #include "content/worker/websharedworkerclient_proxy.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "content/common/fileapi/file_system_dispatcher.h" | 10 #include "content/common/fileapi/file_system_dispatcher.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
185 const WebKit::WebString& state) { | 185 const WebKit::WebString& state) { |
186 if (devtools_agent_) | 186 if (devtools_agent_) |
187 devtools_agent_->SaveDevToolsAgentState(state); | 187 devtools_agent_->SaveDevToolsAgentState(state); |
188 } | 188 } |
189 | 189 |
190 bool WebSharedWorkerClientProxy::Send(IPC::Message* message) { | 190 bool WebSharedWorkerClientProxy::Send(IPC::Message* message) { |
191 return WorkerThread::current()->Send(message); | 191 return WorkerThread::current()->Send(message); |
192 } | 192 } |
193 | 193 |
194 void WebSharedWorkerClientProxy::EnsureWorkerContextTerminates() { | 194 void WebSharedWorkerClientProxy::EnsureWorkerContextTerminates() { |
195 // Avoid a worker doing a while(1) from never exiting. | |
196 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
197 switches::kWebWorkerShareProcesses)) { | |
198 // Can't kill the process since there could be workers from other | |
199 // renderer process. | |
200 NOTIMPLEMENTED(); | |
201 return; | |
202 } | |
203 | |
204 // This shuts down the process cleanly from the perspective of the browser | 195 // This shuts down the process cleanly from the perspective of the browser |
205 // process, and avoids the crashed worker infobar from appearing to the new | 196 // process, and avoids the crashed worker infobar from appearing to the new |
206 // page. It's ok to post several of theese, because the first executed task | 197 // page. It's ok to post several of theese, because the first executed task |
207 // will exit the message loop and subsequent ones won't be executed. | 198 // will exit the message loop and subsequent ones won't be executed. |
michaeln
2012/09/12 00:20:29
Should we comment on having to revisit this when s
awong
2012/09/12 00:23:08
I'm not sure it would get read. My guess is that
| |
208 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 199 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
209 base::Bind( | 200 base::Bind( |
210 &WebSharedWorkerClientProxy::workerContextDestroyed, | 201 &WebSharedWorkerClientProxy::workerContextDestroyed, |
211 weak_factory_.GetWeakPtr()), | 202 weak_factory_.GetWeakPtr()), |
212 base::TimeDelta::FromSeconds(kMaxTimeForRunawayWorkerSeconds)); | 203 base::TimeDelta::FromSeconds(kMaxTimeForRunawayWorkerSeconds)); |
213 } | 204 } |
OLD | NEW |