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/browser/browser_child_process_host_impl.h" | 5 #include "content/browser/browser_child_process_host_impl.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/dump_without_crashing.h" | 10 #include "base/debug/dump_without_crashing.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "content/common/child_process_host_impl.h" | 29 #include "content/common/child_process_host_impl.h" |
30 #include "content/common/child_process_messages.h" | 30 #include "content/common/child_process_messages.h" |
31 #include "content/public/browser/browser_child_process_host_delegate.h" | 31 #include "content/public/browser/browser_child_process_host_delegate.h" |
32 #include "content/public/browser/browser_child_process_observer.h" | 32 #include "content/public/browser/browser_child_process_observer.h" |
33 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
34 #include "content/public/browser/child_process_data.h" | 34 #include "content/public/browser/child_process_data.h" |
35 #include "content/public/browser/content_browser_client.h" | 35 #include "content/public/browser/content_browser_client.h" |
36 #include "content/public/common/content_switches.h" | 36 #include "content/public/common/content_switches.h" |
37 #include "content/public/common/process_type.h" | 37 #include "content/public/common/process_type.h" |
38 #include "content/public/common/result_codes.h" | 38 #include "content/public/common/result_codes.h" |
39 #include "ipc/attachment_broker.h" | |
40 #include "ipc/attachment_broker_privileged.h" | |
41 #include "mojo/edk/embedder/embedder.h" | 39 #include "mojo/edk/embedder/embedder.h" |
42 | 40 |
43 #if defined(OS_MACOSX) | 41 #if defined(OS_MACOSX) |
44 #include "content/browser/mach_broker_mac.h" | 42 #include "content/browser/mach_broker_mac.h" |
45 #endif | 43 #endif |
46 | 44 |
47 namespace content { | 45 namespace content { |
48 namespace { | 46 namespace { |
49 | 47 |
50 static base::LazyInstance<BrowserChildProcessHostImpl::BrowserChildProcessList> | 48 static base::LazyInstance<BrowserChildProcessHostImpl::BrowserChildProcessList> |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 const std::string& mojo_child_token) | 136 const std::string& mojo_child_token) |
139 : data_(process_type), | 137 : data_(process_type), |
140 delegate_(delegate), | 138 delegate_(delegate), |
141 mojo_child_token_(mojo_child_token), | 139 mojo_child_token_(mojo_child_token), |
142 power_monitor_message_broadcaster_(this), | 140 power_monitor_message_broadcaster_(this), |
143 is_channel_connected_(false), | 141 is_channel_connected_(false), |
144 notify_child_disconnected_(false), | 142 notify_child_disconnected_(false), |
145 weak_factory_(this) { | 143 weak_factory_(this) { |
146 data_.id = ChildProcessHostImpl::GenerateChildProcessUniqueId(); | 144 data_.id = ChildProcessHostImpl::GenerateChildProcessUniqueId(); |
147 | 145 |
148 #if USE_ATTACHMENT_BROKER | |
149 // Construct the privileged attachment broker early in the life cycle of a | |
150 // child process. This ensures that when a test is being run in one of the | |
151 // single process modes, the global attachment broker is the privileged | |
152 // attachment broker, rather than an unprivileged attachment broker. | |
153 #if defined(OS_MACOSX) | |
154 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded( | |
155 MachBroker::GetInstance()); | |
156 #else | |
157 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded(); | |
158 #endif // defined(OS_MACOSX) | |
159 #endif // USE_ATTACHMENT_BROKER | |
160 | |
161 child_process_host_.reset(ChildProcessHost::Create(this)); | 146 child_process_host_.reset(ChildProcessHost::Create(this)); |
162 AddFilter(new TraceMessageFilter(data_.id)); | 147 AddFilter(new TraceMessageFilter(data_.id)); |
163 AddFilter(new ProfilerMessageFilter(process_type)); | 148 AddFilter(new ProfilerMessageFilter(process_type)); |
164 AddFilter(new HistogramMessageFilter); | 149 AddFilter(new HistogramMessageFilter); |
165 AddFilter(new MemoryMessageFilter(this, process_type)); | 150 AddFilter(new MemoryMessageFilter(this, process_type)); |
166 | 151 |
167 g_child_process_list.Get().push_back(this); | 152 g_child_process_list.Get().push_back(this); |
168 GetContentClient()->browser()->BrowserChildProcessHostCreated(this); | 153 GetContentClient()->browser()->BrowserChildProcessHostCreated(this); |
169 | 154 |
170 power_monitor_message_broadcaster_.Init(); | 155 power_monitor_message_broadcaster_.Init(); |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 | 493 |
509 #if defined(OS_WIN) | 494 #if defined(OS_WIN) |
510 | 495 |
511 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { | 496 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { |
512 OnChildDisconnected(); | 497 OnChildDisconnected(); |
513 } | 498 } |
514 | 499 |
515 #endif | 500 #endif |
516 | 501 |
517 } // namespace content | 502 } // namespace content |
OLD | NEW |