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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 void BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags( | 220 void BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags( |
221 base::CommandLine* cmd_line) { | 221 base::CommandLine* cmd_line) { |
222 // If we run base::FieldTrials, we want to pass to their state to the | 222 // If we run base::FieldTrials, we want to pass to their state to the |
223 // child process so that it can act in accordance with each state. | 223 // child process so that it can act in accordance with each state. |
224 base::FieldTrialList::CopyFieldTrialStateToFlags( | 224 base::FieldTrialList::CopyFieldTrialStateToFlags( |
225 switches::kFieldTrialHandle, switches::kEnableFeatures, | 225 switches::kFieldTrialHandle, switches::kEnableFeatures, |
226 switches::kDisableFeatures, cmd_line); | 226 switches::kDisableFeatures, cmd_line); |
227 } | 227 } |
228 | 228 |
229 void BrowserChildProcessHostImpl::Launch( | 229 void BrowserChildProcessHostImpl::Launch( |
230 SandboxedProcessLauncherDelegate* delegate, | 230 std::unique_ptr<SandboxedProcessLauncherDelegate> delegate, |
231 base::CommandLine* cmd_line, | 231 std::unique_ptr<base::CommandLine> cmd_line, |
232 bool terminate_on_shutdown) { | 232 bool terminate_on_shutdown) { |
233 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 233 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
234 | 234 |
235 GetContentClient()->browser()->AppendExtraCommandLineSwitches( | 235 GetContentClient()->browser()->AppendExtraCommandLineSwitches(cmd_line.get(), |
236 cmd_line, data_.id); | 236 data_.id); |
237 | 237 |
238 const base::CommandLine& browser_command_line = | 238 const base::CommandLine& browser_command_line = |
239 *base::CommandLine::ForCurrentProcess(); | 239 *base::CommandLine::ForCurrentProcess(); |
240 static const char* const kForwardSwitches[] = { | 240 static const char* const kForwardSwitches[] = { |
241 switches::kDisableLogging, | 241 switches::kDisableLogging, |
242 switches::kEnableLogging, | 242 switches::kEnableLogging, |
243 switches::kIPCConnectionTimeout, | 243 switches::kIPCConnectionTimeout, |
244 switches::kLoggingLevel, | 244 switches::kLoggingLevel, |
245 switches::kTraceToConsole, | 245 switches::kTraceToConsole, |
246 switches::kV, | 246 switches::kV, |
247 switches::kVModule, | 247 switches::kVModule, |
248 }; | 248 }; |
249 cmd_line->CopySwitchesFrom(browser_command_line, kForwardSwitches, | 249 cmd_line->CopySwitchesFrom(browser_command_line, kForwardSwitches, |
250 arraysize(kForwardSwitches)); | 250 arraysize(kForwardSwitches)); |
251 | 251 |
252 if (child_connection_) { | 252 if (child_connection_) { |
253 cmd_line->AppendSwitchASCII(switches::kServiceRequestChannelToken, | 253 cmd_line->AppendSwitchASCII(switches::kServiceRequestChannelToken, |
254 child_connection_->service_token()); | 254 child_connection_->service_token()); |
255 } | 255 } |
256 | 256 |
257 notify_child_disconnected_ = true; | 257 notify_child_disconnected_ = true; |
258 child_process_.reset(new ChildProcessLauncher( | 258 child_process_.reset(new ChildProcessLauncher( |
259 delegate, cmd_line, data_.id, this, child_token_, | 259 std::move(delegate), std::move(cmd_line), data_.id, this, child_token_, |
260 base::Bind(&BrowserChildProcessHostImpl::OnMojoError, | 260 base::Bind(&BrowserChildProcessHostImpl::OnMojoError, |
261 weak_factory_.GetWeakPtr(), | 261 weak_factory_.GetWeakPtr(), |
262 base::ThreadTaskRunnerHandle::Get()), | 262 base::ThreadTaskRunnerHandle::Get()), |
263 terminate_on_shutdown)); | 263 terminate_on_shutdown)); |
264 } | 264 } |
265 | 265 |
266 const ChildProcessData& BrowserChildProcessHostImpl::GetData() const { | 266 const ChildProcessData& BrowserChildProcessHostImpl::GetData() const { |
267 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 267 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
268 return data_; | 268 return data_; |
269 } | 269 } |
(...skipping 332 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 |