| Index: webrtc/modules/utility/source/helpers_ios.mm
|
| diff --git a/webrtc/test/testsupport/iosfileutils.mm b/webrtc/modules/utility/source/helpers_ios.mm
|
| similarity index 54%
|
| copy from webrtc/test/testsupport/iosfileutils.mm
|
| copy to webrtc/modules/utility/source/helpers_ios.mm
|
| index f3615ed6814b41a696fd04da166a96a59237c2a9..9c1a44b92d1fa5eb3c7e50dcb3e9346c414f6f08 100644
|
| --- a/webrtc/test/testsupport/iosfileutils.mm
|
| +++ b/webrtc/modules/utility/source/helpers_ios.mm
|
| @@ -1,5 +1,5 @@
|
| /*
|
| - * Copyright 2015 The WebRTC Project Authors. All rights reserved.
|
| + * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
|
| *
|
| * Use of this source code is governed by a BSD-style license
|
| * that can be found in the LICENSE file in the root of the source
|
| @@ -10,18 +10,14 @@
|
|
|
| #if defined(WEBRTC_IOS)
|
|
|
| -#if !defined(__has_feature) || !__has_feature(objc_arc)
|
| -#error "This file requires ARC support."
|
| -#endif
|
| -
|
| #import <Foundation/Foundation.h>
|
| -#include <string.h>
|
| +#include <pthread.h>
|
|
|
| #include "webrtc/base/checks.h"
|
| -#include "webrtc/typedefs.h"
|
| +#include "webrtc/modules/utility/interface/helpers_ios.h"
|
|
|
| namespace webrtc {
|
| -namespace test {
|
| +namespace ios {
|
|
|
| // TODO(henrika): move to shared location.
|
| // See https://code.google.com/p/webrtc/issues/detail?id=4773 for details.
|
| @@ -39,22 +35,31 @@ std::string StdStringFromNSString(NSString* nsString) {
|
| [charData length]);
|
| }
|
|
|
| -// For iOS, resource files are added to the application bundle in the root
|
| -// and not in separate folders as is the case for other platforms. This method
|
| -// therefore removes any prepended folders and uses only the actual file name.
|
| -std::string IOSResourcePath(std::string name, std::string extension) {
|
| - @autoreleasepool {
|
| - NSString* path = NSStringFromStdString(name);
|
| - NSString* fileName = path.lastPathComponent;
|
| - NSString* fileType = NSStringFromStdString(extension);
|
| - // Get full pathname for the resource identified by the name and extension.
|
| - NSString* pathString = [[NSBundle mainBundle] pathForResource:fileName
|
| - ofType:fileType];
|
| - return StdStringFromNSString(pathString);
|
| +void CheckAndLogError(BOOL success, NSError* error) {
|
| + if (!success) {
|
| + NSLog(@"Error: %ld, %@", (long)error.code, error.localizedDescription);
|
| }
|
| }
|
|
|
| -} // namespace test
|
| +std::string GetCurrentThreadDescription() {
|
| + NSString* name = [NSString stringWithFormat:@"%@", [NSThread currentThread]];
|
| + return StdStringFromNSString(name);
|
| +}
|
| +
|
| +std::string GetThreadId() {
|
| + char buf[21]; // Big enough to hold a kuint64max plus terminating NULL.
|
| + pid_t thread_id = pthread_mach_thread_np(pthread_self());
|
| + CHECK_LT(snprintf(buf, sizeof(buf), "%i", thread_id),
|
| + static_cast<int>(sizeof(buf)))
|
| + << "Thread id is bigger than uint64??";
|
| + return std::string(buf);
|
| +}
|
| +
|
| +std::string GetThreadInfo() {
|
| + return "@[tid=" + GetThreadId() + "]";
|
| +}
|
| +
|
| +} // namespace ios
|
| } // namespace webrtc
|
|
|
| #endif // defined(WEBRTC_IOS)
|
|
|