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

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

Issue 812543002: Update from https://crrev.com/308331 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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.h ('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 (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/time.h> 8 #include <sys/time.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 10
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 } 82 }
83 83
84 void Process::Terminate(int result_code) { 84 void Process::Terminate(int result_code) {
85 // result_code isn't supportable. 85 // result_code isn't supportable.
86 DCHECK(IsValid()); 86 DCHECK(IsValid());
87 // We don't wait here. It's the responsibility of other code to reap the 87 // We don't wait here. It's the responsibility of other code to reap the
88 // child. 88 // child.
89 KillProcess(process_, result_code, false); 89 KillProcess(process_, result_code, false);
90 } 90 }
91 91
92 bool Process::WaitForExit(int* exit_code) {
93 // TODO(rvargas) crbug.com/417532: Remove this constant.
94 const int kNoTimeout = -1;
95 return WaitForExitWithTimeout(TimeDelta::FromMilliseconds(kNoTimeout),
96 exit_code);
97 }
98
99 bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) {
100 // TODO(rvargas) crbug.com/417532: Move the implementation here.
101 return base::WaitForExitCodeWithTimeout(Handle(), exit_code, timeout);
102 }
103
92 #if !defined(OS_LINUX) 104 #if !defined(OS_LINUX)
93 bool Process::IsProcessBackgrounded() const { 105 bool Process::IsProcessBackgrounded() const {
94 // See SetProcessBackgrounded(). 106 // See SetProcessBackgrounded().
95 DCHECK(IsValid()); 107 DCHECK(IsValid());
96 return false; 108 return false;
97 } 109 }
98 110
99 bool Process::SetProcessBackgrounded(bool value) { 111 bool Process::SetProcessBackgrounded(bool value) {
100 // POSIX only allows lowering the priority of a process, so if we 112 // POSIX only allows lowering the priority of a process, so if we
101 // were to lower it we wouldn't be able to raise it back to its initial 113 // were to lower it we wouldn't be able to raise it back to its initial
102 // priority. 114 // priority.
103 DCHECK(IsValid()); 115 DCHECK(IsValid());
104 return false; 116 return false;
105 } 117 }
106 #endif // !defined(OS_LINUX) 118 #endif // !defined(OS_LINUX)
107 119
108 int Process::GetPriority() const { 120 int Process::GetPriority() const {
109 DCHECK(IsValid()); 121 DCHECK(IsValid());
110 return getpriority(PRIO_PROCESS, process_); 122 return getpriority(PRIO_PROCESS, process_);
111 } 123 }
112 124
113 } // namspace base 125 } // namspace base
OLDNEW
« no previous file with comments | « base/process/process.h ('k') | base/process/process_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698