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

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

Issue 10949027: Close leaking FDs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
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/child_process_launcher.h" 5 #include "content/browser/child_process_launcher.h"
6 6
7 #include <utility> // For std::pair. 7 #include <utility> // For std::pair.
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 CommandLine* cmd_line) { 160 CommandLine* cmd_line) {
161 scoped_ptr<CommandLine> cmd_line_deleter(cmd_line); 161 scoped_ptr<CommandLine> cmd_line_deleter(cmd_line);
162 162
163 #if defined(OS_WIN) 163 #if defined(OS_WIN)
164 base::ProcessHandle handle = sandbox::StartProcessWithAccess( 164 base::ProcessHandle handle = sandbox::StartProcessWithAccess(
165 cmd_line, exposed_dir); 165 cmd_line, exposed_dir);
166 #elif defined(OS_ANDROID) 166 #elif defined(OS_ANDROID)
167 std::string process_type = 167 std::string process_type =
168 cmd_line->GetSwitchValueASCII(switches::kProcessType); 168 cmd_line->GetSwitchValueASCII(switches::kProcessType);
169 base::GlobalDescriptors::Mapping files_to_register; 169 base::GlobalDescriptors::Mapping files_to_register;
170 files_to_register.push_back(std::pair<base::GlobalDescriptors::Key, int>(
171 kPrimaryIPCChannel, ipcfd));
Jay Civelli 2012/09/19 22:58:57 Not sure why this was done. The IPC FD is special
Yaron 2012/09/20 00:01:54 Are you sure this is right? I thought we've always
172 content::GetContentClient()->browser()-> 170 content::GetContentClient()->browser()->
173 GetAdditionalMappedFilesForChildProcess(*cmd_line, &files_to_register); 171 GetAdditionalMappedFilesForChildProcess(*cmd_line, &files_to_register);
174 172
175 content::StartSandboxedProcess(cmd_line->argv(), 173 content::StartSandboxedProcess(cmd_line->argv(),
176 ipcfd, files_to_register, 174 ipcfd, files_to_register,
177 base::Bind(&ChildProcessLauncher::Context::OnSandboxedProcessStarted, 175 base::Bind(&ChildProcessLauncher::Context::OnSandboxedProcessStarted,
178 this_object, client_thread_id)); 176 this_object, client_thread_id));
179 177
180 #elif defined(OS_POSIX) 178 #elif defined(OS_POSIX)
181 base::ProcessHandle handle = base::kNullProcessHandle; 179 base::ProcessHandle handle = base::kNullProcessHandle;
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 base::Bind( 443 base::Bind(
446 &ChildProcessLauncher::Context::SetProcessBackgrounded, 444 &ChildProcessLauncher::Context::SetProcessBackgrounded,
447 GetHandle(), background)); 445 GetHandle(), background));
448 } 446 }
449 447
450 void ChildProcessLauncher::SetTerminateChildOnShutdown( 448 void ChildProcessLauncher::SetTerminateChildOnShutdown(
451 bool terminate_on_shutdown) { 449 bool terminate_on_shutdown) {
452 if (context_) 450 if (context_)
453 context_->set_terminate_child_on_shutdown(terminate_on_shutdown); 451 context_->set_terminate_child_on_shutdown(terminate_on_shutdown);
454 } 452 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698