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

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

Issue 19064002: Split ProcessHandle and its related routines into base/process/process_handle.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ready for review 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/process_metrics.h ('k') | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_metrics.h" 5 #include "base/process/process_metrics.h"
6 6
7 #include <mach/task.h> 7 #include <mach/task.h>
8 8
9 namespace base { 9 namespace base {
10 10
(...skipping 26 matching lines...) Expand all
37 return task_info_data.virtual_size; 37 return task_info_data.virtual_size;
38 } 38 }
39 39
40 size_t ProcessMetrics::GetWorkingSetSize() const { 40 size_t ProcessMetrics::GetWorkingSetSize() const {
41 task_basic_info_64 task_info_data; 41 task_basic_info_64 task_info_data;
42 if (!GetTaskInfo(&task_info_data)) 42 if (!GetTaskInfo(&task_info_data))
43 return 0; 43 return 0;
44 return task_info_data.resident_size; 44 return task_info_data.resident_size;
45 } 45 }
46 46
47 size_t GetMaxFds() {
48 static const rlim_t kSystemDefaultMaxFds = 256;
49 rlim_t max_fds;
50 struct rlimit nofile;
51 if (getrlimit(RLIMIT_NOFILE, &nofile)) {
52 // Error case: Take a best guess.
53 max_fds = kSystemDefaultMaxFds;
54 } else {
55 max_fds = nofile.rlim_cur;
56 }
57
58 if (max_fds > INT_MAX)
59 max_fds = INT_MAX;
60
61 return static_cast<size_t>(max_fds);
62 }
63
47 } // namespace base 64 } // namespace base
OLDNEW
« no previous file with comments | « base/process/process_metrics.h ('k') | base/process/process_metrics_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698