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

Unified Diff: base/sys_info_ios.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/sys_info.cc ('k') | base/sys_info_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/sys_info_ios.mm
diff --git a/base/sys_info_ios.mm b/base/sys_info_ios.mm
index 9a329b9f0924bbdefce908cd51de4a6488c574f0..7dc4effed932680d9a271609192e7d87c10fcd04 100644
--- a/base/sys_info_ios.mm
+++ b/base/sys_info_ios.mm
@@ -101,4 +101,13 @@ std::string SysInfo::CPUModelName() {
return std::string();
}
+// static
+std::string SysInfo::HardwareModelName() {
+ char model[256];
+ size_t len = sizeof(model);
+ if (sysctlbyname("hw.model", model, &len, NULL, 0) == 0)
+ return std::string(model, 0, len);
Mark Mentovai 2017/05/04 16:29:13 This is weird. I don’t think that there’s a std::s
Alexei Svitkine (slow) 2017/05/04 16:44:07 Good catch - done for both Mac and iOS and made CP
+ return std::string();
+}
+
} // namespace base
« no previous file with comments | « base/sys_info.cc ('k') | base/sys_info_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698