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

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

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 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_iterator_openbsd.cc ('k') | base/process/process_metrics.h » ('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 <errno.h> 7 #include <errno.h>
8 #include <sys/resource.h> 8 #include <sys/resource.h>
9 9
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/strings/string_number_conversions.h"
13 #include "base/strings/string_split.h" 14 #include "base/strings/string_split.h"
14 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
15 #include "base/synchronization/lock.h" 16 #include "base/synchronization/lock.h"
16 17
17 namespace base { 18 namespace base {
18 19
19 namespace { 20 namespace {
20 21
21 const int kForegroundPriority = 0; 22 const int kForegroundPriority = 0;
22 23
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 113 }
113 #endif 114 #endif
114 return GetPriority() == kBackgroundPriority; 115 return GetPriority() == kBackgroundPriority;
115 } 116 }
116 117
117 bool Process::SetProcessBackgrounded(bool background) { 118 bool Process::SetProcessBackgrounded(bool background) {
118 DCHECK(IsValid()); 119 DCHECK(IsValid());
119 120
120 #if defined(OS_CHROMEOS) 121 #if defined(OS_CHROMEOS)
121 if (cgroups.Get().enabled) { 122 if (cgroups.Get().enabled) {
122 std::string pid = StringPrintf("%d", process_); 123 std::string pid = IntToString(process_);
123 const base::FilePath file = 124 const base::FilePath file =
124 background ? 125 background ?
125 cgroups.Get().background_file : cgroups.Get().foreground_file; 126 cgroups.Get().background_file : cgroups.Get().foreground_file;
126 return base::WriteFile(file, pid.c_str(), pid.size()) > 0; 127 return base::WriteFile(file, pid.c_str(), pid.size()) > 0;
127 } 128 }
128 #endif // OS_CHROMEOS 129 #endif // OS_CHROMEOS
129 130
130 if (!CanBackgroundProcesses()) 131 if (!CanBackgroundProcesses())
131 return false; 132 return false;
132 133
133 int priority = background ? kBackgroundPriority : kForegroundPriority; 134 int priority = background ? kBackgroundPriority : kForegroundPriority;
134 int result = setpriority(PRIO_PROCESS, process_, priority); 135 int result = setpriority(PRIO_PROCESS, process_, priority);
135 DPCHECK(result == 0); 136 DPCHECK(result == 0);
136 return result == 0; 137 return result == 0;
137 } 138 }
138 139
139 } // namespace base 140 } // namespace base
OLDNEW
« no previous file with comments | « base/process/process_iterator_openbsd.cc ('k') | base/process/process_metrics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698