Restore type attributes and remove extraneous nullability annotations for Objective-C Mac build

BUG=webrtc:5592
R=tkchin@webrtc.org

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

Patch from Jon Hjelle <hjon@andyet.net>.

Cr-Commit-Position: refs/heads/master@{#11922}
This commit is contained in:
Jon Hjelle 2016-03-08 16:04:46 -08:00 committed by Zeke Chin
parent 7e74994977
commit 32e0c01b33
14 changed files with 66 additions and 113 deletions

View File

@ -12,8 +12,6 @@
@class RTCIceServer;
// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592
/**
* Represents the ice transport policy. This exposes the same states in C++,
* which include one more state than what exists in the W3C spec.
@ -55,8 +53,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface RTCConfiguration : NSObject
/** An array of Ice Servers available to be used by ICE. */
@property(nonatomic, copy, nonnull) NSArray *iceServers;
// @property(nonatomic, copy) NSArray<RTCIceServer *> *iceServers;
@property(nonatomic, copy) NSArray<RTCIceServer *> *iceServers;
/** Which candidates the ICE agent is allowed to use. The W3C calls it
* |iceTransportPolicy|, while in C++ it is called |type|. */
@ -75,7 +72,7 @@ NS_ASSUME_NONNULL_BEGIN
/** Key type used to generate SSL identity. Default is ECDSA. */
@property(nonatomic, assign) RTCEncryptionKeyType keyType;
- (nonnull instancetype)init NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_DESIGNATED_INITIALIZER;
@end

View File

@ -11,7 +11,6 @@
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592
@interface RTCIceCandidate : NSObject
@ -28,16 +27,16 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSInteger sdpMLineIndex;
/** The SDP string for this candidate. */
@property(nonatomic, readonly, nonnull) NSString *sdp;
@property(nonatomic, readonly) NSString *sdp;
- (nonnull instancetype)init NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;
/**
* Initialize an RTCIceCandidate from SDP.
*/
- (nonnull instancetype)initWithSdp:(nonnull NSString *)sdp
sdpMLineIndex:(NSInteger)sdpMLineIndex
sdpMid:(nullable NSString *)sdpMid
- (instancetype)initWithSdp:(NSString *)sdp
sdpMLineIndex:(NSInteger)sdpMLineIndex
sdpMid:(nullable NSString *)sdpMid
NS_DESIGNATED_INITIALIZER;
@end

View File

@ -11,13 +11,11 @@
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592
@interface RTCIceServer : NSObject
/** URI(s) for this server represented as NSStrings. */
@property(nonatomic, readonly, nonnull) NSArray *urlStrings;
// @property(nonatomic, readonly) NSArray<NSString *> *urlStrings;
@property(nonatomic, readonly) NSArray<NSString *> *urlStrings;
/** Username to use if this RTCIceServer object is a TURN server. */
@property(nonatomic, readonly, nullable) NSString *username;
@ -28,17 +26,15 @@ NS_ASSUME_NONNULL_BEGIN
- (nonnull instancetype)init NS_UNAVAILABLE;
/** Convenience initializer for a server with no authentication (e.g. STUN). */
- (nonnull instancetype)initWithURLStrings:(nonnull NSArray *)urlStrings;
// - (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings;
- (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings;
/**
* Initialize an RTCIceServer with its associated URLs, optional username,
* optional credential, and credentialType.
*/
- (nonnull instancetype)initWithURLStrings:(nonnull NSArray *)urlStrings
// - (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings
username:(nullable NSString *)username
credential:(nullable NSString *)credential
- (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings
username:(nullable NSString *)username
credential:(nullable NSString *)credential
NS_DESIGNATED_INITIALIZER;
@end

View File

@ -14,22 +14,19 @@
#import "webrtc/base/objc/NSString+StdString.h"
@implementation RTCIceServer
// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592
@synthesize urlStrings = _urlStrings;
@synthesize username = _username;
@synthesize credential = _credential;
- (instancetype)initWithURLStrings:(NSArray *)urlStrings {
// - (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings {
- (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings {
NSParameterAssert(urlStrings.count);
return [self initWithURLStrings:urlStrings
username:nil
credential:nil];
}
- (instancetype)initWithURLStrings:(NSArray *)urlStrings
// - (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings
- (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings
username:(NSString *)username
credential:(NSString *)credential {
NSParameterAssert(urlStrings.count);

View File

@ -13,8 +13,6 @@
#include "webrtc/api/mediaconstraintsinterface.h"
#include "webrtc/base/scoped_ptr.h"
// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592
namespace webrtc {
class MediaConstraints : public MediaConstraintsInterface {
@ -48,8 +46,7 @@ NS_ASSUME_NONNULL_BEGIN
/** Return a native Constraints object representing these constraints */
+ (webrtc::MediaConstraintsInterface::Constraints)
nativeConstraintsForConstraints:
(NSDictionary *)constraints;
// (NSDictionary<NSString *, NSString *> *)constraints;
(NSDictionary<NSString *, NSString *> *)constraints;
@end

View File

@ -11,23 +11,17 @@
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592
@interface RTCMediaConstraints : NSObject
- (nonnull instancetype)init NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;
/** Initialize with mandatory and/or optional constraints. */
- (nonnull instancetype)initWithMandatoryConstraints:
(nullable NSDictionary *)mandatory
optionalConstraints:
(nullable NSDictionary *)optional
- (instancetype)initWithMandatoryConstraints:
(nullable NSDictionary<NSString *, NSString *> *)mandatory
optionalConstraints:
(nullable NSDictionary<NSString *, NSString *> *)optional
NS_DESIGNATED_INITIALIZER;
// - (instancetype)initWithMandatoryConstraints:
// (nullable NSDictionary<NSString *, NSString *> *)mandatory
// optionalConstraints:
// (nullable NSDictionary<NSString *, NSString *> *)optional
// NS_DESIGNATED_INITIALIZER;
@end

View File

@ -13,8 +13,6 @@
#import "webrtc/api/objc/RTCMediaConstraints+Private.h"
#import "webrtc/base/objc/NSString+StdString.h"
// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592
namespace webrtc {
MediaConstraints::~MediaConstraints() {}
@ -40,18 +38,14 @@ MediaConstraints::GetOptional() const {
@implementation RTCMediaConstraints {
NSDictionary *_mandatory;
// NSDictionary<NSString *, NSString *> *_mandatory;
NSDictionary *_optional;
// NSDictionary<NSString *, NSString *> *_optional;
NSDictionary<NSString *, NSString *> *_mandatory;
NSDictionary<NSString *, NSString *> *_optional;
}
- (instancetype)initWithMandatoryConstraints:
(NSDictionary *)mandatory
// (NSDictionary<NSString *, NSString *> *)mandatory
(NSDictionary<NSString *, NSString *> *)mandatory
optionalConstraints:
(NSDictionary *)optional {
// (NSDictionary<NSString *, NSString *> *)optional {
(NSDictionary<NSString *, NSString *> *)optional {
if (self = [super init]) {
_mandatory = [[NSDictionary alloc] initWithDictionary:mandatory
copyItems:YES];
@ -82,8 +76,7 @@ MediaConstraints::GetOptional() const {
+ (webrtc::MediaConstraintsInterface::Constraints)
nativeConstraintsForConstraints:
(NSDictionary *)constraints {
// (NSDictionary<NSString *, NSString *> *)constraints {
(NSDictionary<NSString *, NSString *> *)constraints {
webrtc::MediaConstraintsInterface::Constraints nativeConstraints;
for (NSString *key in constraints) {
NSAssert([key isKindOfClass:[NSString class]],

View File

@ -11,7 +11,6 @@
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592
@class RTCAudioTrack;
@class RTCPeerConnectionFactory;
@ -20,12 +19,10 @@ NS_ASSUME_NONNULL_BEGIN
@interface RTCMediaStream : NSObject
/** The audio tracks in this stream. */
@property(nonatomic, strong, readonly) NSArray *audioTracks;
// @property(nonatomic, strong, readonly) NSArray<RTCAudioTrack *> *audioTracks;
@property(nonatomic, strong, readonly) NSArray<RTCAudioTrack *> *audioTracks;
/** The video tracks in this stream. */
@property(nonatomic, strong, readonly) NSArray *videoTracks;
// @property(nonatomic, strong, readonly) NSArray<RTCVideoTrack *> *videoTracks;
@property(nonatomic, strong, readonly) NSArray<RTCVideoTrack *> *videoTracks;
/** An identifier for this media stream. */
@property(nonatomic, readonly) NSString *streamId;

View File

@ -19,8 +19,6 @@
#import "webrtc/api/objc/RTCVideoTrack+Private.h"
#import "webrtc/base/objc/NSString+StdString.h"
// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592
@implementation RTCMediaStream {
NSMutableArray *_audioTracks;
NSMutableArray *_videoTracks;
@ -37,13 +35,11 @@
return [self initWithNativeMediaStream:stream];
}
- (NSArray *)audioTracks {
// - (NSArray<RTCAudioTrack *> *)audioTracks {
- (NSArray<RTCAudioTrack *> *)audioTracks {
return [_audioTracks copy];
}
- (NSArray *)videoTracks {
// - (NSArray<RTCVideoTrack *> *)videoTracks {
- (NSArray<RTCVideoTrack *> *)videoTracks {
return [_videoTracks copy];
}

View File

@ -16,15 +16,12 @@
#import "webrtc/api/objc/RTCStatsReport+Private.h"
#import "webrtc/base/objc/NSString+StdString.h"
// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592
namespace webrtc {
class StatsObserverAdapter : public StatsObserver {
public:
StatsObserverAdapter(void (^completionHandler)
(NSArray *stats)) {
// (NSArray<RTCStatsReport *> *stats)) {
(NSArray<RTCStatsReport *> *stats)) {
completion_handler_ = completionHandler;
}
@ -45,8 +42,7 @@ class StatsObserverAdapter : public StatsObserver {
}
private:
void (^completion_handler_)(NSArray *stats);
// void (^completion_handler_)(NSArray<RTCStatsReport *> *stats);
void (^completion_handler_)(NSArray<RTCStatsReport *> *stats);
};
} // namespace webrtc
@ -55,8 +51,7 @@ class StatsObserverAdapter : public StatsObserver {
- (void)statsForTrack:(RTCMediaStreamTrack *)mediaStreamTrack
statsOutputLevel:(RTCStatsOutputLevel)statsOutputLevel
completionHandler:
(void (^)(NSArray *stats))completionHandler {
// (void (^)(NSArray<RTCStatsReport *> *stats))completionHandler {
(void (^)(NSArray<RTCStatsReport *> *stats))completionHandler {
rtc::scoped_refptr<webrtc::StatsObserverAdapter> observer(
new rtc::RefCountedObject<webrtc::StatsObserverAdapter>
(completionHandler));

View File

@ -22,9 +22,8 @@
@class RTCStatsReport;
NS_ASSUME_NONNULL_BEGIN
// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592
extern NSString * _Nonnull const kRTCPeerConnectionErrorDomain;
extern NSString * const kRTCPeerConnectionErrorDomain;
extern int const kRTCSessionDescriptionErrorCode;
/** Represents the signaling state of the peer connection. */
@ -67,36 +66,35 @@ typedef NS_ENUM(NSInteger, RTCStatsOutputLevel) {
@protocol RTCPeerConnectionDelegate <NSObject>
/** Called when the SignalingState changed. */
- (void)peerConnection:(nonnull RTCPeerConnection *)peerConnection
- (void)peerConnection:(RTCPeerConnection *)peerConnection
didChangeSignalingState:(RTCSignalingState)stateChanged;
/** Called when media is received on a new stream from remote peer. */
- (void)peerConnection:(nonnull RTCPeerConnection *)peerConnection
didAddStream:(nonnull RTCMediaStream *)stream;
- (void)peerConnection:(RTCPeerConnection *)peerConnection
didAddStream:(RTCMediaStream *)stream;
/** Called when a remote peer closes a stream. */
- (void)peerConnection:(nonnull RTCPeerConnection *)peerConnection
didRemoveStream:(nonnull RTCMediaStream *)stream;
- (void)peerConnection:(RTCPeerConnection *)peerConnection
didRemoveStream:(RTCMediaStream *)stream;
/** Called when negotiation is needed, for example ICE has restarted. */
- (void)peerConnectionShouldNegotiate:
(nonnull RTCPeerConnection *)peerConnection;
- (void)peerConnectionShouldNegotiate:(RTCPeerConnection *)peerConnection;
/** Called any time the IceConnectionState changes. */
- (void)peerConnection:(nonnull RTCPeerConnection *)peerConnection
- (void)peerConnection:(RTCPeerConnection *)peerConnection
didChangeIceConnectionState:(RTCIceConnectionState)newState;
/** Called any time the IceGatheringState changes. */
- (void)peerConnection:(nonnull RTCPeerConnection *)peerConnection
- (void)peerConnection:(RTCPeerConnection *)peerConnection
didChangeIceGatheringState:(RTCIceGatheringState)newState;
/** New ice candidate has been found. */
- (void)peerConnection:(nonnull RTCPeerConnection *)peerConnection
didGenerateIceCandidate:(nonnull RTCIceCandidate *)candidate;
- (void)peerConnection:(RTCPeerConnection *)peerConnection
didGenerateIceCandidate:(RTCIceCandidate *)candidate;
/** New data channel has been opened. */
- (void)peerConnection:(nonnull RTCPeerConnection *)peerConnection
didOpenDataChannel:(nonnull RTCDataChannel *)dataChannel;
- (void)peerConnection:(RTCPeerConnection *)peerConnection
didOpenDataChannel:(RTCDataChannel *)dataChannel;
@end
@ -107,7 +105,7 @@ typedef NS_ENUM(NSInteger, RTCStatsOutputLevel) {
* streams being added or removed.
*/
@property(nonatomic, weak, nullable) id<RTCPeerConnectionDelegate> delegate;
@property(nonatomic, readonly, nonnull) NSArray *localStreams;
@property(nonatomic, readonly) NSArray *localStreams;
@property(nonatomic, readonly, nullable)
RTCSessionDescription *localDescription;
@property(nonatomic, readonly, nullable)
@ -116,18 +114,18 @@ typedef NS_ENUM(NSInteger, RTCStatsOutputLevel) {
@property(nonatomic, readonly) RTCIceConnectionState iceConnectionState;
@property(nonatomic, readonly) RTCIceGatheringState iceGatheringState;
- (nonnull instancetype)init NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;
/** Initialize an RTCPeerConnection with a configuration, constraints, and
* delegate.
*/
- (nonnull instancetype)initWithFactory:
(nonnull RTCPeerConnectionFactory *)factory
configuration:
(nonnull RTCConfiguration *)configuration
constraints:
(nonnull RTCMediaConstraints *)constraints
delegate:
- (instancetype)initWithFactory:
(RTCPeerConnectionFactory *)factory
configuration:
(RTCConfiguration *)configuration
constraints:
(RTCMediaConstraints *)constraints
delegate:
(nullable id<RTCPeerConnectionDelegate>)delegate
NS_DESIGNATED_INITIALIZER;
@ -135,33 +133,33 @@ typedef NS_ENUM(NSInteger, RTCStatsOutputLevel) {
- (void)close;
/** Provide a remote candidate to the ICE Agent. */
- (void)addIceCandidate:(nonnull RTCIceCandidate *)candidate;
- (void)addIceCandidate:(RTCIceCandidate *)candidate;
/** Add a new media stream to be sent on this peer connection. */
- (void)addStream:(nonnull RTCMediaStream *)stream;
- (void)addStream:(RTCMediaStream *)stream;
/** Remove the given media stream from this peer connection. */
- (void)removeStream:(nonnull RTCMediaStream *)stream;
- (void)removeStream:(RTCMediaStream *)stream;
/** Generate an SDP offer. */
- (void)offerForConstraints:(nonnull RTCMediaConstraints *)constraints
- (void)offerForConstraints:(RTCMediaConstraints *)constraints
completionHandler:(nullable void (^)
(RTCSessionDescription * _Nullable sdp,
NSError * _Nullable error))completionHandler;
/** Generate an SDP answer. */
- (void)answerForConstraints:(nonnull RTCMediaConstraints *)constraints
- (void)answerForConstraints:(RTCMediaConstraints *)constraints
completionHandler:(nullable void (^)
(RTCSessionDescription * _Nullable sdp,
NSError * _Nullable error))completionHandler;
/** Apply the supplied RTCSessionDescription as the local description. */
- (void)setLocalDescription:(nonnull RTCSessionDescription *)sdp
- (void)setLocalDescription:(RTCSessionDescription *)sdp
completionHandler:
(nullable void (^)(NSError * _Nullable error))completionHandler;
/** Apply the supplied RTCSessionDescription as the remote description. */
- (void)setRemoteDescription:(nonnull RTCSessionDescription *)sdp
- (void)setRemoteDescription:(RTCSessionDescription *)sdp
completionHandler:
(nullable void (^)(NSError * _Nullable error))completionHandler;
@ -170,8 +168,8 @@ typedef NS_ENUM(NSInteger, RTCStatsOutputLevel) {
@interface RTCPeerConnection (DataChannel)
/** Create a new data channel with the given label and configuration. */
- (nonnull RTCDataChannel *)dataChannelForLabel:(nonnull NSString *)label
configuration:(nonnull RTCDataChannelConfiguration *)configuration;
- (RTCDataChannel *)dataChannelForLabel:(NSString *)label
configuration:(RTCDataChannelConfiguration *)configuration;
@end
@ -184,8 +182,7 @@ typedef NS_ENUM(NSInteger, RTCStatsOutputLevel) {
(nullable RTCMediaStreamTrack *)mediaStreamTrack
statsOutputLevel:(RTCStatsOutputLevel)statsOutputLevel
completionHandler:
(nullable void (^)(NSArray * _Nonnull stats))completionHandler;
// (nullable void (^)(NSArray<RTCStatsReport *> *stats))completionHandler;
(nullable void (^)(NSArray<RTCStatsReport *> *stats))completionHandler;
@end

View File

@ -11,7 +11,6 @@
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592
/** This does not currently conform to the spec. */
@interface RTCStatsReport : NSObject
@ -26,8 +25,7 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSString *statsId;
/** A dictionary holding the actual stats. */
@property(nonatomic, readonly) NSDictionary *values;
// @property(nonatomic, readonly) NSDictionary<NSString *, NSString *> *values;
@property(nonatomic, readonly) NSDictionary<NSString *, NSString *> *values;
- (instancetype)init NS_UNAVAILABLE;

View File

@ -16,8 +16,6 @@
#import "webrtc/base/objc/NSString+StdString.h"
#import "webrtc/base/objc/RTCLogging.h"
// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592
@implementation RTCStatsReport
@synthesize timestamp = _timestamp;

View File

@ -11,7 +11,6 @@
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
// TODO(hjon): Update nullability types. See http://crbug/webrtc/5592
@interface RTCVideoFrame : NSObject
@ -31,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) int32_t uPitch;
@property(nonatomic, readonly) int32_t vPitch;
- (nonnull instancetype)init NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;
@end