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

Side by Side Diff: base/process/process.h

Issue 862133002: Update from https://crrev.com/312398 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef BASE_PROCESS_PROCESS_PROCESS_H_ 5 #ifndef BASE_PROCESS_PROCESS_PROCESS_H_
6 #define BASE_PROCESS_PROCESS_PROCESS_H_ 6 #define BASE_PROCESS_PROCESS_PROCESS_H_
7 7
8 #include "base/base_export.h" 8 #include "base/base_export.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/move.h" 10 #include "base/move.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 // The destructor does not terminate the process. 43 // The destructor does not terminate the process.
44 ~Process() {} 44 ~Process() {}
45 45
46 // Move operator= for C++03 move emulation of this type. 46 // Move operator= for C++03 move emulation of this type.
47 Process& operator=(RValue other); 47 Process& operator=(RValue other);
48 48
49 // Returns an object for the current process. 49 // Returns an object for the current process.
50 static Process Current(); 50 static Process Current();
51 51
52 // Returns a Process for the given |pid|. On Windows the handle is opened
53 // with more access rights and must only be used by trusted code (can read the
54 // address space and duplicate handles).
55 static Process OpenWithExtraPriviles(ProcessId pid);
56
52 // Creates an object from a |handle| owned by someone else. 57 // Creates an object from a |handle| owned by someone else.
53 // Don't use this for new code. It is only intended to ease the migration to 58 // Don't use this for new code. It is only intended to ease the migration to
54 // a strict ownership model. 59 // a strict ownership model.
55 // TODO(rvargas) crbug.com/417532: Remove this code. 60 // TODO(rvargas) crbug.com/417532: Remove this code.
56 static Process DeprecatedGetProcessFromHandle(ProcessHandle handle); 61 static Process DeprecatedGetProcessFromHandle(ProcessHandle handle);
57 62
58 // Returns true if processes can be backgrounded. 63 // Returns true if processes can be backgrounded.
59 static bool CanBackgroundProcesses(); 64 static bool CanBackgroundProcesses();
60 65
61 // Returns true if this objects represents a valid process. 66 // Returns true if this objects represents a valid process.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 110
106 private: 111 private:
107 #if defined(OS_WIN) 112 #if defined(OS_WIN)
108 bool is_current_process_; 113 bool is_current_process_;
109 win::ScopedHandle process_; 114 win::ScopedHandle process_;
110 #else 115 #else
111 ProcessHandle process_; 116 ProcessHandle process_;
112 #endif 117 #endif
113 }; 118 };
114 119
120 #if defined(OS_LINUX)
121 // A wrapper for clone with fork-like behavior, meaning that it returns the
122 // child's pid in the parent and 0 in the child. |flags|, |ptid|, and |ctid| are
123 // as in the clone system call (the CLONE_VM flag is not supported).
124 //
125 // This function uses the libc clone wrapper (which updates libc's pid cache)
126 // internally, so callers may expect things like getpid() to work correctly
127 // after in both the child and parent. An exception is when this code is run
128 // under Valgrind. Valgrind does not support the libc clone wrapper, so the libc
129 // pid cache may be incorrect after this function is called under Valgrind.
130 //
131 // As with fork(), callers should be extremely careful when calling this while
132 // multiple threads are running, since at the time the fork happened, the
133 // threads could have been in any state (potentially holding locks, etc.).
134 // Callers should most likely call execve() in the child soon after calling
135 // this.
136 BASE_EXPORT pid_t ForkWithFlags(unsigned long flags, pid_t* ptid, pid_t* ctid);
137 #endif
138
115 } // namespace base 139 } // namespace base
116 140
117 #endif // BASE_PROCESS_PROCESS_PROCESS_H_ 141 #endif // BASE_PROCESS_PROCESS_PROCESS_H_
OLDNEW
« no previous file with comments | « base/process/launch_win.cc ('k') | base/process/process_handle.h » ('j') | shell/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698