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 "base/base_switches.h" | 5 #include "base/base_switches.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/debug/debugger.h" | 7 #include "base/debug/debugger.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // from the IPC channel) are routed to the main message loop but never | 82 // from the IPC channel) are routed to the main message loop but never |
83 // processed (because that message loop is stuck in V8). | 83 // processed (because that message loop is stuck in V8). |
84 // | 84 // |
85 // One could make the browser SIGKILL the renderers, but that leaves open a | 85 // One could make the browser SIGKILL the renderers, but that leaves open a |
86 // large window where a browser failure (or a user, manually terminating | 86 // large window where a browser failure (or a user, manually terminating |
87 // the browser because "it's stuck") will leave behind a process eating all | 87 // the browser because "it's stuck") will leave behind a process eating all |
88 // the CPU. | 88 // the CPU. |
89 // | 89 // |
90 // So, we install a filter on the channel so that we can process this event | 90 // So, we install a filter on the channel so that we can process this event |
91 // here and kill the process. | 91 // here and kill the process. |
92 | 92 // |
93 _exit(0); | 93 // We want to kill this process after giving it 30 seconds to run the exit |
| 94 // handlers. SIGALRM has a default disposition of terminating the |
| 95 // application. |
| 96 #if defined(OS_POSIX) |
| 97 if (CommandLine::ForCurrentProcess()-> |
| 98 HasSwitch(switches::kRendererCleanExit)) |
| 99 alarm(30); |
| 100 else |
| 101 #endif |
| 102 _exit(0); |
94 } | 103 } |
95 }; | 104 }; |
96 | 105 |
97 #endif // OS(POSIX) | 106 #endif // OS(POSIX) |
98 | 107 |
99 } // namespace | 108 } // namespace |
100 | 109 |
101 // This function provides some ways to test crash and assertion handling | 110 // This function provides some ways to test crash and assertion handling |
102 // behavior of the renderer. | 111 // behavior of the renderer. |
103 static void HandleRendererErrorTestParameters(const CommandLine& command_line) { | 112 static void HandleRendererErrorTestParameters(const CommandLine& command_line) { |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 #endif | 279 #endif |
271 TRACE_EVENT_BEGIN_ETW("RendererMain.START_MSG_LOOP", 0, 0); | 280 TRACE_EVENT_BEGIN_ETW("RendererMain.START_MSG_LOOP", 0, 0); |
272 MessageLoop::current()->Run(); | 281 MessageLoop::current()->Run(); |
273 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); | 282 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); |
274 } | 283 } |
275 } | 284 } |
276 platform.PlatformUninitialize(); | 285 platform.PlatformUninitialize(); |
277 TRACE_EVENT_END_ETW("RendererMain", 0, ""); | 286 TRACE_EVENT_END_ETW("RendererMain", 0, ""); |
278 return 0; | 287 return 0; |
279 } | 288 } |
OLD | NEW |