Chromium Code Reviews| 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)); | |
| 139 | |
|
jam
2012/10/17 15:19:41
nit: extra line
| |
| 128 | 140 |
| 129 child_process_.reset(new ChildProcessLauncher( | 141 child_process_.reset(new ChildProcessLauncher( |
| 130 #if defined(OS_WIN) | 142 #if defined(OS_WIN) |
| 131 exposed_dir, | 143 exposed_dir, |
| 132 #elif defined(OS_POSIX) | 144 #elif defined(OS_POSIX) |
| 133 use_zygote, | 145 use_zygote, |
| 134 environ, | 146 environ, |
| 135 child_process_host_->TakeClientFileDescriptor(), | 147 child_process_host_->TakeClientFileDescriptor(), |
| 136 #endif | 148 #endif |
| 137 cmd_line, | 149 cmd_line, |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 } | 268 } |
| 257 | 269 |
| 258 void BrowserChildProcessHostImpl::OnProcessLaunched() { | 270 void BrowserChildProcessHostImpl::OnProcessLaunched() { |
| 259 if (!child_process_->GetHandle()) { | 271 if (!child_process_->GetHandle()) { |
| 260 delete delegate_; // Will delete us | 272 delete delegate_; // Will delete us |
| 261 return; | 273 return; |
| 262 } | 274 } |
| 263 data_.handle = child_process_->GetHandle(); | 275 data_.handle = child_process_->GetHandle(); |
| 264 delegate_->OnProcessLaunched(); | 276 delegate_->OnProcessLaunched(); |
| 265 } | 277 } |
| OLD | NEW |