diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn index 53987743d2..f5a1c9548b 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn @@ -14,10 +14,6 @@ if (is_android) { import("//build/config/android/rules.gni") } -config("threading_chromium_config") { - defines = [ "NO_MAIN_THREAD_WRAPPING" ] -} - if (!rtc_build_ssl) { config("external_ssl_library") { assert(rtc_ssl_root != "", @@ -768,10 +764,6 @@ rtc_source_set("socket_server") { rtc_library("threading") { visibility = [ "*" ] - if (build_with_chromium) { - public_configs = [ ":threading_chromium_config" ] - } - sources = [ "async_resolver.cc", "async_resolver.h", diff --git a/rtc_base/thread.cc b/rtc_base/thread.cc index c1c2c1bb4b..307d499255 100644 --- a/rtc_base/thread.cc +++ b/rtc_base/thread.cc @@ -255,19 +255,11 @@ Thread* Thread::Current() { ThreadManager* manager = ThreadManager::Instance(); Thread* thread = manager->CurrentThread(); -#ifndef NO_MAIN_THREAD_WRAPPING - // Only autowrap the thread which instantiated the ThreadManager. - if (!thread && manager->IsMainThread()) { - thread = new Thread(CreateDefaultSocketServer()); - thread->WrapCurrentWithThreadManager(manager, true); - } -#endif - return thread; } #if defined(WEBRTC_POSIX) -ThreadManager::ThreadManager() : main_thread_ref_(CurrentThreadRef()) { +ThreadManager::ThreadManager() { #if defined(WEBRTC_MAC) InitCocoaMultiThreading(); #endif @@ -284,8 +276,7 @@ void ThreadManager::SetCurrentThreadInternal(Thread* thread) { #endif #if defined(WEBRTC_WIN) -ThreadManager::ThreadManager() - : key_(TlsAlloc()), main_thread_ref_(CurrentThreadRef()) {} +ThreadManager::ThreadManager() : key_(TlsAlloc()) {} Thread* ThreadManager::CurrentThread() { return static_cast(TlsGetValue(key_)); @@ -341,10 +332,6 @@ void ThreadManager::UnwrapCurrentThread() { } } -bool ThreadManager::IsMainThread() { - return IsThreadRefEqual(CurrentThreadRef(), main_thread_ref_); -} - Thread::ScopedDisallowBlockingCalls::ScopedDisallowBlockingCalls() : thread_(Thread::Current()), previous_state_(thread_->SetAllowBlockingCalls(false)) {} diff --git a/rtc_base/thread.h b/rtc_base/thread.h index bc93e6533c..3c4ed558cd 100644 --- a/rtc_base/thread.h +++ b/rtc_base/thread.h @@ -141,8 +141,6 @@ class RTC_EXPORT ThreadManager { Thread* WrapCurrentThread(); void UnwrapCurrentThread(); - bool IsMainThread(); - #if RTC_DCHECK_IS_ON // Registers that a Send operation is to be performed between `source` and // `target`, while checking that this does not cause a send cycle that could @@ -188,9 +186,6 @@ class RTC_EXPORT ThreadManager { #if defined(WEBRTC_WIN) const DWORD key_; #endif - - // The thread to potentially autowrap. - const PlatformThreadRef main_thread_ref_; }; // WARNING! SUBCLASSES MUST CALL Stop() IN THEIR DESTRUCTORS! See ~Thread().