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 <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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 void Process::Terminate(int result_code) { | 96 void Process::Terminate(int result_code) { |
97 // result_code isn't supportable. | 97 // result_code isn't supportable. |
98 DCHECK(IsValid()); | 98 DCHECK(IsValid()); |
99 // We don't wait here. It's the responsibility of other code to reap the | 99 // We don't wait here. It's the responsibility of other code to reap the |
100 // child. | 100 // child. |
101 KillProcess(process_, result_code, false); | 101 KillProcess(process_, result_code, false); |
102 } | 102 } |
103 | 103 |
104 bool Process::WaitForExit(int* exit_code) { | 104 bool Process::WaitForExit(int* exit_code) { |
105 // TODO(rvargas) crbug.com/417532: Remove this constant. | 105 return |
106 const int kNoTimeout = -1; | 106 WaitForExitWithTimeout(TimeDelta::FromMilliseconds(internal::kNoTimeout), |
107 return WaitForExitWithTimeout(TimeDelta::FromMilliseconds(kNoTimeout), | 107 exit_code); |
108 exit_code); | |
109 } | 108 } |
110 | 109 |
111 bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) { | 110 bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) { |
112 // TODO(rvargas) crbug.com/417532: Move the implementation here. | 111 return internal::WaitForExitCodeWithTimeout(Handle(), exit_code, timeout); |
113 return base::WaitForExitCodeWithTimeout(Handle(), exit_code, timeout); | |
114 } | 112 } |
115 | 113 |
116 #if !defined(OS_LINUX) | 114 #if !defined(OS_LINUX) |
117 bool Process::IsProcessBackgrounded() const { | 115 bool Process::IsProcessBackgrounded() const { |
118 // See SetProcessBackgrounded(). | 116 // See SetProcessBackgrounded(). |
119 DCHECK(IsValid()); | 117 DCHECK(IsValid()); |
120 return false; | 118 return false; |
121 } | 119 } |
122 | 120 |
123 bool Process::SetProcessBackgrounded(bool value) { | 121 bool Process::SetProcessBackgrounded(bool value) { |
124 // POSIX only allows lowering the priority of a process, so if we | 122 // POSIX only allows lowering the priority of a process, so if we |
125 // were to lower it we wouldn't be able to raise it back to its initial | 123 // were to lower it we wouldn't be able to raise it back to its initial |
126 // priority. | 124 // priority. |
127 DCHECK(IsValid()); | 125 DCHECK(IsValid()); |
128 return false; | 126 return false; |
129 } | 127 } |
130 #endif // !defined(OS_LINUX) | 128 #endif // !defined(OS_LINUX) |
131 | 129 |
132 int Process::GetPriority() const { | 130 int Process::GetPriority() const { |
133 DCHECK(IsValid()); | 131 DCHECK(IsValid()); |
134 return getpriority(PRIO_PROCESS, process_); | 132 return getpriority(PRIO_PROCESS, process_); |
135 } | 133 } |
136 | 134 |
137 } // namspace base | 135 } // namspace base |
OLD | NEW |