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

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

Issue 197873014: Revert of Implement ScopedFD in terms of ScopedGeneric. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « components/nacl.gyp ('k') | content/browser/zygote_host/zygote_host_impl_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/files/scoped_file.h"
13 #include "base/logging.h" 12 #include "base/logging.h"
14 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
15 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
16 #include "base/process/process.h" 15 #include "base/process/process.h"
17 #include "base/synchronization/lock.h" 16 #include "base/synchronization/lock.h"
18 #include "base/threading/thread.h" 17 #include "base/threading/thread.h"
19 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
20 #include "content/public/browser/content_browser_client.h" 19 #include "content/public/browser/content_browser_client.h"
21 #include "content/public/common/content_descriptors.h" 20 #include "content/public/common/content_descriptors.h"
22 #include "content/public/common/content_switches.h" 21 #include "content/public/common/content_switches.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 &files_to_register); 221 &files_to_register);
223 222
224 StartChildProcess(cmd_line->argv(), files_to_register, 223 StartChildProcess(cmd_line->argv(), files_to_register,
225 base::Bind(&ChildProcessLauncher::Context::OnChildProcessStarted, 224 base::Bind(&ChildProcessLauncher::Context::OnChildProcessStarted,
226 this_object, client_thread_id, begin_launch_time)); 225 this_object, client_thread_id, begin_launch_time));
227 226
228 #elif defined(OS_POSIX) 227 #elif defined(OS_POSIX)
229 base::ProcessHandle handle = base::kNullProcessHandle; 228 base::ProcessHandle handle = base::kNullProcessHandle;
230 // We need to close the client end of the IPC channel to reliably detect 229 // We need to close the client end of the IPC channel to reliably detect
231 // child termination. 230 // child termination.
232 base::ScopedFD ipcfd_closer(ipcfd); 231 file_util::ScopedFD ipcfd_closer(&ipcfd);
233 232
234 #if !defined(OS_MACOSX) 233 #if !defined(OS_MACOSX)
235 GetContentClient()->browser()-> 234 GetContentClient()->browser()->
236 GetAdditionalMappedFilesForChildProcess(*cmd_line, child_process_id, 235 GetAdditionalMappedFilesForChildProcess(*cmd_line, child_process_id,
237 &files_to_register); 236 &files_to_register);
238 if (use_zygote) { 237 if (use_zygote) {
239 handle = ZygoteHostImpl::GetInstance()->ForkRequest(cmd_line->argv(), 238 handle = ZygoteHostImpl::GetInstance()->ForkRequest(cmd_line->argv(),
240 files_to_register, 239 files_to_register,
241 process_type); 240 process_type);
242 } else 241 } else
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 #endif // !defined(OS_ANDROID) 312 #endif // !defined(OS_ANDROID)
314 } 313 }
315 314
316 void Notify( 315 void Notify(
317 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) 316 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
318 bool zygote, 317 bool zygote,
319 #endif 318 #endif
320 base::ProcessHandle handle) { 319 base::ProcessHandle handle) {
321 #if defined(OS_ANDROID) 320 #if defined(OS_ANDROID)
322 // Finally close the ipcfd 321 // Finally close the ipcfd
323 base::ScopedFD ipcfd_closer(ipcfd_); 322 file_util::ScopedFD ipcfd_closer(&ipcfd_);
324 #endif 323 #endif
325 starting_ = false; 324 starting_ = false;
326 process_.set_handle(handle); 325 process_.set_handle(handle);
327 if (!handle) 326 if (!handle)
328 LOG(ERROR) << "Failed to launch child process"; 327 LOG(ERROR) << "Failed to launch child process";
329 328
330 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) 329 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
331 zygote_ = zygote; 330 zygote_ = zygote;
332 #endif 331 #endif
333 if (client_) { 332 if (client_) {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 GetHandle(), background)); 497 GetHandle(), background));
499 } 498 }
500 499
501 void ChildProcessLauncher::SetTerminateChildOnShutdown( 500 void ChildProcessLauncher::SetTerminateChildOnShutdown(
502 bool terminate_on_shutdown) { 501 bool terminate_on_shutdown) {
503 if (context_.get()) 502 if (context_.get())
504 context_->set_terminate_child_on_shutdown(terminate_on_shutdown); 503 context_->set_terminate_child_on_shutdown(terminate_on_shutdown);
505 } 504 }
506 505
507 } // namespace content 506 } // namespace content
OLDNEW
« no previous file with comments | « components/nacl.gyp ('k') | content/browser/zygote_host/zygote_host_impl_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698