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

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/RTCDataChannel.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
« no previous file with comments | « webrtc/pc/yuvscaler_unittest.cc ('k') | webrtc/sdk/objc/Framework/Classes/RTCFileLogger.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "RTCDataChannel+Private.h" 11 #import "RTCDataChannel+Private.h"
12 12
13 #import "NSString+StdString.h" 13 #import "NSString+StdString.h"
14 14
15 #include "webrtc/base/scoped_ptr.h" 15 #include <memory>
16 16
17 namespace webrtc { 17 namespace webrtc {
18 18
19 class DataChannelDelegateAdapter : public DataChannelObserver { 19 class DataChannelDelegateAdapter : public DataChannelObserver {
20 public: 20 public:
21 DataChannelDelegateAdapter(RTCDataChannel *channel) { channel_ = channel; } 21 DataChannelDelegateAdapter(RTCDataChannel *channel) { channel_ = channel; }
22 22
23 void OnStateChange() override { 23 void OnStateChange() override {
24 [channel_.delegate dataChannelDidChangeState:channel_]; 24 [channel_.delegate dataChannelDidChangeState:channel_];
25 } 25 }
(...skipping 13 matching lines...) Expand all
39 } 39 }
40 } 40 }
41 41
42 private: 42 private:
43 __weak RTCDataChannel *channel_; 43 __weak RTCDataChannel *channel_;
44 }; 44 };
45 } 45 }
46 46
47 47
48 @implementation RTCDataBuffer { 48 @implementation RTCDataBuffer {
49 rtc::scoped_ptr<webrtc::DataBuffer> _dataBuffer; 49 std::unique_ptr<webrtc::DataBuffer> _dataBuffer;
50 } 50 }
51 51
52 - (instancetype)initWithData:(NSData *)data isBinary:(BOOL)isBinary { 52 - (instancetype)initWithData:(NSData *)data isBinary:(BOOL)isBinary {
53 NSParameterAssert(data); 53 NSParameterAssert(data);
54 if (self = [super init]) { 54 if (self = [super init]) {
55 rtc::CopyOnWriteBuffer buffer( 55 rtc::CopyOnWriteBuffer buffer(
56 reinterpret_cast<const uint8_t*>(data.bytes), data.length); 56 reinterpret_cast<const uint8_t*>(data.bytes), data.length);
57 _dataBuffer.reset(new webrtc::DataBuffer(buffer, isBinary)); 57 _dataBuffer.reset(new webrtc::DataBuffer(buffer, isBinary));
58 } 58 }
59 return self; 59 return self;
(...skipping 19 matching lines...) Expand all
79 79
80 - (const webrtc::DataBuffer *)nativeDataBuffer { 80 - (const webrtc::DataBuffer *)nativeDataBuffer {
81 return _dataBuffer.get(); 81 return _dataBuffer.get();
82 } 82 }
83 83
84 @end 84 @end
85 85
86 86
87 @implementation RTCDataChannel { 87 @implementation RTCDataChannel {
88 rtc::scoped_refptr<webrtc::DataChannelInterface> _nativeDataChannel; 88 rtc::scoped_refptr<webrtc::DataChannelInterface> _nativeDataChannel;
89 rtc::scoped_ptr<webrtc::DataChannelDelegateAdapter> _observer; 89 std::unique_ptr<webrtc::DataChannelDelegateAdapter> _observer;
90 BOOL _isObserverRegistered; 90 BOOL _isObserverRegistered;
91 } 91 }
92 92
93 @synthesize delegate = _delegate; 93 @synthesize delegate = _delegate;
94 94
95 - (void)dealloc { 95 - (void)dealloc {
96 // Handles unregistering the observer properly. We need to do this because 96 // Handles unregistering the observer properly. We need to do this because
97 // there may still be other references to the underlying data channel. 97 // there may still be other references to the underlying data channel.
98 self.delegate = nil; 98 self.delegate = nil;
99 } 99 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 case RTCDataChannelStateOpen: 225 case RTCDataChannelStateOpen:
226 return @"Open"; 226 return @"Open";
227 case RTCDataChannelStateClosing: 227 case RTCDataChannelStateClosing:
228 return @"Closing"; 228 return @"Closing";
229 case RTCDataChannelStateClosed: 229 case RTCDataChannelStateClosed:
230 return @"Closed"; 230 return @"Closed";
231 } 231 }
232 } 232 }
233 233
234 @end 234 @end
OLDNEW
« no previous file with comments | « webrtc/pc/yuvscaler_unittest.cc ('k') | webrtc/sdk/objc/Framework/Classes/RTCFileLogger.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698