Reland of GN: Enable ARC for Mac and iOS in rtc_* templates (patchset #1 id:1 of https://codereview.webrtc.org/2827223003/ )
Reason for revert: Relanding after fixing ARC issue. Original issue's description: > Revert of GN: Enable ARC for Mac and iOS in rtc_* templates (patchset #3 id:40001 of https://codereview.webrtc.org/2781713004/ ) > > Reason for revert: > Breaks mac build > > Original issue's description: > > GN: Enable ARC for Mac and iOS in rtc_* templates > > > > Remove all uses of retain/release and NSAutoreleasePool. > > > > This makes transformation to Bazel easier. > > > > This CL subsumes https://codereview.webrtc.org/2778163002 and depends on https://codereview.webrtc.org/2784483002/ > > > > BUG=webrtc:6412 > > > > Review-Url: https://codereview.webrtc.org/2781713004 > > Cr-Commit-Position: refs/heads/master@{#17780} > > Committed:6bda02b51d> > TBR=kjellander@webrtc.org,magjed@webrtc.org,stefan@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6412 > > Review-Url: https://codereview.webrtc.org/2827223003 > Cr-Commit-Position: refs/heads/master@{#17784} > Committed:7c8786ae8fTBR=kjellander@webrtc.org,magjed@webrtc.org,stefan@webrtc.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=webrtc:6412 Review-Url: https://codereview.webrtc.org/2834273002 Cr-Commit-Position: refs/heads/master@{#17836}
This commit is contained in:
@ -160,7 +160,6 @@ if (is_ios || (is_mac && target_cpu != "x86")) {
|
|||||||
"objc/AppRTCMobile/common/ARDUtilities.h",
|
"objc/AppRTCMobile/common/ARDUtilities.h",
|
||||||
"objc/AppRTCMobile/common/ARDUtilities.m",
|
"objc/AppRTCMobile/common/ARDUtilities.m",
|
||||||
]
|
]
|
||||||
configs += [ "//build/config/compiler:enable_arc" ]
|
|
||||||
public_configs = [ ":apprtc_common_config" ]
|
public_configs = [ ":apprtc_common_config" ]
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
@ -227,7 +226,6 @@ if (is_ios || (is_mac && target_cpu != "x86")) {
|
|||||||
"objc/AppRTCMobile/RTCSessionDescription+JSON.h",
|
"objc/AppRTCMobile/RTCSessionDescription+JSON.h",
|
||||||
"objc/AppRTCMobile/RTCSessionDescription+JSON.m",
|
"objc/AppRTCMobile/RTCSessionDescription+JSON.m",
|
||||||
]
|
]
|
||||||
configs += [ "//build/config/compiler:enable_arc" ]
|
|
||||||
public_configs = [ ":apprtc_signaling_config" ]
|
public_configs = [ ":apprtc_signaling_config" ]
|
||||||
deps = [
|
deps = [
|
||||||
":apprtc_common",
|
":apprtc_common",
|
||||||
@ -260,7 +258,6 @@ if (is_ios || (is_mac && target_cpu != "x86")) {
|
|||||||
"objc/AppRTCMobile/ios/UIImage+ARDUtilities.h",
|
"objc/AppRTCMobile/ios/UIImage+ARDUtilities.h",
|
||||||
"objc/AppRTCMobile/ios/UIImage+ARDUtilities.m",
|
"objc/AppRTCMobile/ios/UIImage+ARDUtilities.m",
|
||||||
]
|
]
|
||||||
configs += [ "//build/config/compiler:enable_arc" ]
|
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":apprtc_common",
|
":apprtc_common",
|
||||||
@ -337,10 +334,7 @@ if (is_ios || (is_mac && target_cpu != "x86")) {
|
|||||||
"objc/AppRTCMobile/mac/APPRTCViewController.h",
|
"objc/AppRTCMobile/mac/APPRTCViewController.h",
|
||||||
"objc/AppRTCMobile/mac/APPRTCViewController.m",
|
"objc/AppRTCMobile/mac/APPRTCViewController.m",
|
||||||
]
|
]
|
||||||
configs += [
|
configs += [ "//webrtc:common_objc" ]
|
||||||
"//webrtc:common_objc",
|
|
||||||
"//build/config/compiler:enable_arc",
|
|
||||||
]
|
|
||||||
deps = [
|
deps = [
|
||||||
":apprtc_common",
|
":apprtc_common",
|
||||||
":apprtc_signaling",
|
":apprtc_signaling",
|
||||||
@ -394,10 +388,7 @@ if (is_ios || (is_mac && target_cpu != "x86")) {
|
|||||||
"objc/AppRTCMobile/third_party/SocketRocket/SRWebSocket.h",
|
"objc/AppRTCMobile/third_party/SocketRocket/SRWebSocket.h",
|
||||||
"objc/AppRTCMobile/third_party/SocketRocket/SRWebSocket.m",
|
"objc/AppRTCMobile/third_party/SocketRocket/SRWebSocket.m",
|
||||||
]
|
]
|
||||||
configs += [
|
configs += [ ":socketrocket_warning_config" ]
|
||||||
"//build/config/compiler:enable_arc",
|
|
||||||
":socketrocket_warning_config",
|
|
||||||
]
|
|
||||||
public_configs = [ ":socketrocket_include_config" ]
|
public_configs = [ ":socketrocket_include_config" ]
|
||||||
|
|
||||||
libs = [
|
libs = [
|
||||||
@ -430,7 +421,6 @@ if (is_ios || (is_mac && target_cpu != "x86")) {
|
|||||||
"//build/config/ios:xctest",
|
"//build/config/ios:xctest",
|
||||||
"//third_party/ocmock",
|
"//third_party/ocmock",
|
||||||
]
|
]
|
||||||
configs += [ "//build/config/compiler:enable_arc" ]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc_ios_xctest_test("apprtcmobile_tests") {
|
rtc_ios_xctest_test("apprtcmobile_tests") {
|
||||||
|
|||||||
@ -192,8 +192,6 @@ rtc_static_library("audio_device") {
|
|||||||
"ios/voice_processing_audio_unit.h",
|
"ios/voice_processing_audio_unit.h",
|
||||||
"ios/voice_processing_audio_unit.mm",
|
"ios/voice_processing_audio_unit.mm",
|
||||||
]
|
]
|
||||||
configs += [ "//build/config/compiler:enable_arc" ]
|
|
||||||
|
|
||||||
libs = [
|
libs = [
|
||||||
"AudioToolbox.framework",
|
"AudioToolbox.framework",
|
||||||
"AVFoundation.framework",
|
"AVFoundation.framework",
|
||||||
@ -291,7 +289,6 @@ if (rtc_include_tests) {
|
|||||||
}
|
}
|
||||||
if (is_ios) {
|
if (is_ios) {
|
||||||
sources += [ "ios/objc/RTCAudioSessionTest.mm" ]
|
sources += [ "ios/objc/RTCAudioSessionTest.mm" ]
|
||||||
configs += [ "//build/config/compiler:enable_arc" ]
|
|
||||||
if (target_cpu != "x64") {
|
if (target_cpu != "x64") {
|
||||||
sources += [ "ios/audio_device_unittest_ios.cc" ]
|
sources += [ "ios/audio_device_unittest_ios.cc" ]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,7 +36,7 @@ namespace {
|
|||||||
// setting.
|
// setting.
|
||||||
NSImage* PaintInCurrentContext(NSImage* source) {
|
NSImage* PaintInCurrentContext(NSImage* source) {
|
||||||
NSSize size = [source size];
|
NSSize size = [source size];
|
||||||
NSImage* new_image = [[[NSImage alloc] initWithSize:size] autorelease];
|
NSImage* new_image = [[NSImage alloc] initWithSize:size];
|
||||||
[new_image lockFocus];
|
[new_image lockFocus];
|
||||||
NSRect frame = NSMakeRect(0, 0, size.width, size.height);
|
NSRect frame = NSMakeRect(0, 0, size.width, size.height);
|
||||||
[source drawInRect:frame
|
[source drawInRect:frame
|
||||||
|
|||||||
@ -50,14 +50,12 @@ if (is_ios || is_mac) {
|
|||||||
"objc/Framework/Headers/WebRTC/RTCSSLAdapter.h",
|
"objc/Framework/Headers/WebRTC/RTCSSLAdapter.h",
|
||||||
"objc/Framework/Headers/WebRTC/RTCTracing.h",
|
"objc/Framework/Headers/WebRTC/RTCTracing.h",
|
||||||
]
|
]
|
||||||
configs += [
|
|
||||||
"..:common_objc",
|
|
||||||
"//build/config/compiler:enable_arc",
|
|
||||||
]
|
|
||||||
public_configs = [ ":rtc_sdk_common_objc_config" ]
|
|
||||||
deps = [
|
deps = [
|
||||||
"../base:rtc_base",
|
"../base:rtc_base",
|
||||||
]
|
]
|
||||||
|
configs += [ "..:common_objc" ]
|
||||||
|
|
||||||
|
public_configs = [ ":rtc_sdk_common_objc_config" ]
|
||||||
if (is_ios) {
|
if (is_ios) {
|
||||||
sources += [
|
sources += [
|
||||||
"objc/Framework/Classes/RTCCameraPreviewView.m",
|
"objc/Framework/Classes/RTCCameraPreviewView.m",
|
||||||
@ -195,13 +193,6 @@ if (is_ios || is_mac) {
|
|||||||
"objc/Framework/Headers/WebRTC/RTCVideoTrack.h",
|
"objc/Framework/Headers/WebRTC/RTCVideoTrack.h",
|
||||||
]
|
]
|
||||||
|
|
||||||
configs += [
|
|
||||||
"..:common_objc",
|
|
||||||
"//build/config/compiler:enable_arc",
|
|
||||||
]
|
|
||||||
|
|
||||||
public_configs = [ ":rtc_sdk_common_objc_config" ]
|
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":webrtc_h264_video_toolbox",
|
":webrtc_h264_video_toolbox",
|
||||||
"../api:video_frame_api",
|
"../api:video_frame_api",
|
||||||
@ -245,6 +236,10 @@ if (is_ios || is_mac) {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configs += [ "..:common_objc" ]
|
||||||
|
|
||||||
|
public_configs = [ ":rtc_sdk_common_objc_config" ]
|
||||||
|
|
||||||
if (!build_with_chromium && is_clang) {
|
if (!build_with_chromium && is_clang) {
|
||||||
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
|
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
|
||||||
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
|
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
|
||||||
@ -368,13 +363,6 @@ if (is_ios || is_mac) {
|
|||||||
"@rpath/$output_name.framework/$output_name",
|
"@rpath/$output_name.framework/$output_name",
|
||||||
]
|
]
|
||||||
|
|
||||||
configs += [
|
|
||||||
"..:common_objc",
|
|
||||||
"//build/config/compiler:enable_arc",
|
|
||||||
]
|
|
||||||
|
|
||||||
public_configs = [ ":rtc_sdk_common_objc_config" ]
|
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":rtc_sdk_peerconnection_objc",
|
":rtc_sdk_peerconnection_objc",
|
||||||
"../system_wrappers:field_trial_default",
|
"../system_wrappers:field_trial_default",
|
||||||
@ -390,6 +378,10 @@ if (is_ios || is_mac) {
|
|||||||
"VideoToolbox.framework",
|
"VideoToolbox.framework",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
configs += [ "..:common_objc" ]
|
||||||
|
|
||||||
|
public_configs = [ ":rtc_sdk_common_objc_config" ]
|
||||||
|
|
||||||
if (!build_with_chromium && is_clang) {
|
if (!build_with_chromium && is_clang) {
|
||||||
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163)
|
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163)
|
||||||
configs -= [ "//build/config/clang:find_bad_constructs" ]
|
configs -= [ "//build/config/clang:find_bad_constructs" ]
|
||||||
@ -416,10 +408,7 @@ if (is_ios || is_mac) {
|
|||||||
"objc/Framework/Classes/h264_video_toolbox_nalu.h",
|
"objc/Framework/Classes/h264_video_toolbox_nalu.h",
|
||||||
]
|
]
|
||||||
|
|
||||||
configs += [
|
configs += [ "//webrtc:common_objc" ]
|
||||||
"//webrtc:common_objc",
|
|
||||||
"//build/config/compiler:enable_arc",
|
|
||||||
]
|
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":rtc_sdk_common_objc",
|
":rtc_sdk_common_objc",
|
||||||
|
|||||||
@ -53,11 +53,13 @@
|
|||||||
RTCMediaConstraints *contraints = [[RTCMediaConstraints alloc] initWithMandatoryConstraints:@{}
|
RTCMediaConstraints *contraints = [[RTCMediaConstraints alloc] initWithMandatoryConstraints:@{}
|
||||||
optionalConstraints:nil];
|
optionalConstraints:nil];
|
||||||
RTCPeerConnectionFactory *factory = [[RTCPeerConnectionFactory alloc] init];
|
RTCPeerConnectionFactory *factory = [[RTCPeerConnectionFactory alloc] init];
|
||||||
RTCPeerConnection *peerConnection = [factory peerConnectionWithConfiguration:config
|
|
||||||
constraints:contraints delegate:nil];
|
|
||||||
|
|
||||||
RTCConfiguration *newConfig = peerConnection.configuration;
|
|
||||||
|
|
||||||
|
RTCConfiguration *newConfig;
|
||||||
|
@autoreleasepool {
|
||||||
|
RTCPeerConnection *peerConnection =
|
||||||
|
[factory peerConnectionWithConfiguration:config constraints:contraints delegate:nil];
|
||||||
|
newConfig = peerConnection.configuration;
|
||||||
|
}
|
||||||
EXPECT_EQ([config.iceServers count], [newConfig.iceServers count]);
|
EXPECT_EQ([config.iceServers count], [newConfig.iceServers count]);
|
||||||
RTCIceServer *newServer = newConfig.iceServers[0];
|
RTCIceServer *newServer = newConfig.iceServers[0];
|
||||||
RTCIceServer *origServer = config.iceServers[0];
|
RTCIceServer *origServer = config.iceServers[0];
|
||||||
|
|||||||
@ -97,7 +97,6 @@ static cricket::VideoFormat expectedFormat =
|
|||||||
CFRelease(_format);
|
CFRelease(_format);
|
||||||
_format = nil;
|
_format = nil;
|
||||||
}
|
}
|
||||||
[super dealloc];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redefinition of AVCaptureDevice methods we want to mock.
|
// Redefinition of AVCaptureDevice methods we want to mock.
|
||||||
|
|||||||
@ -128,7 +128,6 @@ rtc_source_set("fileutils") {
|
|||||||
]
|
]
|
||||||
if (is_ios) {
|
if (is_ios) {
|
||||||
sources += [ "testsupport/iosfileutils.mm" ]
|
sources += [ "testsupport/iosfileutils.mm" ]
|
||||||
configs += [ "//build/config/compiler:enable_arc" ]
|
|
||||||
}
|
}
|
||||||
visibility = [ ":*" ]
|
visibility = [ ":*" ]
|
||||||
deps = [
|
deps = [
|
||||||
|
|||||||
@ -36,10 +36,10 @@ TestBlock functionToBlock(void(*function)()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)runAllTests:(TestBlock)testBlock {
|
- (void)runAllTests:(TestBlock)testBlock {
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
@autoreleasepool {
|
||||||
testBlock();
|
testBlock();
|
||||||
running_ = NO;
|
running_ = NO;
|
||||||
[pool release];
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)running {
|
- (BOOL)running {
|
||||||
@ -51,24 +51,22 @@ namespace webrtc {
|
|||||||
namespace test {
|
namespace test {
|
||||||
|
|
||||||
void RunTest(void(*test)()) {
|
void RunTest(void(*test)()) {
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
@autoreleasepool {
|
||||||
[NSApplication sharedApplication];
|
[NSApplication sharedApplication];
|
||||||
|
|
||||||
// Convert the function pointer to an Objective-C block and call on a
|
// Convert the function pointer to an Objective-C block and call on a
|
||||||
// separate thread, to avoid blocking the main thread.
|
// separate thread, to avoid blocking the main thread.
|
||||||
TestRunner *testRunner = [[TestRunner alloc] init];
|
TestRunner *testRunner = [[TestRunner alloc] init];
|
||||||
TestBlock testBlock = functionToBlock(test);
|
TestBlock testBlock = functionToBlock(test);
|
||||||
[NSThread detachNewThreadSelector:@selector(runAllTests:)
|
[NSThread detachNewThreadSelector:@selector(runAllTests:)
|
||||||
toTarget:testRunner
|
toTarget:testRunner
|
||||||
withObject:testBlock];
|
withObject:testBlock];
|
||||||
|
|
||||||
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
|
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
|
||||||
while ([testRunner running] &&
|
while ([testRunner running] && [runLoop runMode:NSDefaultRunLoopMode
|
||||||
[runLoop runMode:NSDefaultRunLoopMode
|
beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]])
|
||||||
beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]);
|
;
|
||||||
|
}
|
||||||
[testRunner release];
|
|
||||||
[pool release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace test
|
} // namespace test
|
||||||
|
|||||||
@ -43,11 +43,6 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
|
||||||
[window_ release];
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)createWindow:(NSObject *)ignored {
|
- (void)createWindow:(NSObject *)ignored {
|
||||||
NSInteger xOrigin = nextXOrigin_;
|
NSInteger xOrigin = nextXOrigin_;
|
||||||
NSRect screenFrame = [[NSScreen mainScreen] frame];
|
NSRect screenFrame = [[NSScreen mainScreen] frame];
|
||||||
@ -71,8 +66,7 @@
|
|||||||
defer:NO];
|
defer:NO];
|
||||||
|
|
||||||
NSRect viewFrame = NSMakeRect(0, 0, width_, height_);
|
NSRect viewFrame = NSMakeRect(0, 0, width_, height_);
|
||||||
NSOpenGLView *view = [[[NSOpenGLView alloc] initWithFrame:viewFrame
|
NSOpenGLView *view = [[NSOpenGLView alloc] initWithFrame:viewFrame pixelFormat:nil];
|
||||||
pixelFormat:nil] autorelease];
|
|
||||||
context_ = [view openGLContext];
|
context_ = [view openGLContext];
|
||||||
|
|
||||||
[[window_ contentView] addSubview:view];
|
[[window_ contentView] addSubview:view];
|
||||||
@ -105,7 +99,6 @@ MacRenderer::MacRenderer()
|
|||||||
|
|
||||||
MacRenderer::~MacRenderer() {
|
MacRenderer::~MacRenderer() {
|
||||||
GlRenderer::Destroy();
|
GlRenderer::Destroy();
|
||||||
[window_ release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacRenderer::Init(const char* window_title, int width, int height) {
|
bool MacRenderer::Init(const char* window_title, int width, int height) {
|
||||||
|
|||||||
@ -211,6 +211,10 @@ webrtc_root = get_path_info(".", "abspath")
|
|||||||
# native code is built as part of Chromium.
|
# native code is built as part of Chromium.
|
||||||
rtc_common_configs = [ webrtc_root + ":common_config" ]
|
rtc_common_configs = [ webrtc_root + ":common_config" ]
|
||||||
|
|
||||||
|
if (is_mac || is_ios) {
|
||||||
|
rtc_common_configs += [ "//build/config/compiler:enable_arc" ]
|
||||||
|
}
|
||||||
|
|
||||||
# Global public configuration that should be applied to all WebRTC targets. You
|
# Global public configuration that should be applied to all WebRTC targets. You
|
||||||
# normally shouldn't need to include this in your target as it's automatically
|
# normally shouldn't need to include this in your target as it's automatically
|
||||||
# included when using the rtc_* templates. It set the defines, include paths and
|
# included when using the rtc_* templates. It set the defines, include paths and
|
||||||
|
|||||||
Reference in New Issue
Block a user