OLD | NEW |
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 #include "base/process/process.h" | 5 #include "base/process/process.h" |
6 | 6 |
7 #include "base/debug/activity_tracker.h" | 7 #include "base/debug/activity_tracker.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/numerics/safe_conversions.h" | 9 #include "base/numerics/safe_conversions.h" |
10 #include "base/process/kill.h" | 10 #include "base/process/kill.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 return Process(); | 75 return Process(); |
76 } | 76 } |
77 return Process(out_handle); | 77 return Process(out_handle); |
78 } | 78 } |
79 | 79 |
80 // static | 80 // static |
81 bool Process::CanBackgroundProcesses() { | 81 bool Process::CanBackgroundProcesses() { |
82 return true; | 82 return true; |
83 } | 83 } |
84 | 84 |
| 85 // static |
| 86 void Process::TerminateCurrentProcessImmediately(int exit_code) { |
| 87 ::TerminateProcess(GetCurrentProcess(), exit_code); |
| 88 } |
| 89 |
85 bool Process::IsValid() const { | 90 bool Process::IsValid() const { |
86 return process_.IsValid() || is_current(); | 91 return process_.IsValid() || is_current(); |
87 } | 92 } |
88 | 93 |
89 ProcessHandle Process::Handle() const { | 94 ProcessHandle Process::Handle() const { |
90 return is_current_process_ ? GetCurrentProcess() : process_.Get(); | 95 return is_current_process_ ? GetCurrentProcess() : process_.Get(); |
91 } | 96 } |
92 | 97 |
93 Process Process::Duplicate() const { | 98 Process Process::Duplicate() const { |
94 if (is_current()) | 99 if (is_current()) |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 189 |
185 return (::SetPriorityClass(Handle(), priority) != 0); | 190 return (::SetPriorityClass(Handle(), priority) != 0); |
186 } | 191 } |
187 | 192 |
188 int Process::GetPriority() const { | 193 int Process::GetPriority() const { |
189 DCHECK(IsValid()); | 194 DCHECK(IsValid()); |
190 return ::GetPriorityClass(Handle()); | 195 return ::GetPriorityClass(Handle()); |
191 } | 196 } |
192 | 197 |
193 } // namespace base | 198 } // namespace base |
OLD | NEW |