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

Side by Side Diff: base/sys_info_mac.mm

Issue 2860663005: Implement SysInfo::HardwareModelName() on iOS. (Closed)
Patch Set: Created 3 years, 7 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
« base/sys_info_ios.mm ('K') | « base/sys_info_ios.mm ('k') | 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/sys_info.h" 5 #include "base/sys_info.h"
6 6
7 #include <ApplicationServices/ApplicationServices.h> 7 #include <ApplicationServices/ApplicationServices.h>
8 #include <CoreServices/CoreServices.h> 8 #include <CoreServices/CoreServices.h>
9 #import <Foundation/Foundation.h> 9 #import <Foundation/Foundation.h>
10 #include <mach/mach_host.h> 10 #include <mach/mach_host.h>
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 // static 95 // static
96 std::string SysInfo::CPUModelName() { 96 std::string SysInfo::CPUModelName() {
97 char name[256]; 97 char name[256];
98 size_t len = arraysize(name); 98 size_t len = arraysize(name);
99 if (sysctlbyname("machdep.cpu.brand_string", &name, &len, NULL, 0) == 0) 99 if (sysctlbyname("machdep.cpu.brand_string", &name, &len, NULL, 0) == 0)
100 return name; 100 return name;
101 return std::string(); 101 return std::string();
102 } 102 }
103 103
104 // static
104 std::string SysInfo::HardwareModelName() { 105 std::string SysInfo::HardwareModelName() {
105 char model[256]; 106 char model[256];
106 size_t len = sizeof(model); 107 size_t len = sizeof(model);
107 if (sysctlbyname("hw.model", model, &len, NULL, 0) == 0) 108 if (sysctlbyname("hw.model", model, &len, NULL, 0) == 0)
108 return std::string(model, 0, len); 109 return std::string(model, 0, len);
109 return std::string(); 110 return std::string();
110 } 111 }
111 112
112 } // namespace base 113 } // namespace base
OLDNEW
« base/sys_info_ios.mm ('K') | « base/sys_info_ios.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698