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

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/RTCMediaConstraints.mm

Issue 1937693002: Replace scoped_ptr with unique_ptr everywhere (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@unique5
Patch Set: Created 4 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #import "RTCMediaConstraints+Private.h" 11 #import "RTCMediaConstraints+Private.h"
12 12
13 #import "NSString+StdString.h" 13 #import "NSString+StdString.h"
14 14
15 #include <memory>
16
15 namespace webrtc { 17 namespace webrtc {
16 18
17 MediaConstraints::~MediaConstraints() {} 19 MediaConstraints::~MediaConstraints() {}
18 20
19 MediaConstraints::MediaConstraints() {} 21 MediaConstraints::MediaConstraints() {}
20 22
21 MediaConstraints::MediaConstraints( 23 MediaConstraints::MediaConstraints(
22 const MediaConstraintsInterface::Constraints& mandatory, 24 const MediaConstraintsInterface::Constraints& mandatory,
23 const MediaConstraintsInterface::Constraints& optional) 25 const MediaConstraintsInterface::Constraints& optional)
24 : mandatory_(mandatory), optional_(optional) {} 26 : mandatory_(mandatory), optional_(optional) {}
(...skipping 30 matching lines...) Expand all
55 } 57 }
56 58
57 - (NSString *)description { 59 - (NSString *)description {
58 return [NSString stringWithFormat:@"RTCMediaConstraints:\n%@\n%@", 60 return [NSString stringWithFormat:@"RTCMediaConstraints:\n%@\n%@",
59 _mandatory, 61 _mandatory,
60 _optional]; 62 _optional];
61 } 63 }
62 64
63 #pragma mark - Private 65 #pragma mark - Private
64 66
65 - (rtc::scoped_ptr<webrtc::MediaConstraints>)nativeConstraints { 67 - (std::unique_ptr<webrtc::MediaConstraints>)nativeConstraints {
66 webrtc::MediaConstraintsInterface::Constraints mandatory = 68 webrtc::MediaConstraintsInterface::Constraints mandatory =
67 [[self class] nativeConstraintsForConstraints:_mandatory]; 69 [[self class] nativeConstraintsForConstraints:_mandatory];
68 webrtc::MediaConstraintsInterface::Constraints optional = 70 webrtc::MediaConstraintsInterface::Constraints optional =
69 [[self class] nativeConstraintsForConstraints:_optional]; 71 [[self class] nativeConstraintsForConstraints:_optional];
70 72
71 webrtc::MediaConstraints *nativeConstraints = 73 webrtc::MediaConstraints *nativeConstraints =
72 new webrtc::MediaConstraints(mandatory, optional); 74 new webrtc::MediaConstraints(mandatory, optional);
73 return rtc::scoped_ptr<webrtc::MediaConstraints>(nativeConstraints); 75 return std::unique_ptr<webrtc::MediaConstraints>(nativeConstraints);
74 } 76 }
75 77
76 + (webrtc::MediaConstraintsInterface::Constraints) 78 + (webrtc::MediaConstraintsInterface::Constraints)
77 nativeConstraintsForConstraints: 79 nativeConstraintsForConstraints:
78 (NSDictionary<NSString *, NSString *> *)constraints { 80 (NSDictionary<NSString *, NSString *> *)constraints {
79 webrtc::MediaConstraintsInterface::Constraints nativeConstraints; 81 webrtc::MediaConstraintsInterface::Constraints nativeConstraints;
80 for (NSString *key in constraints) { 82 for (NSString *key in constraints) {
81 NSAssert([key isKindOfClass:[NSString class]], 83 NSAssert([key isKindOfClass:[NSString class]],
82 @"%@ is not an NSString.", key); 84 @"%@ is not an NSString.", key);
83 NSString *value = [constraints objectForKey:key]; 85 NSString *value = [constraints objectForKey:key];
84 NSAssert([value isKindOfClass:[NSString class]], 86 NSAssert([value isKindOfClass:[NSString class]],
85 @"%@ is not an NSString.", value); 87 @"%@ is not an NSString.", value);
86 nativeConstraints.push_back(webrtc::MediaConstraintsInterface::Constraint( 88 nativeConstraints.push_back(webrtc::MediaConstraintsInterface::Constraint(
87 key.stdString, value.stdString)); 89 key.stdString, value.stdString));
88 } 90 }
89 return nativeConstraints; 91 return nativeConstraints;
90 } 92 }
91 93
92 @end 94 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698