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

Side by Side Diff: chrome/browser/process_info_snapshot_mac.cc

Issue 6602049: Pure pedantry: Replace all ".size() == 0" with ".empty()". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/browser/process_info_snapshot.h" 5 #include "chrome/browser/process_info_snapshot.h"
6 6
7 #include <sys/sysctl.h> 7 #include <sys/sysctl.h>
8 8
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 size_t i; 242 size_t i;
243 for (i = 0; i < arraysize(values); i++) { 243 for (i = 0; i < arraysize(values); i++) {
244 in >> values[i]; 244 in >> values[i];
245 if (in.fail()) 245 if (in.fail())
246 break; 246 break;
247 std::string unit; 247 std::string unit;
248 in >> unit; 248 in >> unit;
249 if (in.fail()) 249 if (in.fail())
250 break; 250 break;
251 251
252 if (unit.size() == 0) 252 if (unit.empty())
253 break; 253 break;
254 254
255 uint64_t scale; 255 uint64_t scale;
256 if (!ConvertByteUnitToScale(unit[0], &scale)) 256 if (!ConvertByteUnitToScale(unit[0], &scale))
257 break; 257 break;
258 values[i] *= scale; 258 values[i] *= scale;
259 } 259 }
260 if (i != arraysize(values)) 260 if (i != arraysize(values))
261 continue; 261 continue;
262 262
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 339 }
340 340
341 return true; 341 return true;
342 } 342 }
343 343
344 344
345 bool ProcessInfoSnapshot::Sample(std::vector<base::ProcessId> pid_list) { 345 bool ProcessInfoSnapshot::Sample(std::vector<base::ProcessId> pid_list) {
346 Reset(); 346 Reset();
347 347
348 // Nothing to do if no PIDs given. 348 // Nothing to do if no PIDs given.
349 if (pid_list.size() == 0) 349 if (pid_list.empty())
350 return true; 350 return true;
351 if (pid_list.size() > kMaxPidListSize) { 351 if (pid_list.size() > kMaxPidListSize) {
352 // The spec says |pid_list| *must* not have more than this many entries. 352 // The spec says |pid_list| *must* not have more than this many entries.
353 NOTREACHED(); 353 NOTREACHED();
354 return false; 354 return false;
355 } 355 }
356 356
357 // Get basic process info from KERN_PROC. 357 // Get basic process info from KERN_PROC.
358 for (std::vector<base::ProcessId>::iterator it = pid_list.begin(); 358 for (std::vector<base::ProcessId>::iterator it = pid_list.begin();
359 it != pid_list.end(); ++it) { 359 it != pid_list.end(); ++it) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 ws_usage->shareable = 0; 456 ws_usage->shareable = 0;
457 ws_usage->shared = 0; 457 ws_usage->shared = 0;
458 return false; 458 return false;
459 } 459 }
460 460
461 ws_usage->priv = proc_info.rprvt / 1024; 461 ws_usage->priv = proc_info.rprvt / 1024;
462 ws_usage->shareable = proc_info.rss / 1024; 462 ws_usage->shareable = proc_info.rss / 1024;
463 ws_usage->shared = proc_info.rshrd / 1024; 463 ws_usage->shared = proc_info.rshrd / 1024;
464 return true; 464 return true;
465 } 465 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698