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/renderer/render_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
189 // from the IPC channel) are routed to the main message loop but never | 189 // from the IPC channel) are routed to the main message loop but never |
190 // processed (because that message loop is stuck in V8). | 190 // processed (because that message loop is stuck in V8). |
191 // | 191 // |
192 // One could make the browser SIGKILL the renderers, but that leaves open a | 192 // One could make the browser SIGKILL the renderers, but that leaves open a |
193 // large window where a browser failure (or a user, manually terminating | 193 // large window where a browser failure (or a user, manually terminating |
194 // the browser because "it's stuck") will leave behind a process eating all | 194 // the browser because "it's stuck") will leave behind a process eating all |
195 // the CPU. | 195 // the CPU. |
196 // | 196 // |
197 // So, we install a filter on the channel so that we can process this event | 197 // So, we install a filter on the channel so that we can process this event |
198 // here and kill the process. | 198 // here and kill the process. |
199 | 199 // |
200 _exit(0); | 200 // We want to kill this process after giving it 30 seconds to run the exit |
201 // handlers. SIGALRM has a default disposition of terminating the | |
202 // application. | |
203 if (CommandLine::ForCurrentProcess()-> | |
204 HasSwitch(switches::kRendererCleanExit)) | |
Markus (顧孟勤)
2012/04/09 23:45:46
I am sure, I am just confused here. Shouldn't we b
asharif1
2012/04/10 03:08:00
As far as I understand, that variable is set in th
| |
205 alarm(30); | |
206 else | |
207 _exit(0); | |
201 } | 208 } |
202 }; | 209 }; |
203 #endif // OS_POSIX | 210 #endif // OS_POSIX |
204 | 211 |
205 | 212 |
206 void RenderThreadImpl::Init() { | 213 void RenderThreadImpl::Init() { |
207 TRACE_EVENT_BEGIN_ETW("RenderThreadImpl::Init", 0, ""); | 214 TRACE_EVENT_BEGIN_ETW("RenderThreadImpl::Init", 0, ""); |
208 | 215 |
209 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 216 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
210 // On Mac and Android, the select popups are rendered by the browser. | 217 // On Mac and Android, the select popups are rendered by the browser. |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1014 | 1021 |
1015 scoped_refptr<base::MessageLoopProxy> | 1022 scoped_refptr<base::MessageLoopProxy> |
1016 RenderThreadImpl::GetFileThreadMessageLoopProxy() { | 1023 RenderThreadImpl::GetFileThreadMessageLoopProxy() { |
1017 DCHECK(message_loop() == MessageLoop::current()); | 1024 DCHECK(message_loop() == MessageLoop::current()); |
1018 if (!file_thread_.get()) { | 1025 if (!file_thread_.get()) { |
1019 file_thread_.reset(new base::Thread("Renderer::FILE")); | 1026 file_thread_.reset(new base::Thread("Renderer::FILE")); |
1020 file_thread_->Start(); | 1027 file_thread_->Start(); |
1021 } | 1028 } |
1022 return file_thread_->message_loop_proxy(); | 1029 return file_thread_->message_loop_proxy(); |
1023 } | 1030 } |
OLD | NEW |