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

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

Issue 1142913004: Revert of Add support for backgrounding processes on the Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « base/process/process_mac.cc ('k') | base/process/process_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 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"
11 #include "base/logging.h" 11 #include "base/logging.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 // On POSIX there are no privileges to set. 246 // On POSIX there are no privileges to set.
247 return Open(pid); 247 return Open(pid);
248 } 248 }
249 249
250 // static 250 // static
251 Process Process::DeprecatedGetProcessFromHandle(ProcessHandle handle) { 251 Process Process::DeprecatedGetProcessFromHandle(ProcessHandle handle) {
252 DCHECK_NE(handle, GetCurrentProcessHandle()); 252 DCHECK_NE(handle, GetCurrentProcessHandle());
253 return Process(handle); 253 return Process(handle);
254 } 254 }
255 255
256 #if !defined(OS_LINUX) && !defined(OS_MACOSX) 256 #if !defined(OS_LINUX)
257 // static 257 // static
258 bool Process::CanBackgroundProcesses() { 258 bool Process::CanBackgroundProcesses() {
259 return false; 259 return false;
260 } 260 }
261 #endif // !defined(OS_LINUX) && !defined(OS_MACOSX) 261 #endif // !defined(OS_LINUX)
262 262
263 bool Process::IsValid() const { 263 bool Process::IsValid() const {
264 return process_ != kNullProcessHandle; 264 return process_ != kNullProcessHandle;
265 } 265 }
266 266
267 ProcessHandle Process::Handle() const { 267 ProcessHandle Process::Handle() const {
268 return process_; 268 return process_;
269 } 269 }
270 270
271 Process Process::Duplicate() const { 271 Process Process::Duplicate() const {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 #endif // !defined(OS_NACL_NONSFI) 346 #endif // !defined(OS_NACL_NONSFI)
347 347
348 bool Process::WaitForExit(int* exit_code) { 348 bool Process::WaitForExit(int* exit_code) {
349 return WaitForExitWithTimeout(TimeDelta::Max(), exit_code); 349 return WaitForExitWithTimeout(TimeDelta::Max(), exit_code);
350 } 350 }
351 351
352 bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) { 352 bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) {
353 return WaitForExitWithTimeoutImpl(Handle(), exit_code, timeout); 353 return WaitForExitWithTimeoutImpl(Handle(), exit_code, timeout);
354 } 354 }
355 355
356 #if !defined(OS_LINUX) && !defined(OS_MACOSX) 356 #if !defined(OS_LINUX)
357 bool Process::IsProcessBackgrounded() const { 357 bool Process::IsProcessBackgrounded() const {
358 // See SetProcessBackgrounded(). 358 // See SetProcessBackgrounded().
359 DCHECK(IsValid()); 359 DCHECK(IsValid());
360 return false; 360 return false;
361 } 361 }
362 362
363 bool Process::SetProcessBackgrounded(bool value) { 363 bool Process::SetProcessBackgrounded(bool value) {
364 // Not implemented for POSIX systems other than Mac and Linux. With POSIX, if 364 // POSIX only allows lowering the priority of a process, so if we
365 // we were to lower the process priority we wouldn't be able to raise it back 365 // were to lower it we wouldn't be able to raise it back to its initial
366 // to its initial priority. 366 // priority.
367 NOTIMPLEMENTED(); 367 DCHECK(IsValid());
368 return false; 368 return false;
369 } 369 }
370 #endif // !defined(OS_LINUX) && !defined(OS_MACOSX) 370 #endif // !defined(OS_LINUX)
371 371
372 int Process::GetPriority() const { 372 int Process::GetPriority() const {
373 DCHECK(IsValid()); 373 DCHECK(IsValid());
374 return getpriority(PRIO_PROCESS, process_); 374 return getpriority(PRIO_PROCESS, process_);
375 } 375 }
376 376
377 } // namespace base 377 } // namespace base
OLDNEW
« no previous file with comments | « base/process/process_mac.cc ('k') | base/process/process_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698