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

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

Issue 19231006: chrome: respect --child-clean-exit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Made comments better. 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 | Annotate | Revision Log
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 //
74 // We want to kill this process after giving it 30 seconds to run the exit 74 // We want to kill this process after giving it 30 seconds to run the exit
75 // handlers. SIGALRM has a default disposition of terminating the 75 // handlers. SIGALRM has a default disposition of terminating the
76 // application. 76 // application.
77 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kChildCleanExit)) 77 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kChildCleanExit))
78 alarm(30); 78 // FIXME(asharif): This is wrong code. We cannot call exit() in a
79 // multi-threaded environment. However, simply having a return statement
80 // here causes a deadlock or abort because of the same thread tries to
81 // acquire the same lock twice. See: crbug.com/263594
82 exit(0);
79 else 83 else
80 _exit(0); 84 _exit(0);
81 } 85 }
82 86
83 protected: 87 protected:
84 virtual ~SuicideOnChannelErrorFilter() {} 88 virtual ~SuicideOnChannelErrorFilter() {}
85 }; 89 };
86 90
87 #endif // OS(POSIX) 91 #endif // OS(POSIX)
88 92
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 // inflight that would addref it. 392 // inflight that would addref it.
389 Send(new ChildProcessHostMsg_ShutdownRequest); 393 Send(new ChildProcessHostMsg_ShutdownRequest);
390 } 394 }
391 395
392 void ChildThread::EnsureConnected() { 396 void ChildThread::EnsureConnected() {
393 LOG(INFO) << "ChildThread::EnsureConnected()"; 397 LOG(INFO) << "ChildThread::EnsureConnected()";
394 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); 398 base::KillProcess(base::GetCurrentProcessHandle(), 0, false);
395 } 399 }
396 400
397 } // namespace content 401 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/zygote_host/zygote_host_impl_linux.cc ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698