• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "base/process/launch.h"
6 #include "build/build_config.h"
7 
8 namespace base {
9 
LaunchOptions()10 LaunchOptions::LaunchOptions()
11     : wait(false),
12 #if defined(OS_WIN)
13       start_hidden(false),
14       handles_to_inherit(NULL),
15       inherit_handles(false),
16       as_user(NULL),
17       empty_desktop_name(false),
18       job_handle(NULL),
19       stdin_handle(NULL),
20       stdout_handle(NULL),
21       stderr_handle(NULL),
22       force_breakaway_from_job_(false)
23 #else
24       clear_environ(false),
25       fds_to_remap(NULL),
26       maximize_rlimits(NULL),
27       new_process_group(false)
28 #if defined(OS_LINUX)
29       , clone_flags(0)
30       , allow_new_privs(false)
31       , kill_on_parent_death(false)
32 #endif  // OS_LINUX
33 #if defined(OS_POSIX)
34       , pre_exec_delegate(NULL)
35 #endif  // OS_POSIX
36 #if defined(OS_CHROMEOS)
37       , ctrl_terminal_fd(-1)
38 #endif  // OS_CHROMEOS
39 #endif  // !defined(OS_WIN)
40     {
41 }
42 
43 LaunchOptions::LaunchOptions(const LaunchOptions& other) = default;
44 
~LaunchOptions()45 LaunchOptions::~LaunchOptions() {
46 }
47 
LaunchOptionsForTest()48 LaunchOptions LaunchOptionsForTest() {
49   LaunchOptions options;
50 #if defined(OS_LINUX)
51   // To prevent accidental privilege sharing to an untrusted child, processes
52   // are started with PR_SET_NO_NEW_PRIVS. Do not set that here, since this
53   // new child will be used for testing only.
54   options.allow_new_privs = true;
55 #endif
56   return options;
57 }
58 
59 }  // namespace base
60