Remove non-ARC code from the codebase.

BUG=webrtc:7198

Review-Url: https://codereview.webrtc.org/2702153004
Cr-Commit-Position: refs/heads/master@{#16765}
This commit is contained in:
kthelgason 2017-02-22 00:42:11 -08:00 committed by Commit bot
parent 59fc9030ea
commit de6adbe0ba
4 changed files with 27 additions and 57 deletions

View File

@ -10,10 +10,6 @@
#include "webrtc/base/thread.h"
#ifndef __has_feature
#define __has_feature(x) 0 // Compatibility with non-clang or LLVM compilers.
#endif // __has_feature
#if defined(WEBRTC_WIN)
#include <comdef.h>
#elif defined(WEBRTC_POSIX)
@ -28,7 +24,7 @@
#include "webrtc/base/timeutils.h"
#include "webrtc/base/trace_event.h"
#if !__has_feature(objc_arc) && (defined(WEBRTC_MAC))
#if defined(WEBRTC_MAC)
#include "webrtc/base/maccocoathreadhelper.h"
#include "webrtc/base/scoped_autorelease_pool.h"
#endif
@ -51,28 +47,22 @@ ThreadManager::ThreadManager() {
#ifndef NO_MAIN_THREAD_WRAPPING
WrapCurrentThread();
#endif
#if !__has_feature(objc_arc) && (defined(WEBRTC_MAC))
// Under Automatic Reference Counting (ARC), you cannot use autorelease pools
// directly. Instead, you use @autoreleasepool blocks instead. Also, we are
// maintaining thread safety using immutability within context of GCD dispatch
// queues in this case.
#if defined(WEBRTC_MAC)
// This is necessary to alert the cocoa runtime of the fact that
// we are running in a multithreaded environment.
InitCocoaMultiThreading();
#endif
}
ThreadManager::~ThreadManager() {
#if __has_feature(objc_arc)
@autoreleasepool
#elif defined(WEBRTC_MAC)
#if defined(WEBRTC_MAC)
// This is called during exit, at which point apparently no NSAutoreleasePools
// are available; but we might still need them to do cleanup (or we get the
// "no autoreleasepool in place, just leaking" warning when exiting).
ScopedAutoreleasePool pool;
#endif
{
UnwrapCurrentThread();
pthread_key_delete(key_);
}
UnwrapCurrentThread();
pthread_key_delete(key_);
}
Thread *ThreadManager::CurrentThread() {
@ -316,25 +306,21 @@ void* Thread::PreRun(void* pv) {
ThreadInit* init = static_cast<ThreadInit*>(pv);
ThreadManager::Instance()->SetCurrentThread(init->thread);
rtc::SetCurrentThreadName(init->thread->name_.c_str());
#if __has_feature(objc_arc)
@autoreleasepool
#elif defined(WEBRTC_MAC)
#if defined(WEBRTC_MAC)
// Make sure the new thread has an autoreleasepool
ScopedAutoreleasePool pool;
#endif
{
if (init->runnable) {
init->runnable->Run(init->thread);
} else {
init->thread->Run();
}
delete init;
#ifdef WEBRTC_WIN
return 0;
#else
return nullptr;
#endif
if (init->runnable) {
init->runnable->Run(init->thread);
} else {
init->thread->Run();
}
delete init;
#ifdef WEBRTC_WIN
return 0;
#else
return nullptr;
#endif
}
void Thread::Run() {
@ -497,26 +483,22 @@ bool Thread::ProcessMessages(int cmsLoop) {
int cmsNext = cmsLoop;
while (true) {
#if __has_feature(objc_arc)
@autoreleasepool
#elif defined(WEBRTC_MAC)
#if defined(WEBRTC_MAC)
// see: http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSAutoreleasePool_Class/Reference/Reference.html
// Each thread is supposed to have an autorelease pool. Also for event loops
// like this, autorelease pool needs to be created and drained/released
// for each cycle.
ScopedAutoreleasePool pool;
#endif
{
Message msg;
if (!Get(&msg, cmsNext))
return !IsQuitting();
Dispatch(&msg);
Message msg;
if (!Get(&msg, cmsNext))
return !IsQuitting();
Dispatch(&msg);
if (cmsLoop != kForever) {
cmsNext = static_cast<int>(TimeUntil(msEnd));
if (cmsNext < 0)
return true;
}
if (cmsLoop != kForever) {
cmsNext = static_cast<int>(TimeUntil(msEnd));
if (cmsNext < 0)
return true;
}
}
}

View File

@ -8,10 +8,6 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
#import "APPRTCAppDelegate.h"
#import "APPRTCViewController.h"
#import "WebRTC/RTCSSLAdapter.h"

View File

@ -8,10 +8,6 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
#import <AVFoundation/AVFoundation.h>
#import <Foundation/Foundation.h>

View File

@ -10,10 +10,6 @@
#if defined(WEBRTC_IOS)
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
#import <Foundation/Foundation.h>
#include <string.h>