| 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/bind.h" | 8 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 9 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 10 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 13 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 14 #include "base/process_util.h" | 15 #include "base/process_util.h" |
| 15 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
| 16 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 #elif defined(OS_POSIX) | 115 #elif defined(OS_POSIX) |
| 115 bool use_zygote, | 116 bool use_zygote, |
| 116 const base::EnvironmentVector& environ, | 117 const base::EnvironmentVector& environ, |
| 117 #endif | 118 #endif |
| 118 CommandLine* cmd_line) { | 119 CommandLine* cmd_line) { |
| 119 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 120 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 120 | 121 |
| 121 content::GetContentClient()->browser()->AppendExtraCommandLineSwitches( | 122 content::GetContentClient()->browser()->AppendExtraCommandLineSwitches( |
| 122 cmd_line, data_.id); | 123 cmd_line, data_.id); |
| 123 | 124 |
| 125 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
| 126 static const char* kForwardSwitches[] = { |
| 124 #if defined(OS_POSIX) | 127 #if defined(OS_POSIX) |
| 125 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kChildCleanExit)) | 128 switches::kChildCleanExit, |
| 126 cmd_line->AppendSwitch(switches::kChildCleanExit); | |
| 127 #endif | 129 #endif |
| 130 switches::kDisableLogging, |
| 131 switches::kEnableDCHECK, |
| 132 switches::kEnableLogging, |
| 133 switches::kLoggingLevel, |
| 134 switches::kV, |
| 135 switches::kVModule, |
| 136 }; |
| 137 cmd_line->CopySwitchesFrom(browser_command_line, kForwardSwitches, |
| 138 arraysize(kForwardSwitches)); |
| 128 | 139 |
| 129 child_process_.reset(new ChildProcessLauncher( | 140 child_process_.reset(new ChildProcessLauncher( |
| 130 #if defined(OS_WIN) | 141 #if defined(OS_WIN) |
| 131 exposed_dir, | 142 exposed_dir, |
| 132 #elif defined(OS_POSIX) | 143 #elif defined(OS_POSIX) |
| 133 use_zygote, | 144 use_zygote, |
| 134 environ, | 145 environ, |
| 135 child_process_host_->TakeClientFileDescriptor(), | 146 child_process_host_->TakeClientFileDescriptor(), |
| 136 #endif | 147 #endif |
| 137 cmd_line, | 148 cmd_line, |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 } | 267 } |
| 257 | 268 |
| 258 void BrowserChildProcessHostImpl::OnProcessLaunched() { | 269 void BrowserChildProcessHostImpl::OnProcessLaunched() { |
| 259 if (!child_process_->GetHandle()) { | 270 if (!child_process_->GetHandle()) { |
| 260 delete delegate_; // Will delete us | 271 delete delegate_; // Will delete us |
| 261 return; | 272 return; |
| 262 } | 273 } |
| 263 data_.handle = child_process_->GetHandle(); | 274 data_.handle = child_process_->GetHandle(); |
| 264 delegate_->OnProcessLaunched(); | 275 delegate_->OnProcessLaunched(); |
| 265 } | 276 } |
| OLD | NEW |