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 <errno.h> | 7 #include <errno.h> |
8 #include <sys/resource.h> | 8 #include <sys/resource.h> |
9 | 9 |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } | 63 } |
64 | 64 |
65 namespace base { | 65 namespace base { |
66 | 66 |
67 bool Process::IsProcessBackgrounded() const { | 67 bool Process::IsProcessBackgrounded() const { |
68 DCHECK(process_); | 68 DCHECK(process_); |
69 | 69 |
70 #if defined(OS_CHROMEOS) | 70 #if defined(OS_CHROMEOS) |
71 if (cgroups.Get().enabled) { | 71 if (cgroups.Get().enabled) { |
72 std::string proc; | 72 std::string proc; |
73 if (file_util::ReadFileToString( | 73 if (base::ReadFileToString( |
74 base::FilePath(StringPrintf(kProcPath, process_)), | 74 base::FilePath(StringPrintf(kProcPath, process_)), |
75 &proc)) { | 75 &proc)) { |
76 std::vector<std::string> proc_parts; | 76 std::vector<std::string> proc_parts; |
77 base::SplitString(proc, ':', &proc_parts); | 77 base::SplitString(proc, ':', &proc_parts); |
78 DCHECK(proc_parts.size() == 3); | 78 DCHECK(proc_parts.size() == 3); |
79 bool ret = proc_parts[2] == std::string(kBackground); | 79 bool ret = proc_parts[2] == std::string(kBackground); |
80 return ret; | 80 return ret; |
81 } else { | 81 } else { |
82 return false; | 82 return false; |
83 } | 83 } |
84 } | 84 } |
85 #endif | 85 #endif |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 if (cgroups.Get().enabled) | 128 if (cgroups.Get().enabled) |
129 return true; | 129 return true; |
130 #endif | 130 #endif |
131 | 131 |
132 static LazyInstance<CheckForNicePermission> check_for_nice_permission = | 132 static LazyInstance<CheckForNicePermission> check_for_nice_permission = |
133 LAZY_INSTANCE_INITIALIZER; | 133 LAZY_INSTANCE_INITIALIZER; |
134 return check_for_nice_permission.Get().can_reraise_priority; | 134 return check_for_nice_permission.Get().can_reraise_priority; |
135 } | 135 } |
136 | 136 |
137 } // namespace base | 137 } // namespace base |
OLD | NEW |