Replace scoped_ptr with unique_ptr in talk/

BUG=webrtc:5520

Review URL: https://codereview.webrtc.org/1785353003

Cr-Commit-Position: refs/heads/master@{#11968}
This commit is contained in:
kwiberg 2016-03-11 22:12:57 -08:00 committed by Commit bot
parent 2db1dbb2ca
commit 84cc9189fb
13 changed files with 37 additions and 23 deletions

View File

@ -32,12 +32,14 @@
#import "RTCPeerConnectionFactory+Internal.h"
#import "RTCVideoSource+Internal.h"
#include <memory>
@implementation RTCAVFoundationVideoSource
- (instancetype)initWithFactory:(RTCPeerConnectionFactory*)factory
constraints:(RTCMediaConstraints*)constraints {
NSParameterAssert(factory);
rtc::scoped_ptr<webrtc::AVFoundationVideoCapturer> capturer;
std::unique_ptr<webrtc::AVFoundationVideoCapturer> capturer;
capturer.reset(new webrtc::AVFoundationVideoCapturer());
rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> source =
factory.nativeFactory->CreateVideoSource(capturer.release(), constraints.constraints);

View File

@ -31,8 +31,9 @@
#import "RTCDataChannel+Internal.h"
#include <memory>
#include "webrtc/api/datachannelinterface.h"
#include "webrtc/base/scoped_ptr.h"
namespace webrtc {
@ -146,7 +147,7 @@ std::string StdStringFromNSString(NSString* nsString) {
@end
@implementation RTCDataBuffer {
rtc::scoped_ptr<webrtc::DataBuffer> _dataBuffer;
std::unique_ptr<webrtc::DataBuffer> _dataBuffer;
}
- (instancetype)initWithData:(NSData*)data isBinary:(BOOL)isBinary {
@ -187,7 +188,7 @@ std::string StdStringFromNSString(NSString* nsString) {
@implementation RTCDataChannel {
rtc::scoped_refptr<webrtc::DataChannelInterface> _dataChannel;
rtc::scoped_ptr<webrtc::RTCDataChannelObserver> _observer;
std::unique_ptr<webrtc::RTCDataChannelObserver> _observer;
BOOL _isObserverRegistered;
}

View File

@ -27,11 +27,12 @@
#import "RTCI420Frame.h"
#include <memory>
#include "webrtc/media/base/videoframe.h"
#include "webrtc/base/scoped_ptr.h"
@implementation RTCI420Frame {
rtc::scoped_ptr<cricket::VideoFrame> _videoFrame;
std::unique_ptr<cricket::VideoFrame> _videoFrame;
}
- (NSUInteger)width {

View File

@ -33,13 +33,13 @@
#import "RTCPair.h"
#include "webrtc/base/scoped_ptr.h"
#include <memory>
// TODO(hughv): Add accessors for mandatory and optional constraints.
// TODO(hughv): Add description.
@implementation RTCMediaConstraints {
rtc::scoped_ptr<webrtc::RTCMediaConstraintsNative> _constraints;
std::unique_ptr<webrtc::RTCMediaConstraintsNative> _constraints;
webrtc::MediaConstraintsInterface::Constraints _mandatory;
webrtc::MediaConstraintsInterface::Constraints _optional;
}

View File

@ -32,6 +32,8 @@
#import "RTCEnumConverter.h"
#import "RTCMediaStreamTrack+Internal.h"
#include <memory>
namespace webrtc {
class RTCMediaStreamTrackObserver : public ObserverInterface {
@ -49,7 +51,7 @@ class RTCMediaStreamTrackObserver : public ObserverInterface {
@implementation RTCMediaStreamTrack {
rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> _mediaTrack;
rtc::scoped_ptr<webrtc::RTCMediaStreamTrackObserver> _observer;
std::unique_ptr<webrtc::RTCMediaStreamTrackObserver> _observer;
}
@synthesize label;

View File

@ -33,7 +33,7 @@
#include <string.h>
#include "webrtc/base/scoped_ptr.h"
#include <memory>
#if TARGET_OS_IPHONE
#import <OpenGLES/ES3/gl.h>
@ -184,7 +184,7 @@ static const GLsizei kNumTextures = 3 * kNumTextureSets;
GLint _vSampler;
// Used to create a non-padded plane for GPU upload when we receive padded
// frames.
rtc::scoped_ptr<uint8_t[]> _planeBuffer;
std::unique_ptr<uint8_t[]> _planeBuffer;
}
+ (void)initialize {

View File

@ -45,6 +45,8 @@
#import "RTCStatsDelegate.h"
#import "RTCStatsReport+Internal.h"
#include <memory>
#include "webrtc/api/jsep.h"
NSString* const kRTCSessionDescriptionDelegateErrorDomain = @"RTCSDPError";
@ -141,12 +143,12 @@ class RTCStatsObserver : public StatsObserver {
@implementation RTCPeerConnection {
NSMutableArray* _localStreams;
rtc::scoped_ptr<webrtc::RTCPeerConnectionObserver> _observer;
std::unique_ptr<webrtc::RTCPeerConnectionObserver> _observer;
rtc::scoped_refptr<webrtc::PeerConnectionInterface> _peerConnection;
}
- (BOOL)addICECandidate:(RTCICECandidate*)candidate {
rtc::scoped_ptr<const webrtc::IceCandidateInterface> iceCandidate(
std::unique_ptr<const webrtc::IceCandidateInterface> iceCandidate(
candidate.candidate);
return self.peerConnection->AddIceCandidate(iceCandidate.get());
}

View File

@ -28,7 +28,6 @@
#import "RTCPeerConnectionFactory.h"
#include "webrtc/api/peerconnectionfactory.h"
#include "webrtc/base/scoped_ptr.h"
@interface RTCPeerConnectionFactory ()

View File

@ -31,6 +31,7 @@
#import "RTCPeerConnectionFactory+Internal.h"
#include <memory>
#include <vector>
#import "RTCAudioTrack+Internal.h"
@ -55,8 +56,8 @@
#include "webrtc/base/ssladapter.h"
@implementation RTCPeerConnectionFactory {
rtc::scoped_ptr<rtc::Thread> _signalingThread;
rtc::scoped_ptr<rtc::Thread> _workerThread;
std::unique_ptr<rtc::Thread> _signalingThread;
std::unique_ptr<rtc::Thread> _workerThread;
}
@synthesize nativeFactory = _nativeFactory;

View File

@ -31,6 +31,8 @@
#import "talk/app/webrtc/objc/RTCICEServer+Internal.h"
#import "talk/app/webrtc/objc/public/RTCLogging.h"
#include <memory>
@implementation RTCConfiguration
@synthesize iceTransportsType = _iceTransportsType;
@ -95,11 +97,12 @@
nativeConfig.ice_connection_receiving_timeout = _iceConnectionReceivingTimeout;
nativeConfig.ice_backup_candidate_pair_ping_interval = _iceBackupCandidatePairPingInterval;
if (_keyType == kRTCEncryptionKeyTypeECDSA) {
rtc::scoped_ptr<rtc::SSLIdentity> identity(
std::unique_ptr<rtc::SSLIdentity> identity(
rtc::SSLIdentity::Generate(webrtc::kIdentityName, rtc::KT_ECDSA));
if (identity) {
nativeConfig.certificates.push_back(
rtc::RTCCertificate::Create(std::move(identity)));
rtc::RTCCertificate::Create(
rtc::UniqueToScoped(std::move(identity))));
} else {
RTCLogWarning(@"Failed to generate ECDSA identity. RSA will be used.");
}

View File

@ -31,16 +31,18 @@
#import "RTCVideoCapturer+Internal.h"
#include <memory>
#include "webrtc/media/base/videocapturer.h"
#include "webrtc/media/devices/devicemanager.h"
@implementation RTCVideoCapturer {
rtc::scoped_ptr<cricket::VideoCapturer> _capturer;
std::unique_ptr<cricket::VideoCapturer> _capturer;
}
+ (RTCVideoCapturer*)capturerWithDeviceName:(NSString*)deviceName {
const std::string& device_name = std::string([deviceName UTF8String]);
rtc::scoped_ptr<cricket::DeviceManagerInterface> device_manager(
std::unique_ptr<cricket::DeviceManagerInterface> device_manager(
cricket::DeviceManagerFactory::Create());
bool initialized = device_manager->Init();
NSAssert(initialized, @"DeviceManager::Init() failed");
@ -49,7 +51,7 @@
LOG(LS_ERROR) << "GetVideoCaptureDevice failed";
return 0;
}
rtc::scoped_ptr<cricket::VideoCapturer> capturer(
std::unique_ptr<cricket::VideoCapturer> capturer(
device_manager->CreateVideoCapturer(device));
RTCVideoCapturer* rtcCapturer =
[[RTCVideoCapturer alloc] initWithCapturer:capturer.release()];

View File

@ -32,6 +32,8 @@
#import "RTCI420Frame+Internal.h"
#import "RTCVideoRendererAdapter.h"
#include <memory>
namespace webrtc {
class RTCVideoRendererNativeAdapter : public VideoRendererInterface {
@ -60,7 +62,7 @@ class RTCVideoRendererNativeAdapter : public VideoRendererInterface {
@implementation RTCVideoRendererAdapter {
id<RTCVideoRenderer> _videoRenderer;
rtc::scoped_ptr<webrtc::RTCVideoRendererNativeAdapter> _adapter;
std::unique_ptr<webrtc::RTCVideoRendererNativeAdapter> _adapter;
}
- (instancetype)initWithVideoRenderer:(id<RTCVideoRenderer>)videoRenderer {

View File

@ -28,7 +28,6 @@
#ifndef TALK_APP_WEBRTC_OBJC_AVFOUNDATION_VIDEO_CAPTURER_H_
#define TALK_APP_WEBRTC_OBJC_AVFOUNDATION_VIDEO_CAPTURER_H_
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/media/base/videocapturer.h"
#include "webrtc/video_frame.h"