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 #if defined(OS_POSIX) && !defined(OS_ANDROID) | 7 #if defined(OS_POSIX) && !defined(OS_ANDROID) |
8 #include <signal.h> // For SigUSR1Handler below. | 8 #include <signal.h> // For SigUSR1Handler below. |
9 #endif | 9 #endif |
10 | 10 |
11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/metrics/statistics_recorder.h" | 13 #include "base/metrics/statistics_recorder.h" |
14 #include "base/process/process_handle.h" | 14 #include "base/process/process_handle.h" |
15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
18 #include "base/threading/thread_local.h" | 18 #include "base/threading/thread_local.h" |
19 #include "content/child/child_thread.h" | 19 #include "content/child/child_thread_impl.h" |
20 | 20 |
21 #if defined(OS_ANDROID) | 21 #if defined(OS_ANDROID) |
22 #include "base/debug/debugger.h" | 22 #include "base/debug/debugger.h" |
23 #endif | 23 #endif |
24 | 24 |
25 #if defined(OS_POSIX) && !defined(OS_ANDROID) | 25 #if defined(OS_POSIX) && !defined(OS_ANDROID) |
26 static void SigUSR1Handler(int signal) { } | 26 static void SigUSR1Handler(int signal) { } |
27 #endif | 27 #endif |
28 | 28 |
29 namespace content { | 29 namespace content { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // destruction code might depend on it. | 65 // destruction code might depend on it. |
66 if (main_thread_) { // null in unittests. | 66 if (main_thread_) { // null in unittests. |
67 main_thread_->Shutdown(); | 67 main_thread_->Shutdown(); |
68 main_thread_.reset(); | 68 main_thread_.reset(); |
69 } | 69 } |
70 | 70 |
71 g_lazy_tls.Pointer()->Set(NULL); | 71 g_lazy_tls.Pointer()->Set(NULL); |
72 io_thread_.Stop(); | 72 io_thread_.Stop(); |
73 } | 73 } |
74 | 74 |
75 ChildThread* ChildProcess::main_thread() { | 75 ChildThreadImpl* ChildProcess::main_thread() { |
76 return main_thread_.get(); | 76 return main_thread_.get(); |
77 } | 77 } |
78 | 78 |
79 void ChildProcess::set_main_thread(ChildThread* thread) { | 79 void ChildProcess::set_main_thread(ChildThreadImpl* thread) { |
80 main_thread_.reset(thread); | 80 main_thread_.reset(thread); |
81 } | 81 } |
82 | 82 |
83 void ChildProcess::AddRefProcess() { | 83 void ChildProcess::AddRefProcess() { |
84 DCHECK(!main_thread_.get() || // null in unittests. | 84 DCHECK(!main_thread_.get() || // null in unittests. |
85 base::MessageLoop::current() == main_thread_->message_loop()); | 85 base::MessageLoop::current() == main_thread_->message_loop()); |
86 ref_count_++; | 86 ref_count_++; |
87 } | 87 } |
88 | 88 |
89 void ChildProcess::ReleaseProcess() { | 89 void ChildProcess::ReleaseProcess() { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 memset(&sa, 0, sizeof(sa)); | 139 memset(&sa, 0, sizeof(sa)); |
140 sa.sa_handler = SigUSR1Handler; | 140 sa.sa_handler = SigUSR1Handler; |
141 sigaction(SIGUSR1, &sa, NULL); | 141 sigaction(SIGUSR1, &sa, NULL); |
142 | 142 |
143 pause(); | 143 pause(); |
144 #endif // defined(OS_ANDROID) | 144 #endif // defined(OS_ANDROID) |
145 #endif // defined(OS_POSIX) | 145 #endif // defined(OS_POSIX) |
146 } | 146 } |
147 | 147 |
148 } // namespace content | 148 } // namespace content |
OLD | NEW |