Exclude one flaky test from Valgrind runs
[chromium-blink-merge.git] / base / process / process.h
blob20e8884b9720f04fad879980107c14a9a3951f31
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
3 // found in the LICENSE file.
5 #ifndef BASE_PROCESS_PROCESS_PROCESS_H_
6 #define BASE_PROCESS_PROCESS_PROCESS_H_
8 #include "base/base_export.h"
9 #include "base/basictypes.h"
10 #include "base/process/process_handle.h"
11 #include "build/build_config.h"
13 namespace base {
15 class BASE_EXPORT Process {
16 public:
17 Process() : process_(kNullProcessHandle) {
20 explicit Process(ProcessHandle handle) : process_(handle) {
23 // A handle to the current process.
24 static Process Current();
26 static bool CanBackgroundProcesses();
28 // Get/Set the handle for this process. The handle will be 0 if the process
29 // is no longer running.
30 ProcessHandle handle() const { return process_; }
31 void set_handle(ProcessHandle handle) {
32 process_ = handle;
35 // Get the PID for this process.
36 ProcessId pid() const;
38 // Is the this process the current process.
39 bool is_current() const;
41 // Close the process handle. This will not terminate the process.
42 void Close();
44 // Terminates the process with extreme prejudice. The given result code will
45 // be the exit code of the process. If the process has already exited, this
46 // will do nothing.
47 void Terminate(int result_code);
49 // A process is backgrounded when it's priority is lower than normal.
50 // Return true if this process is backgrounded, false otherwise.
51 bool IsProcessBackgrounded() const;
53 // Set a process as backgrounded. If value is true, the priority
54 // of the process will be lowered. If value is false, the priority
55 // of the process will be made "normal" - equivalent to default
56 // process priority.
57 // Returns true if the priority was changed, false otherwise.
58 bool SetProcessBackgrounded(bool value);
60 // Returns an integer representing the priority of a process. The meaning
61 // of this value is OS dependent.
62 int GetPriority() const;
64 private:
65 ProcessHandle process_;
68 } // namespace base
70 #endif // BASE_PROCESS_PROCESS_PROCESS_H_