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

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 nacl sandbox options on Linux Created 6 years, 10 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::kEnableDCHECK, 142 switches::kEnableDCHECK,
149 switches::kEnableLogging, 143 switches::kEnableLogging,
150 switches::kLoggingLevel, 144 switches::kLoggingLevel,
151 switches::kTraceToConsole, 145 switches::kTraceToConsole,
152 switches::kV, 146 switches::kV,
153 switches::kVModule, 147 switches::kVModule,
154 #if defined(OS_POSIX) 148 #if defined(OS_POSIX)
155 switches::kChildCleanExit, 149 switches::kChildCleanExit,
156 #endif 150 #endif
157 #if defined(OS_WIN) 151 #if defined(OS_WIN)
158 switches::kEnableHighResolutionTime, 152 switches::kEnableHighResolutionTime,
159 #endif 153 #endif
160 }; 154 };
161 cmd_line->CopySwitchesFrom(browser_command_line, kForwardSwitches, 155 cmd_line->CopySwitchesFrom(browser_command_line, kForwardSwitches,
162 arraysize(kForwardSwitches)); 156 arraysize(kForwardSwitches));
163 157
164 child_process_.reset(new ChildProcessLauncher( 158 child_process_.reset(new ChildProcessLauncher(
165 #if defined(OS_WIN)
166 delegate, 159 delegate,
167 launch_elevated,
168 #elif defined(OS_POSIX)
169 use_zygote,
170 environ,
171 child_process_host_->TakeClientFileDescriptor(),
172 #endif
173 cmd_line, 160 cmd_line,
174 data_.id, 161 data_.id,
175 this)); 162 this));
176 } 163 }
177 164
178 const ChildProcessData& BrowserChildProcessHostImpl::GetData() const { 165 const ChildProcessData& BrowserChildProcessHostImpl::GetData() const {
179 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 166 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
180 return data_; 167 return data_;
181 } 168 }
182 169
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 351
365 void BrowserChildProcessHostImpl::OnProcessExitedEarly( 352 void BrowserChildProcessHostImpl::OnProcessExitedEarly(
366 base::WaitableEvent* event) { 353 base::WaitableEvent* event) {
367 DeleteProcessWaitableEvent(event); 354 DeleteProcessWaitableEvent(event);
368 OnChildDisconnected(); 355 OnChildDisconnected();
369 } 356 }
370 357
371 #endif 358 #endif
372 359
373 } // namespace content 360 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698