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

Side by Side Diff: webrtc/api/objc/RTCStats.mm

Issue 1540113002: Update API for Objective-C RTCStats. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@updateRTCIceCandidate
Patch Set: Created 5 years 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 unified diff | Download patch
OLDNEW
(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 RTCIceServer
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 NSParameterAsser(stats);
35 if (self = [super init]) {
36 _timestamp = stats.timestamp();
37 _type = [NSString stringForStdString:stats.TypeToString()];
38 _id = [NSString stringForStdString:stats.id()->ToString()];
39
40 NSMutableDictionary *values =
41 [NSMutableDictionary dictionaryWithCapacity:stats.values().size()];
42 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.
43 NSString *key = [NSString stringForStdString:it.second->display_name()];
44 NSString *value = [NSString stringForStdString:it.second->ToString()];
45 values[key] = value;
46 }
47 _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.
48 }
49 return self;
50 }
51
52 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698