| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/common/child_process.h" | 5 #include "content/common/child_process.h" |
| 6 | 6 |
| 7 #if defined(OS_POSIX) | 7 #if defined(OS_POSIX) |
| 8 #include <signal.h> // For SigUSR1Handler below. | 8 #include <signal.h> // For SigUSR1Handler below. |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 return main_thread_.get(); | 51 return main_thread_.get(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void ChildProcess::set_main_thread(ChildThread* thread) { | 54 void ChildProcess::set_main_thread(ChildThread* thread) { |
| 55 main_thread_.reset(thread); | 55 main_thread_.reset(thread); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void ChildProcess::AddRefProcess() { | 58 void ChildProcess::AddRefProcess() { |
| 59 DCHECK(!main_thread_.get() || // null in unittests. | 59 DCHECK(!main_thread_.get() || // null in unittests. |
| 60 MessageLoop::current() == main_thread_->message_loop()); | 60 MessageLoop::current() == main_thread_->message_loop()); |
| 61 if (!ref_count_ && main_thread_.get()) |
| 62 main_thread_->AbortProcessShutdown(); |
| 61 ref_count_++; | 63 ref_count_++; |
| 62 } | 64 } |
| 63 | 65 |
| 64 void ChildProcess::ReleaseProcess() { | 66 void ChildProcess::ReleaseProcess() { |
| 65 DCHECK(!main_thread_.get() || // null in unittests. | 67 DCHECK(!main_thread_.get() || // null in unittests. |
| 66 MessageLoop::current() == main_thread_->message_loop()); | 68 MessageLoop::current() == main_thread_->message_loop()); |
| 67 DCHECK(ref_count_); | 69 DCHECK(ref_count_); |
| 68 DCHECK(child_process_); | 70 DCHECK(child_process_); |
| 69 if (--ref_count_) | 71 if (--ref_count_) |
| 70 return; | 72 return; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 << ") paused waiting for debugger to attach @ pid"; | 104 << ") paused waiting for debugger to attach @ pid"; |
| 103 // Install a signal handler so that pause can be woken. | 105 // Install a signal handler so that pause can be woken. |
| 104 struct sigaction sa; | 106 struct sigaction sa; |
| 105 memset(&sa, 0, sizeof(sa)); | 107 memset(&sa, 0, sizeof(sa)); |
| 106 sa.sa_handler = SigUSR1Handler; | 108 sa.sa_handler = SigUSR1Handler; |
| 107 sigaction(SIGUSR1, &sa, NULL); | 109 sigaction(SIGUSR1, &sa, NULL); |
| 108 | 110 |
| 109 pause(); | 111 pause(); |
| 110 #endif // defined(OS_POSIX) | 112 #endif // defined(OS_POSIX) |
| 111 } | 113 } |
| OLD | NEW |