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

Side by Side Diff: content/renderer/renderer_main.cc

Issue 9936002: Added code so renderer would cleanly exit. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added ifdef around alarm(30). Created 8 years, 8 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
« no previous file with comments | « content/public/common/content_switches.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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
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
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 }
OLDNEW
« no previous file with comments | « content/public/common/content_switches.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698