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

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

Issue 1284833004: Remove remaining legacy SplitString calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 | « no previous file | base/process/process_metrics_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
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"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 bool Process::IsProcessBackgrounded() const { 96 bool Process::IsProcessBackgrounded() const {
97 DCHECK(IsValid()); 97 DCHECK(IsValid());
98 98
99 #if defined(OS_CHROMEOS) 99 #if defined(OS_CHROMEOS)
100 if (cgroups.Get().enabled) { 100 if (cgroups.Get().enabled) {
101 std::string proc; 101 std::string proc;
102 if (base::ReadFileToString( 102 if (base::ReadFileToString(
103 base::FilePath(StringPrintf(kProcPath, process_)), 103 base::FilePath(StringPrintf(kProcPath, process_)),
104 &proc)) { 104 &proc)) {
105 std::vector<std::string> proc_parts; 105 std::vector<std::string> proc_parts = base::SplitString(
106 base::SplitString(proc, ':', &proc_parts); 106 proc, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
107 DCHECK_EQ(proc_parts.size(), 3u); 107 DCHECK_EQ(proc_parts.size(), 3u);
108 bool ret = proc_parts[2] == std::string(kBackground); 108 bool ret = proc_parts[2] == std::string(kBackground);
109 return ret; 109 return ret;
110 } else { 110 } else {
111 return false; 111 return false;
112 } 112 }
113 } 113 }
114 #endif 114 #endif
115 return GetPriority() == kBackgroundPriority; 115 return GetPriority() == kBackgroundPriority;
116 } 116 }
(...skipping 14 matching lines...) Expand all
131 if (!CanBackgroundProcesses()) 131 if (!CanBackgroundProcesses())
132 return false; 132 return false;
133 133
134 int priority = background ? kBackgroundPriority : kForegroundPriority; 134 int priority = background ? kBackgroundPriority : kForegroundPriority;
135 int result = setpriority(PRIO_PROCESS, process_, priority); 135 int result = setpriority(PRIO_PROCESS, process_, priority);
136 DPCHECK(result == 0); 136 DPCHECK(result == 0);
137 return result == 0; 137 return result == 0;
138 } 138 }
139 139
140 } // namespace base 140 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/process/process_metrics_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698