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}
This commit is contained in:
kthelgason 2017-04-20 03:54:22 -07:00 committed by Commit bot
parent 4e72b0f87c
commit 7c8786ae8f
9 changed files with 61 additions and 31 deletions

View File

@ -160,6 +160,7 @@ if (is_ios || (is_mac && target_cpu != "x86")) {
"objc/AppRTCMobile/common/ARDUtilities.h",
"objc/AppRTCMobile/common/ARDUtilities.m",
]
configs += [ "//build/config/compiler:enable_arc" ]
public_configs = [ ":apprtc_common_config" ]
deps = [
@ -226,6 +227,7 @@ if (is_ios || (is_mac && target_cpu != "x86")) {
"objc/AppRTCMobile/RTCSessionDescription+JSON.h",
"objc/AppRTCMobile/RTCSessionDescription+JSON.m",
]
configs += [ "//build/config/compiler:enable_arc" ]
public_configs = [ ":apprtc_signaling_config" ]
deps = [
":apprtc_common",
@ -258,6 +260,7 @@ if (is_ios || (is_mac && target_cpu != "x86")) {
"objc/AppRTCMobile/ios/UIImage+ARDUtilities.h",
"objc/AppRTCMobile/ios/UIImage+ARDUtilities.m",
]
configs += [ "//build/config/compiler:enable_arc" ]
deps = [
":apprtc_common",
@ -334,7 +337,10 @@ if (is_ios || (is_mac && target_cpu != "x86")) {
"objc/AppRTCMobile/mac/APPRTCViewController.h",
"objc/AppRTCMobile/mac/APPRTCViewController.m",
]
configs += [ "//webrtc:common_objc" ]
configs += [
"//webrtc:common_objc",
"//build/config/compiler:enable_arc",
]
deps = [
":apprtc_common",
":apprtc_signaling",
@ -388,7 +394,10 @@ if (is_ios || (is_mac && target_cpu != "x86")) {
"objc/AppRTCMobile/third_party/SocketRocket/SRWebSocket.h",
"objc/AppRTCMobile/third_party/SocketRocket/SRWebSocket.m",
]
configs += [ ":socketrocket_warning_config" ]
configs += [
"//build/config/compiler:enable_arc",
":socketrocket_warning_config",
]
public_configs = [ ":socketrocket_include_config" ]
libs = [
@ -421,6 +430,7 @@ if (is_ios || (is_mac && target_cpu != "x86")) {
"//build/config/ios:xctest",
"//third_party/ocmock",
]
configs += [ "//build/config/compiler:enable_arc" ]
}
rtc_ios_xctest_test("apprtcmobile_tests") {

View File

@ -192,6 +192,8 @@ rtc_static_library("audio_device") {
"ios/voice_processing_audio_unit.h",
"ios/voice_processing_audio_unit.mm",
]
configs += [ "//build/config/compiler:enable_arc" ]
libs = [
"AudioToolbox.framework",
"AVFoundation.framework",
@ -289,6 +291,7 @@ if (rtc_include_tests) {
}
if (is_ios) {
sources += [ "ios/objc/RTCAudioSessionTest.mm" ]
configs += [ "//build/config/compiler:enable_arc" ]
if (target_cpu != "x64") {
sources += [ "ios/audio_device_unittest_ios.cc" ]
}

View File

@ -36,7 +36,7 @@ namespace {
// setting.
NSImage* PaintInCurrentContext(NSImage* source) {
NSSize size = [source size];
NSImage* new_image = [[NSImage alloc] initWithSize:size];
NSImage* new_image = [[[NSImage alloc] initWithSize:size] autorelease];
[new_image lockFocus];
NSRect frame = NSMakeRect(0, 0, size.width, size.height);
[source drawInRect:frame

View File

@ -31,7 +31,10 @@ if (is_ios || is_mac) {
deps = [
"../base:rtc_base",
]
configs += [ "..:common_objc" ]
configs += [
"..:common_objc",
"//build/config/compiler:enable_arc",
]
public_configs = [ ":rtc_sdk_common_objc_config" ]
sources = [
"objc/Framework/Classes/NSString+StdString.h",
@ -227,7 +230,10 @@ if (is_ios || is_mac) {
]
}
configs += [ "..:common_objc" ]
configs += [
"..:common_objc",
"//build/config/compiler:enable_arc",
]
public_configs = [ ":rtc_sdk_common_objc_config" ]
@ -367,7 +373,10 @@ if (is_ios || is_mac) {
"VideoToolbox.framework",
]
configs += [ "..:common_objc" ]
configs += [
"..:common_objc",
"//build/config/compiler:enable_arc",
]
public_configs = [ ":rtc_sdk_common_objc_config" ]
@ -397,7 +406,10 @@ if (is_ios || is_mac) {
"objc/Framework/Classes/h264_video_toolbox_nalu.h",
]
configs += [ "//webrtc:common_objc" ]
configs += [
"//webrtc:common_objc",
"//build/config/compiler:enable_arc",
]
deps = [
":rtc_sdk_common_objc",

View File

@ -97,6 +97,7 @@ static cricket::VideoFormat expectedFormat =
CFRelease(_format);
_format = nil;
}
[super dealloc];
}
// Redefinition of AVCaptureDevice methods we want to mock.

View File

@ -128,6 +128,7 @@ rtc_source_set("fileutils") {
]
if (is_ios) {
sources += [ "testsupport/iosfileutils.mm" ]
configs += [ "//build/config/compiler:enable_arc" ]
}
visibility = [ ":*" ]
deps = [

View File

@ -36,10 +36,10 @@ TestBlock functionToBlock(void(*function)()) {
}
- (void)runAllTests:(TestBlock)testBlock {
@autoreleasepool {
testBlock();
running_ = NO;
}
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
testBlock();
running_ = NO;
[pool release];
}
- (BOOL)running {
@ -51,23 +51,24 @@ namespace webrtc {
namespace test {
void RunTest(void(*test)()) {
@autoreleasepool {
[NSApplication sharedApplication];
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[NSApplication sharedApplication];
// Convert the function pointer to an Objective-C block and call on a
// separate thread, to avoid blocking the main thread.
TestRunner *testRunner = [[TestRunner alloc] init];
TestBlock testBlock = functionToBlock(test);
[NSThread detachNewThreadSelector:@selector(runAllTests:)
toTarget:testRunner
withObject:testBlock];
// Convert the function pointer to an Objective-C block and call on a
// separate thread, to avoid blocking the main thread.
TestRunner *testRunner = [[TestRunner alloc] init];
TestBlock testBlock = functionToBlock(test);
[NSThread detachNewThreadSelector:@selector(runAllTests:)
toTarget:testRunner
withObject:testBlock];
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
while ([testRunner running] &&
[runLoop runMode:NSDefaultRunLoopMode
beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]);
}
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
while ([testRunner running] &&
[runLoop runMode:NSDefaultRunLoopMode
beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]);
[testRunner release];
[pool release];
}
} // namespace test

View File

@ -43,6 +43,11 @@
return self;
}
- (void)dealloc {
[window_ release];
[super dealloc];
}
- (void)createWindow:(NSObject *)ignored {
NSInteger xOrigin = nextXOrigin_;
NSRect screenFrame = [[NSScreen mainScreen] frame];
@ -66,8 +71,8 @@
defer:NO];
NSRect viewFrame = NSMakeRect(0, 0, width_, height_);
NSOpenGLView *view = [[NSOpenGLView alloc] initWithFrame:viewFrame
pixelFormat:nil];
NSOpenGLView *view = [[[NSOpenGLView alloc] initWithFrame:viewFrame
pixelFormat:nil] autorelease];
context_ = [view openGLContext];
[[window_ contentView] addSubview:view];
@ -100,6 +105,7 @@ MacRenderer::MacRenderer()
MacRenderer::~MacRenderer() {
GlRenderer::Destroy();
[window_ release];
}
bool MacRenderer::Init(const char* window_title, int width, int height) {

View File

@ -211,10 +211,6 @@ webrtc_root = get_path_info(".", "abspath")
# native code is built as part of Chromium.
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
# 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