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

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: Changes based on feedback Created 4 years, 11 months 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
« no previous file with comments | « webrtc/api/objc/RTCStats.h ('k') | webrtc/api/objc/RTCStats+Private.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #import "webrtc/base/objc/RTCLogging.h"
16
17 @implementation RTCStats
18
19 @synthesize timestamp = _timestamp;
20 @synthesize type = _type;
21 @synthesize statsId = _statsId;
22 @synthesize values = _values;
23
24 - (NSString *)description {
25 return [NSString stringWithFormat:@"RTCStats:\n%@\n%@\n%f\n%@",
26 _statsId,
27 _type,
28 _timestamp,
29 _values];
30 }
31
32 #pragma mark - Private
33
34 - (instancetype)initWithStatsReport:(const webrtc::StatsReport &)stats {
35 if (self = [super init]) {
36 _timestamp = stats.timestamp();
37 _type = [NSString stringForStdString:stats.TypeToString()];
38 _statsId = [NSString stringForStdString:stats.id()->ToString()];
39
40 NSMutableDictionary *values =
41 [NSMutableDictionary dictionaryWithCapacity:stats.values().size()];
42 for (auto const &valuePair : stats.values()) {
43 NSString *key = [NSString stringForStdString:
44 valuePair.second->display_name()];
45 NSString *value = [NSString stringForStdString:
46 valuePair.second->ToString()];
47
48 if ([values objectForKey:key]) {
49 RTCLogWarning(@"The |key| already exists in this stats report: %@",
hjon 2016/01/06 00:39:14 tkchin@ Is this the kind of logging you had in min
50 key);
51 }
52
53 values[key] = value;
54 }
55 _values = [values copy];
56 }
57 return self;
58 }
59
60 @end
OLDNEW
« no previous file with comments | « webrtc/api/objc/RTCStats.h ('k') | webrtc/api/objc/RTCStats+Private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698