| 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 14 matching lines...) Expand all Loading... |
| 25 #include "build/build_config.h" | 25 #include "build/build_config.h" |
| 26 #include "components/tracing/common/tracing_switches.h" | 26 #include "components/tracing/common/tracing_switches.h" |
| 27 #include "content/browser/histogram_message_filter.h" | 27 #include "content/browser/histogram_message_filter.h" |
| 28 #include "content/browser/loader/resource_message_filter.h" | 28 #include "content/browser/loader/resource_message_filter.h" |
| 29 #include "content/browser/memory/memory_message_filter.h" | 29 #include "content/browser/memory/memory_message_filter.h" |
| 30 #include "content/browser/profiler_message_filter.h" | 30 #include "content/browser/profiler_message_filter.h" |
| 31 #include "content/browser/service_manager/service_manager_context.h" | 31 #include "content/browser/service_manager/service_manager_context.h" |
| 32 #include "content/browser/tracing/trace_message_filter.h" | 32 #include "content/browser/tracing/trace_message_filter.h" |
| 33 #include "content/common/child_process_host_impl.h" | 33 #include "content/common/child_process_host_impl.h" |
| 34 #include "content/common/child_process_messages.h" | 34 #include "content/common/child_process_messages.h" |
| 35 #include "content/common/mojo/mojo_child_connection.h" | 35 #include "content/common/service_manager/child_connection.h" |
| 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_switches.h" | 41 #include "content/public/common/content_switches.h" |
| 42 #include "content/public/common/mojo_channel_switches.h" | 42 #include "content/public/common/mojo_channel_switches.h" |
| 43 #include "content/public/common/process_type.h" | 43 #include "content/public/common/process_type.h" |
| 44 #include "content/public/common/result_codes.h" | 44 #include "content/public/common/result_codes.h" |
| 45 #include "ipc/attachment_broker.h" | 45 #include "ipc/attachment_broker.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 AddFilter(new HistogramMessageFilter); | 168 AddFilter(new HistogramMessageFilter); |
| 169 AddFilter(new MemoryMessageFilter(this, process_type)); | 169 AddFilter(new MemoryMessageFilter(this, process_type)); |
| 170 | 170 |
| 171 g_child_process_list.Get().push_back(this); | 171 g_child_process_list.Get().push_back(this); |
| 172 GetContentClient()->browser()->BrowserChildProcessHostCreated(this); | 172 GetContentClient()->browser()->BrowserChildProcessHostCreated(this); |
| 173 | 173 |
| 174 power_monitor_message_broadcaster_.Init(); | 174 power_monitor_message_broadcaster_.Init(); |
| 175 | 175 |
| 176 if (!service_name.empty()) { | 176 if (!service_name.empty()) { |
| 177 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 177 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 178 child_connection_.reset(new MojoChildConnection( | 178 child_connection_.reset(new ChildConnection( |
| 179 service_name, base::StringPrintf("%d", data_.id), child_token_, | 179 service_name, base::StringPrintf("%d", data_.id), child_token_, |
| 180 ServiceManagerContext::GetConnectorForIOThread(), | 180 ServiceManagerContext::GetConnectorForIOThread(), |
| 181 base::ThreadTaskRunnerHandle::Get())); | 181 base::ThreadTaskRunnerHandle::Get())); |
| 182 } | 182 } |
| 183 | 183 |
| 184 // Create a persistent memory segment for subprocess histograms. | 184 // Create a persistent memory segment for subprocess histograms. |
| 185 CreateMetricsAllocator(); | 185 CreateMetricsAllocator(); |
| 186 } | 186 } |
| 187 | 187 |
| 188 BrowserChildProcessHostImpl::~BrowserChildProcessHostImpl() { | 188 BrowserChildProcessHostImpl::~BrowserChildProcessHostImpl() { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 switches::kIPCConnectionTimeout, | 245 switches::kIPCConnectionTimeout, |
| 246 switches::kLoggingLevel, | 246 switches::kLoggingLevel, |
| 247 switches::kTraceToConsole, | 247 switches::kTraceToConsole, |
| 248 switches::kV, | 248 switches::kV, |
| 249 switches::kVModule, | 249 switches::kVModule, |
| 250 }; | 250 }; |
| 251 cmd_line->CopySwitchesFrom(browser_command_line, kForwardSwitches, | 251 cmd_line->CopySwitchesFrom(browser_command_line, kForwardSwitches, |
| 252 arraysize(kForwardSwitches)); | 252 arraysize(kForwardSwitches)); |
| 253 | 253 |
| 254 if (child_connection_) { | 254 if (child_connection_) { |
| 255 cmd_line->AppendSwitchASCII(switches::kMojoApplicationChannelToken, | 255 cmd_line->AppendSwitchASCII(switches::kServiceRequestChannelToken, |
| 256 child_connection_->service_token()); | 256 child_connection_->service_token()); |
| 257 } | 257 } |
| 258 | 258 |
| 259 notify_child_disconnected_ = true; | 259 notify_child_disconnected_ = true; |
| 260 child_process_.reset(new ChildProcessLauncher( | 260 child_process_.reset(new ChildProcessLauncher( |
| 261 delegate, | 261 delegate, |
| 262 cmd_line, | 262 cmd_line, |
| 263 data_.id, | 263 data_.id, |
| 264 this, | 264 this, |
| 265 child_token_, | 265 child_token_, |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 | 602 |
| 603 #if defined(OS_WIN) | 603 #if defined(OS_WIN) |
| 604 | 604 |
| 605 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { | 605 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { |
| 606 OnChildDisconnected(); | 606 OnChildDisconnected(); |
| 607 } | 607 } |
| 608 | 608 |
| 609 #endif | 609 #endif |
| 610 | 610 |
| 611 } // namespace content | 611 } // namespace content |
| OLD | NEW |