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

Side by Side Diff: content/child/child_thread.cc

Issue 20842002: child processes: wait 60 seconds before sending SIGALRM. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Switched period and paren. Created 7 years, 4 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 | « no previous file | 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 "content/child/child_thread.h" 5 #include "content/child/child_thread.h"
6 6
7 #include "base/allocator/allocator_extension.h" 7 #include "base/allocator/allocator_extension.h"
8 #include "base/base_switches.h" 8 #include "base/base_switches.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // from the IPC channel) are routed to the main message loop but never 63 // from the IPC channel) are routed to the main message loop but never
64 // processed (because that message loop is stuck in V8). 64 // processed (because that message loop is stuck in V8).
65 // 65 //
66 // One could make the browser SIGKILL the renderers, but that leaves open a 66 // One could make the browser SIGKILL the renderers, but that leaves open a
67 // large window where a browser failure (or a user, manually terminating 67 // large window where a browser failure (or a user, manually terminating
68 // the browser because "it's stuck") will leave behind a process eating all 68 // the browser because "it's stuck") will leave behind a process eating all
69 // the CPU. 69 // the CPU.
70 // 70 //
71 // So, we install a filter on the channel so that we can process this event 71 // So, we install a filter on the channel so that we can process this event
72 // here and kill the process. 72 // here and kill the process.
73 // 73 if (CommandLine::ForCurrentProcess()->
74 // We want to kill this process after giving it 30 seconds to run the exit 74 HasSwitch(switches::kChildCleanExit)) {
75 // handlers. SIGALRM has a default disposition of terminating the 75 // If clean exit is requested, we want to kill this process after giving
76 // application. 76 // it 60 seconds to run exit handlers. Exit handlers may including ones
77 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kChildCleanExit)) 77 // that write profile data to disk (which happens under profile collection
78 alarm(30); 78 // mode).
79 else 79 alarm(60);
80 } else {
80 _exit(0); 81 _exit(0);
82 }
81 } 83 }
82 84
83 protected: 85 protected:
84 virtual ~SuicideOnChannelErrorFilter() {} 86 virtual ~SuicideOnChannelErrorFilter() {}
85 }; 87 };
86 88
87 #endif // OS(POSIX) 89 #endif // OS(POSIX)
88 90
89 #if defined(OS_ANDROID) 91 #if defined(OS_ANDROID)
90 ChildThread* g_child_thread; 92 ChildThread* g_child_thread;
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 // inflight that would addref it. 396 // inflight that would addref it.
395 Send(new ChildProcessHostMsg_ShutdownRequest); 397 Send(new ChildProcessHostMsg_ShutdownRequest);
396 } 398 }
397 399
398 void ChildThread::EnsureConnected() { 400 void ChildThread::EnsureConnected() {
399 LOG(INFO) << "ChildThread::EnsureConnected()"; 401 LOG(INFO) << "ChildThread::EnsureConnected()";
400 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); 402 base::KillProcess(base::GetCurrentProcessHandle(), 0, false);
401 } 403 }
402 404
403 } // namespace content 405 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698