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

Side by Side Diff: base/process_posix.cc

Issue 19519008: Move the remaning base/process* files into base/process/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « base/process_linux.cc ('k') | base/process_util_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/process.h"
6
7 #include <sys/types.h>
8 #include <sys/time.h>
9 #include <sys/resource.h>
10
11 #include "base/process_util.h"
12 #include "base/logging.h"
13
14 namespace base {
15
16 // static
17 Process Process::Current() {
18 return Process(GetCurrentProcessHandle());
19 }
20
21 ProcessId Process::pid() const {
22 if (process_ == 0)
23 return 0;
24
25 return GetProcId(process_);
26 }
27
28 bool Process::is_current() const {
29 return process_ == GetCurrentProcessHandle();
30 }
31
32 void Process::Close() {
33 process_ = 0;
34 // if the process wasn't terminated (so we waited) or the state
35 // wasn't already collected w/ a wait from process_utils, we're gonna
36 // end up w/ a zombie when it does finally exit.
37 }
38
39 void Process::Terminate(int result_code) {
40 // result_code isn't supportable.
41 if (!process_)
42 return;
43 // We don't wait here. It's the responsibility of other code to reap the
44 // child.
45 KillProcess(process_, result_code, false);
46 }
47
48 #if !defined(OS_LINUX)
49 bool Process::IsProcessBackgrounded() const {
50 // See SetProcessBackgrounded().
51 return false;
52 }
53
54 bool Process::SetProcessBackgrounded(bool value) {
55 // POSIX only allows lowering the priority of a process, so if we
56 // were to lower it we wouldn't be able to raise it back to its initial
57 // priority.
58 return false;
59 }
60
61 // static
62 bool Process::CanBackgroundProcesses() {
63 return false;
64 }
65
66 #endif
67
68 int Process::GetPriority() const {
69 DCHECK(process_);
70 return getpriority(PRIO_PROCESS, process_);
71 }
72
73 } // namspace base
OLDNEW
« no previous file with comments | « base/process_linux.cc ('k') | base/process_util_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698