Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | |
| 3 * | |
| 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 | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 #import "RTCStats.h" | |
| 12 | |
| 13 #import "webrtc/api/objc/RTCStats+Private.h" | |
| 14 #import "webrtc/base/objc/NSString+StdString.h" | |
| 15 | |
| 16 @implementation RTCStats | |
| 17 | |
| 18 @synthesize timestamp = _timestamp; | |
| 19 @synthesize type = _type; | |
| 20 @synthesize id = _id; | |
| 21 @synthesize values = _values; | |
| 22 | |
| 23 - (NSString *)description { | |
| 24 return [NSString stringWithFormat:@"RTCStats:\n%@\n%@\n%f\n%@", | |
| 25 _id, | |
| 26 _type, | |
| 27 _timestamp, | |
| 28 _values]; | |
| 29 } | |
| 30 | |
| 31 #pragma mark - Private | |
| 32 | |
| 33 - (instancetype)initWithStatsReport:(const webrtc::StatsReport &)stats { | |
| 34 if (self = [super init]) { | |
| 35 _timestamp = stats.timestamp(); | |
| 36 _type = [NSString stringForStdString:stats.TypeToString()]; | |
| 37 _id = [NSString stringForStdString:stats.id()->ToString()]; | |
| 38 | |
| 39 NSMutableDictionary *values = | |
| 40 [NSMutableDictionary dictionaryWithCapacity:stats.values().size()]; | |
| 41 for (auto const &valuePair : stats.values()) { | |
| 42 NSString *key = [NSString stringForStdString: | |
| 43 valuePair.second->display_name()]; | |
| 44 NSString *value = [NSString stringForStdString: | |
| 45 valuePair.second->ToString()]; | |
| 46 values[key] = value; | |
|
tkchin_webrtc
2016/01/05 20:08:17
Per other CR, there may be a problem here with rep
hjon
2016/01/06 00:39:14
Done.
| |
| 47 } | |
| 48 _values = [NSDictionary dictionaryWithDictionary:values]; | |
| 49 } | |
| 50 return self; | |
| 51 } | |
| 52 | |
| 53 @end | |
| OLD | NEW |