Chromium Code Reviews| Index: webrtc/api/objc/RTCStats.mm | 
| diff --git a/webrtc/api/objc/RTCStats.mm b/webrtc/api/objc/RTCStats.mm | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..a2d724fc397ca330e172b7bd913869adc4f5ce0d | 
| --- /dev/null | 
| +++ b/webrtc/api/objc/RTCStats.mm | 
| @@ -0,0 +1,52 @@ | 
| +/* | 
| + * Copyright 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 | 
| + * tree. An additional intellectual property rights grant can be found | 
| + * in the file PATENTS. All contributing project authors may | 
| + * be found in the AUTHORS file in the root of the source tree. | 
| + */ | 
| + | 
| +#import "RTCStats.h" | 
| + | 
| +#import "webrtc/api/objc/RTCStats+Private.h" | 
| +#import "webrtc/base/objc/NSString+StdString.h" | 
| + | 
| +@implementation RTCIceServer | 
| + | 
| +@synthesize timestamp = _timestamp; | 
| +@synthesize type = _type; | 
| +@synthesize id = _id; | 
| +@synthesize values = _values; | 
| + | 
| +- (NSString *)description { | 
| + return [NSString stringWithFormat:@"RTCStats:\n%@\n%@\n%f\n%@", | 
| + _id, | 
| + _type, | 
| + _timestamp, | 
| + _values]; | 
| +} | 
| + | 
| +#pragma mark - Private | 
| + | 
| +- (instancetype)initWithStatsReport:(const webrtc::StatsReport &)stats { | 
| + NSParameterAsser(stats); | 
| + if (self = [super init]) { | 
| + _timestamp = stats.timestamp(); | 
| + _type = [NSString stringForStdString:stats.TypeToString()]; | 
| + _id = [NSString stringForStdString:stats.id()->ToString()]; | 
| + | 
| + NSMutableDictionary *values = | 
| + [NSMutableDictionary dictionaryWithCapacity:stats.values().size()]; | 
| + for (auto const &it : stats.values()) { | 
| 
 
tkchin_webrtc
2015/12/21 12:57:13
nit: auto const &valuePair : stats.values()
it's a
 
hjon
2015/12/21 22:02:53
Done.
 
 | 
| + NSString *key = [NSString stringForStdString:it.second->display_name()]; | 
| + NSString *value = [NSString stringForStdString:it.second->ToString()]; | 
| + values[key] = value; | 
| + } | 
| + _values = values; | 
| 
 
tkchin_webrtc
2015/12/21 12:57:13
suggest turning this into an immutable NSDictionar
 
hjon
2015/12/21 22:02:53
Done.
 
 | 
| + } | 
| + return self; | 
| +} | 
| + | 
| +@end |