| 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 15 matching lines...) Expand all Loading... |
| 26 #include "content/common/child_process_host_impl.h" | 26 #include "content/common/child_process_host_impl.h" |
| 27 #include "content/common/child_process_messages.h" | 27 #include "content/common/child_process_messages.h" |
| 28 #include "content/public/browser/browser_child_process_host_delegate.h" | 28 #include "content/public/browser/browser_child_process_host_delegate.h" |
| 29 #include "content/public/browser/browser_child_process_observer.h" | 29 #include "content/public/browser/browser_child_process_observer.h" |
| 30 #include "content/public/browser/browser_thread.h" | 30 #include "content/public/browser/browser_thread.h" |
| 31 #include "content/public/browser/child_process_data.h" | 31 #include "content/public/browser/child_process_data.h" |
| 32 #include "content/public/browser/content_browser_client.h" | 32 #include "content/public/browser/content_browser_client.h" |
| 33 #include "content/public/common/content_switches.h" | 33 #include "content/public/common/content_switches.h" |
| 34 #include "content/public/common/process_type.h" | 34 #include "content/public/common/process_type.h" |
| 35 #include "content/public/common/result_codes.h" | 35 #include "content/public/common/result_codes.h" |
| 36 #include "ipc/attachment_broker.h" | |
| 37 #include "ipc/attachment_broker_privileged.h" | |
| 38 #include "mojo/edk/embedder/embedder.h" | 36 #include "mojo/edk/embedder/embedder.h" |
| 39 | 37 |
| 40 #if defined(OS_MACOSX) | 38 #if defined(OS_MACOSX) |
| 41 #include "content/browser/mach_broker_mac.h" | 39 #include "content/browser/mach_broker_mac.h" |
| 42 #endif | 40 #endif |
| 43 | 41 |
| 44 namespace content { | 42 namespace content { |
| 45 namespace { | 43 namespace { |
| 46 | 44 |
| 47 static base::LazyInstance<BrowserChildProcessHostImpl::BrowserChildProcessList> | 45 static base::LazyInstance<BrowserChildProcessHostImpl::BrowserChildProcessList> |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 120 |
| 123 BrowserChildProcessHostImpl::BrowserChildProcessHostImpl( | 121 BrowserChildProcessHostImpl::BrowserChildProcessHostImpl( |
| 124 content::ProcessType process_type, | 122 content::ProcessType process_type, |
| 125 BrowserChildProcessHostDelegate* delegate) | 123 BrowserChildProcessHostDelegate* delegate) |
| 126 : data_(process_type), | 124 : data_(process_type), |
| 127 delegate_(delegate), | 125 delegate_(delegate), |
| 128 power_monitor_message_broadcaster_(this), | 126 power_monitor_message_broadcaster_(this), |
| 129 is_channel_connected_(false) { | 127 is_channel_connected_(false) { |
| 130 data_.id = ChildProcessHostImpl::GenerateChildProcessUniqueId(); | 128 data_.id = ChildProcessHostImpl::GenerateChildProcessUniqueId(); |
| 131 | 129 |
| 132 #if USE_ATTACHMENT_BROKER | |
| 133 // Construct the privileged attachment broker early in the life cycle of a | |
| 134 // child process. This ensures that when a test is being run in one of the | |
| 135 // single process modes, the global attachment broker is the privileged | |
| 136 // attachment broker, rather than an unprivileged attachment broker. | |
| 137 #if defined(OS_MACOSX) && !defined(OS_IOS) | |
| 138 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded( | |
| 139 MachBroker::GetInstance()); | |
| 140 #else | |
| 141 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded(); | |
| 142 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | |
| 143 #endif // USE_ATTACHMENT_BROKER | |
| 144 #if defined(OS_MACOSX) && !defined(OS_IOS) | |
| 145 mojo::edk::SetMachPortProviderIfNeeded(MachBroker::GetInstance()); | |
| 146 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | |
| 147 | |
| 148 child_process_host_.reset(ChildProcessHost::Create(this)); | 130 child_process_host_.reset(ChildProcessHost::Create(this)); |
| 149 AddFilter(new TraceMessageFilter(data_.id)); | 131 AddFilter(new TraceMessageFilter(data_.id)); |
| 150 AddFilter(new ProfilerMessageFilter(process_type)); | 132 AddFilter(new ProfilerMessageFilter(process_type)); |
| 151 AddFilter(new HistogramMessageFilter); | 133 AddFilter(new HistogramMessageFilter); |
| 152 AddFilter(new MemoryMessageFilter(this, process_type)); | 134 AddFilter(new MemoryMessageFilter(this, process_type)); |
| 153 | 135 |
| 154 g_child_process_list.Get().push_back(this); | 136 g_child_process_list.Get().push_back(this); |
| 155 GetContentClient()->browser()->BrowserChildProcessHostCreated(this); | 137 GetContentClient()->browser()->BrowserChildProcessHostCreated(this); |
| 156 | 138 |
| 157 power_monitor_message_broadcaster_.Init(); | 139 power_monitor_message_broadcaster_.Init(); |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 | 425 |
| 444 #if defined(OS_WIN) | 426 #if defined(OS_WIN) |
| 445 | 427 |
| 446 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { | 428 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { |
| 447 OnChildDisconnected(); | 429 OnChildDisconnected(); |
| 448 } | 430 } |
| 449 | 431 |
| 450 #endif | 432 #endif |
| 451 | 433 |
| 452 } // namespace content | 434 } // namespace content |
| OLD | NEW |