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

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

Issue 2843463003: Fix a compilation error with 10.11 SDK. (Closed)
Patch Set: Created 3 years, 8 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 | no next file » | 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/mach.h> 7 #include <mach/mach.h>
8 #include <mach/mach_vm.h> 8 #include <mach/mach_vm.h>
9 #include <mach/shared_region.h> 9 #include <mach/shared_region.h>
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 mach_vm_size_t reusable; 43 mach_vm_size_t reusable;
44 mach_vm_size_t reusable_peak; 44 mach_vm_size_t reusable_peak;
45 mach_vm_size_t purgeable_volatile_pmap; 45 mach_vm_size_t purgeable_volatile_pmap;
46 mach_vm_size_t purgeable_volatile_resident; 46 mach_vm_size_t purgeable_volatile_resident;
47 mach_vm_size_t purgeable_volatile_virtual; 47 mach_vm_size_t purgeable_volatile_virtual;
48 mach_vm_size_t compressed; 48 mach_vm_size_t compressed;
49 mach_vm_size_t compressed_peak; 49 mach_vm_size_t compressed_peak;
50 mach_vm_size_t compressed_lifetime; 50 mach_vm_size_t compressed_lifetime;
51 mach_vm_size_t phys_footprint; 51 mach_vm_size_t phys_footprint;
52 }; 52 };
53 #else
54 using ChromeTaskVMInfo = task_vm_info;
55 #endif // MAC_OS_X_VERSION_10_11
53 mach_msg_type_number_t ChromeTaskVMInfoCount = 56 mach_msg_type_number_t ChromeTaskVMInfoCount =
54 sizeof(ChromeTaskVMInfo) / sizeof(natural_t); 57 sizeof(ChromeTaskVMInfo) / sizeof(natural_t);
55 #else
56 using ChromeTaskVMInfo = task_vm_info;
57 mach_msg_type_number_t ChromeTaskVMInfoCount = TASK_VM_INFO_REV1_COUNT;
58 #endif // MAC_OS_X_VERSION_10_11
59 58
60 bool GetTaskInfo(mach_port_t task, task_basic_info_64* task_info_data) { 59 bool GetTaskInfo(mach_port_t task, task_basic_info_64* task_info_data) {
61 if (task == MACH_PORT_NULL) 60 if (task == MACH_PORT_NULL)
62 return false; 61 return false;
63 mach_msg_type_number_t count = TASK_BASIC_INFO_64_COUNT; 62 mach_msg_type_number_t count = TASK_BASIC_INFO_64_COUNT;
64 kern_return_t kr = task_info(task, 63 kern_return_t kr = task_info(task,
65 TASK_BASIC_INFO_64, 64 TASK_BASIC_INFO_64,
66 reinterpret_cast<task_info_t>(task_info_data), 65 reinterpret_cast<task_info_t>(task_info_data),
67 &count); 66 &count);
68 // Most likely cause for failure: |task| is a zombie. 67 // Most likely cause for failure: |task| is a zombie.
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 task, address, size, VM_REGION_BASIC_INFO_64, 495 task, address, size, VM_REGION_BASIC_INFO_64,
497 reinterpret_cast<vm_region_info_t>(info), &info_count, &object_name); 496 reinterpret_cast<vm_region_info_t>(info), &info_count, &object_name);
498 // The kernel always returns a null object for VM_REGION_BASIC_INFO_64, but 497 // The kernel always returns a null object for VM_REGION_BASIC_INFO_64, but
499 // balance it with a deallocate in case this ever changes. See 10.9.2 498 // balance it with a deallocate in case this ever changes. See 10.9.2
500 // xnu-2422.90.20/osfmk/vm/vm_map.c vm_map_region. 499 // xnu-2422.90.20/osfmk/vm/vm_map.c vm_map_region.
501 mach_port_deallocate(task, object_name); 500 mach_port_deallocate(task, object_name);
502 return ParseOutputFromMachVMRegion(kr); 501 return ParseOutputFromMachVMRegion(kr);
503 } 502 }
504 503
505 } // namespace base 504 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698