| 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 25 matching lines...) Expand all Loading... |
| 36 #include "content/public/browser/browser_child_process_host_delegate.h" | 36 #include "content/public/browser/browser_child_process_host_delegate.h" |
| 37 #include "content/public/browser/browser_child_process_observer.h" | 37 #include "content/public/browser/browser_child_process_observer.h" |
| 38 #include "content/public/browser/browser_thread.h" | 38 #include "content/public/browser/browser_thread.h" |
| 39 #include "content/public/browser/child_process_data.h" | 39 #include "content/public/browser/child_process_data.h" |
| 40 #include "content/public/browser/content_browser_client.h" | 40 #include "content/public/browser/content_browser_client.h" |
| 41 #include "content/public/common/content_features.h" | 41 #include "content/public/common/content_features.h" |
| 42 #include "content/public/common/content_switches.h" | 42 #include "content/public/common/content_switches.h" |
| 43 #include "content/public/common/mojo_channel_switches.h" | 43 #include "content/public/common/mojo_channel_switches.h" |
| 44 #include "content/public/common/process_type.h" | 44 #include "content/public/common/process_type.h" |
| 45 #include "content/public/common/result_codes.h" | 45 #include "content/public/common/result_codes.h" |
| 46 #include "ipc/attachment_broker.h" | |
| 47 #include "ipc/attachment_broker_privileged.h" | |
| 48 #include "mojo/edk/embedder/embedder.h" | 46 #include "mojo/edk/embedder/embedder.h" |
| 49 | 47 |
| 50 #if defined(OS_MACOSX) | 48 #if defined(OS_MACOSX) |
| 51 #include "content/browser/mach_broker_mac.h" | 49 #include "content/browser/mach_broker_mac.h" |
| 52 #endif | 50 #endif |
| 53 | 51 |
| 54 namespace content { | 52 namespace content { |
| 55 namespace { | 53 namespace { |
| 56 | 54 |
| 57 static base::LazyInstance<BrowserChildProcessHostImpl::BrowserChildProcessList> | 55 static base::LazyInstance<BrowserChildProcessHostImpl::BrowserChildProcessList> |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 const std::string& service_name) | 141 const std::string& service_name) |
| 144 : data_(process_type), | 142 : data_(process_type), |
| 145 delegate_(delegate), | 143 delegate_(delegate), |
| 146 child_token_(mojo::edk::GenerateRandomToken()), | 144 child_token_(mojo::edk::GenerateRandomToken()), |
| 147 power_monitor_message_broadcaster_(this), | 145 power_monitor_message_broadcaster_(this), |
| 148 is_channel_connected_(false), | 146 is_channel_connected_(false), |
| 149 notify_child_disconnected_(false), | 147 notify_child_disconnected_(false), |
| 150 weak_factory_(this) { | 148 weak_factory_(this) { |
| 151 data_.id = ChildProcessHostImpl::GenerateChildProcessUniqueId(); | 149 data_.id = ChildProcessHostImpl::GenerateChildProcessUniqueId(); |
| 152 | 150 |
| 153 #if USE_ATTACHMENT_BROKER | |
| 154 // Construct the privileged attachment broker early in the life cycle of a | |
| 155 // child process. This ensures that when a test is being run in one of the | |
| 156 // single process modes, the global attachment broker is the privileged | |
| 157 // attachment broker, rather than an unprivileged attachment broker. | |
| 158 #if defined(OS_MACOSX) | |
| 159 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded( | |
| 160 MachBroker::GetInstance()); | |
| 161 #else | |
| 162 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded(); | |
| 163 #endif // defined(OS_MACOSX) | |
| 164 #endif // USE_ATTACHMENT_BROKER | |
| 165 | |
| 166 child_process_host_.reset(ChildProcessHost::Create(this)); | 151 child_process_host_.reset(ChildProcessHost::Create(this)); |
| 167 AddFilter(new TraceMessageFilter(data_.id)); | 152 AddFilter(new TraceMessageFilter(data_.id)); |
| 168 AddFilter(new ProfilerMessageFilter(process_type)); | 153 AddFilter(new ProfilerMessageFilter(process_type)); |
| 169 AddFilter(new HistogramMessageFilter); | 154 AddFilter(new HistogramMessageFilter); |
| 170 AddFilter(new MemoryMessageFilter(this, process_type)); | 155 AddFilter(new MemoryMessageFilter(this, process_type)); |
| 171 | 156 |
| 172 g_child_process_list.Get().push_back(this); | 157 g_child_process_list.Get().push_back(this); |
| 173 GetContentClient()->browser()->BrowserChildProcessHostCreated(this); | 158 GetContentClient()->browser()->BrowserChildProcessHostCreated(this); |
| 174 | 159 |
| 175 power_monitor_message_broadcaster_.Init(); | 160 power_monitor_message_broadcaster_.Init(); |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 | 581 |
| 597 #if defined(OS_WIN) | 582 #if defined(OS_WIN) |
| 598 | 583 |
| 599 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { | 584 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { |
| 600 OnChildDisconnected(); | 585 OnChildDisconnected(); |
| 601 } | 586 } |
| 602 | 587 |
| 603 #endif | 588 #endif |
| 604 | 589 |
| 605 } // namespace content | 590 } // namespace content |
| OLD | NEW |