OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #if defined(WEBRTC_IOS) | 11 #if defined(WEBRTC_IOS) |
12 | 12 |
13 #import <AVFoundation/AVFoundation.h> | 13 #import <AVFoundation/AVFoundation.h> |
14 #import <Foundation/Foundation.h> | 14 #import <Foundation/Foundation.h> |
15 #import <sys/sysctl.h> | 15 #import <sys/sysctl.h> |
16 #import <UIKit/UIKit.h> | 16 #import <UIKit/UIKit.h> |
17 | 17 |
| 18 #include <memory> |
| 19 |
18 #include "webrtc/base/checks.h" | 20 #include "webrtc/base/checks.h" |
19 #include "webrtc/base/logging.h" | 21 #include "webrtc/base/logging.h" |
20 #include "webrtc/base/scoped_ptr.h" | |
21 #include "webrtc/modules/utility/include/helpers_ios.h" | 22 #include "webrtc/modules/utility/include/helpers_ios.h" |
22 | 23 |
23 namespace webrtc { | 24 namespace webrtc { |
24 namespace ios { | 25 namespace ios { |
25 | 26 |
26 bool isOperatingSystemAtLeastVersion(double version) { | 27 bool isOperatingSystemAtLeastVersion(double version) { |
27 return GetSystemVersion() >= version; | 28 return GetSystemVersion() >= version; |
28 } | 29 } |
29 | 30 |
30 // Internal helper method used by GetDeviceName() to return device name. | 31 // Internal helper method used by GetDeviceName() to return device name. |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 } | 146 } |
146 | 147 |
147 std::string GetDeviceType() { | 148 std::string GetDeviceType() { |
148 NSString* deviceModel = [[UIDevice currentDevice] model]; | 149 NSString* deviceModel = [[UIDevice currentDevice] model]; |
149 return StdStringFromNSString(deviceModel); | 150 return StdStringFromNSString(deviceModel); |
150 } | 151 } |
151 | 152 |
152 std::string GetDeviceName() { | 153 std::string GetDeviceName() { |
153 size_t size; | 154 size_t size; |
154 sysctlbyname("hw.machine", NULL, &size, NULL, 0); | 155 sysctlbyname("hw.machine", NULL, &size, NULL, 0); |
155 rtc::scoped_ptr<char[]> machine; | 156 std::unique_ptr<char[]> machine; |
156 machine.reset(new char[size]); | 157 machine.reset(new char[size]); |
157 sysctlbyname("hw.machine", machine.get(), &size, NULL, 0); | 158 sysctlbyname("hw.machine", machine.get(), &size, NULL, 0); |
158 return std::string(LookUpRealName(machine.get())); | 159 return std::string(LookUpRealName(machine.get())); |
159 } | 160 } |
160 | 161 |
161 std::string GetProcessName() { | 162 std::string GetProcessName() { |
162 NSString* processName = [NSProcessInfo processInfo].processName; | 163 NSString* processName = [NSProcessInfo processInfo].processName; |
163 return StdStringFromNSString(processName); | 164 return StdStringFromNSString(processName); |
164 } | 165 } |
165 | 166 |
(...skipping 20 matching lines...) Expand all Loading... |
186 LOG(LS_WARNING) << "webrtc::ios::GetLowPowerModeEnabled() is not " | 187 LOG(LS_WARNING) << "webrtc::ios::GetLowPowerModeEnabled() is not " |
187 "supported. Requires at least iOS 9.0"; | 188 "supported. Requires at least iOS 9.0"; |
188 return false; | 189 return false; |
189 } | 190 } |
190 #endif | 191 #endif |
191 | 192 |
192 } // namespace ios | 193 } // namespace ios |
193 } // namespace webrtc | 194 } // namespace webrtc |
194 | 195 |
195 #endif // defined(WEBRTC_IOS) | 196 #endif // defined(WEBRTC_IOS) |
OLD | NEW |