| 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 "content/child/child_process.h" | 5 #include "content/child/child_process.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 ChildThreadImpl* ChildProcess::main_thread() { | 81 ChildThreadImpl* ChildProcess::main_thread() { |
| 82 return main_thread_.get(); | 82 return main_thread_.get(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void ChildProcess::set_main_thread(ChildThreadImpl* thread) { | 85 void ChildProcess::set_main_thread(ChildThreadImpl* thread) { |
| 86 main_thread_.reset(thread); | 86 main_thread_.reset(thread); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void ChildProcess::AddRefProcess() { | 89 void ChildProcess::AddRefProcess() { |
| 90 DCHECK(!main_thread_.get() || // null in unittests. | 90 DCHECK(!main_thread_.get() || // null in unittests. |
| 91 main_thread_->message_loop()->task_runner()->BelongsToCurrentThread()); | 91 main_thread_->main_task_runner()->BelongsToCurrentThread()); |
| 92 ref_count_++; | 92 ref_count_++; |
| 93 } | 93 } |
| 94 | 94 |
| 95 void ChildProcess::ReleaseProcess() { | 95 void ChildProcess::ReleaseProcess() { |
| 96 DCHECK(!main_thread_.get() || // null in unittests. | 96 DCHECK(!main_thread_.get() || // null in unittests. |
| 97 main_thread_->message_loop()->task_runner()->BelongsToCurrentThread()); | 97 main_thread_->main_task_runner()->BelongsToCurrentThread()); |
| 98 DCHECK(ref_count_); | 98 DCHECK(ref_count_); |
| 99 if (--ref_count_) | 99 if (--ref_count_) |
| 100 return; | 100 return; |
| 101 | 101 |
| 102 if (main_thread_) // null in unittests. | 102 if (main_thread_) // null in unittests. |
| 103 main_thread_->OnProcessFinalRelease(); | 103 main_thread_->OnProcessFinalRelease(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 ChildProcess* ChildProcess::current() { | 106 ChildProcess* ChildProcess::current() { |
| 107 return g_lazy_tls.Pointer()->Get(); | 107 return g_lazy_tls.Pointer()->Get(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 memset(&sa, 0, sizeof(sa)); | 145 memset(&sa, 0, sizeof(sa)); |
| 146 sa.sa_handler = SigUSR1Handler; | 146 sa.sa_handler = SigUSR1Handler; |
| 147 sigaction(SIGUSR1, &sa, NULL); | 147 sigaction(SIGUSR1, &sa, NULL); |
| 148 | 148 |
| 149 pause(); | 149 pause(); |
| 150 #endif // defined(OS_ANDROID) | 150 #endif // defined(OS_ANDROID) |
| 151 #endif // defined(OS_POSIX) | 151 #endif // defined(OS_POSIX) |
| 152 } | 152 } |
| 153 | 153 |
| 154 } // namespace content | 154 } // namespace content |
| OLD | NEW |