Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: content/browser/browser_child_process_host_impl.cc

Issue 177863002: Refactor configuration of sandboxes - first steps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix remaining nits and rebase Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // Make a copy since the BrowserChildProcessHost dtor mutates the original 122 // Make a copy since the BrowserChildProcessHost dtor mutates the original
123 // list. 123 // list.
124 BrowserChildProcessList copy = g_child_process_list.Get(); 124 BrowserChildProcessList copy = g_child_process_list.Get();
125 for (BrowserChildProcessList::iterator it = copy.begin(); 125 for (BrowserChildProcessList::iterator it = copy.begin();
126 it != copy.end(); ++it) { 126 it != copy.end(); ++it) {
127 delete (*it)->delegate(); // ~*HostDelegate deletes *HostImpl. 127 delete (*it)->delegate(); // ~*HostDelegate deletes *HostImpl.
128 } 128 }
129 } 129 }
130 130
131 void BrowserChildProcessHostImpl::Launch( 131 void BrowserChildProcessHostImpl::Launch(
132 #if defined(OS_WIN)
133 SandboxedProcessLauncherDelegate* delegate, 132 SandboxedProcessLauncherDelegate* delegate,
134 bool launch_elevated,
135 #elif defined(OS_POSIX)
136 bool use_zygote,
137 const base::EnvironmentMap& environ,
138 #endif
139 CommandLine* cmd_line) { 133 CommandLine* cmd_line) {
140 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 134 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
141 135
142 GetContentClient()->browser()->AppendExtraCommandLineSwitches( 136 GetContentClient()->browser()->AppendExtraCommandLineSwitches(
143 cmd_line, data_.id); 137 cmd_line, data_.id);
144 138
145 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 139 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
146 static const char* kForwardSwitches[] = { 140 static const char* kForwardSwitches[] = {
147 switches::kDisableLogging, 141 switches::kDisableLogging,
148 switches::kEnableLogging, 142 switches::kEnableLogging,
149 switches::kLoggingLevel, 143 switches::kLoggingLevel,
150 switches::kTraceToConsole, 144 switches::kTraceToConsole,
151 switches::kV, 145 switches::kV,
152 switches::kVModule, 146 switches::kVModule,
153 #if defined(OS_POSIX) 147 #if defined(OS_POSIX)
154 switches::kChildCleanExit, 148 switches::kChildCleanExit,
155 #endif 149 #endif
156 #if defined(OS_WIN) 150 #if defined(OS_WIN)
157 switches::kEnableHighResolutionTime, 151 switches::kEnableHighResolutionTime,
158 #endif 152 #endif
159 }; 153 };
160 cmd_line->CopySwitchesFrom(browser_command_line, kForwardSwitches, 154 cmd_line->CopySwitchesFrom(browser_command_line, kForwardSwitches,
161 arraysize(kForwardSwitches)); 155 arraysize(kForwardSwitches));
162 156
163 child_process_.reset(new ChildProcessLauncher( 157 child_process_.reset(new ChildProcessLauncher(
164 #if defined(OS_WIN)
165 delegate, 158 delegate,
166 launch_elevated,
167 #elif defined(OS_POSIX)
168 use_zygote,
169 environ,
170 child_process_host_->TakeClientFileDescriptor(),
171 #endif
172 cmd_line, 159 cmd_line,
173 data_.id, 160 data_.id,
174 this)); 161 this));
175 } 162 }
176 163
177 const ChildProcessData& BrowserChildProcessHostImpl::GetData() const { 164 const ChildProcessData& BrowserChildProcessHostImpl::GetData() const {
178 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 165 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
179 return data_; 166 return data_;
180 } 167 }
181 168
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 350
364 void BrowserChildProcessHostImpl::OnProcessExitedEarly( 351 void BrowserChildProcessHostImpl::OnProcessExitedEarly(
365 base::WaitableEvent* event) { 352 base::WaitableEvent* event) {
366 DeleteProcessWaitableEvent(event); 353 DeleteProcessWaitableEvent(event);
367 OnChildDisconnected(); 354 OnChildDisconnected();
368 } 355 }
369 356
370 #endif 357 #endif
371 358
372 } // namespace content 359 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_child_process_host_impl.h ('k') | content/browser/child_process_launcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698