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

Side by Side Diff: base/process/process_posix.cc

Issue 989703002: Add support for backgrounding processes on the Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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 #include "base/process/process.h" 5 #include "base/process/process.h"
6 6
7 #include <sys/resource.h> 7 #include <sys/resource.h>
8 #include <sys/wait.h> 8 #include <sys/wait.h>
9 9
10 #include "base/files/scoped_file.h" 10 #include "base/files/scoped_file.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // On POSIX there are no privileges to set. 242 // On POSIX there are no privileges to set.
243 return Open(pid); 243 return Open(pid);
244 } 244 }
245 245
246 // static 246 // static
247 Process Process::DeprecatedGetProcessFromHandle(ProcessHandle handle) { 247 Process Process::DeprecatedGetProcessFromHandle(ProcessHandle handle) {
248 DCHECK_NE(handle, GetCurrentProcessHandle()); 248 DCHECK_NE(handle, GetCurrentProcessHandle());
249 return Process(handle); 249 return Process(handle);
250 } 250 }
251 251
252 #if !defined(OS_LINUX) 252 #if !defined(OS_LINUX) && !defined(OS_MACOSX)
253 // static 253 // static
254 bool Process::CanBackgroundProcesses() { 254 bool Process::CanBackgroundProcesses() {
255 return false; 255 return false;
256 } 256 }
257 #endif // !defined(OS_LINUX) 257 #endif // !defined(OS_LINUX) && !defined(OS_MACOSX)
258 258
259 bool Process::IsValid() const { 259 bool Process::IsValid() const {
260 return process_ != kNullProcessHandle; 260 return process_ != kNullProcessHandle;
261 } 261 }
262 262
263 ProcessHandle Process::Handle() const { 263 ProcessHandle Process::Handle() const {
264 return process_; 264 return process_;
265 } 265 }
266 266
267 Process Process::Duplicate() const { 267 Process Process::Duplicate() const {
(...skipping 28 matching lines...) Expand all
296 } 296 }
297 297
298 bool Process::WaitForExit(int* exit_code) { 298 bool Process::WaitForExit(int* exit_code) {
299 return WaitForExitWithTimeout(TimeDelta::Max(), exit_code); 299 return WaitForExitWithTimeout(TimeDelta::Max(), exit_code);
300 } 300 }
301 301
302 bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) { 302 bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) {
303 return WaitForExitWithTimeoutImpl(Handle(), exit_code, timeout); 303 return WaitForExitWithTimeoutImpl(Handle(), exit_code, timeout);
304 } 304 }
305 305
306 #if !defined(OS_LINUX) 306 #if !defined(OS_LINUX) && !defined(OS_MACOSX)
307 bool Process::IsProcessBackgrounded() const { 307 bool Process::IsProcessBackgrounded() const {
308 // See SetProcessBackgrounded(). 308 // See SetProcessBackgrounded().
309 DCHECK(IsValid()); 309 DCHECK(IsValid());
310 return false; 310 return false;
311 } 311 }
312 312
313 bool Process::SetProcessBackgrounded(bool value) { 313 bool Process::SetProcessBackgrounded(bool value) {
314 // POSIX only allows lowering the priority of a process, so if we 314 // POSIX only allows lowering the priority of a process, so if we
315 // were to lower it we wouldn't be able to raise it back to its initial 315 // were to lower it we wouldn't be able to raise it back to its initial
316 // priority. 316 // priority.
gab 2015/03/09 15:34:50 Update this comment? i.e. we do it on Linux, Chrom
shrike 2015/03/10 00:34:44 I added NOTIMPLEMENTED() to this method, but the u
gab 2015/03/10 12:29:35 No, NOTIMPLEMENTED() simply results in an ERROR LO
317 DCHECK(IsValid()); 317 DCHECK(IsValid());
318 return false; 318 return false;
319 } 319 }
320 #endif // !defined(OS_LINUX) 320 #endif // !defined(OS_LINUX) && !defined(OS_MACOSX)
321 321
322 int Process::GetPriority() const { 322 int Process::GetPriority() const {
323 DCHECK(IsValid()); 323 DCHECK(IsValid());
324 return getpriority(PRIO_PROCESS, process_); 324 return getpriority(PRIO_PROCESS, process_);
325 } 325 }
326 326
327 } // namspace base 327 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698