Remove thread checker in thread.cc due to downstream issue.

TBR=ossu@webrtc.org

Bug: webrtc:8596
Change-Id: Ie36b18a2a66e08d8006e85c3a7783df74e157c92
Reviewed-on: https://webrtc-review.googlesource.com/29204
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21049}
This commit is contained in:
Tommi 2017-12-04 18:51:16 +01:00 committed by Commit Bot
parent 45507f2c81
commit 6cea2b0f4b
2 changed files with 5 additions and 21 deletions

View File

@ -183,7 +183,6 @@ bool Thread::SetName(const std::string& name, const void* obj) {
}
bool Thread::Start(Runnable* runnable) {
RTC_DCHECK_RUN_ON(&thread_checker_);
RTC_DCHECK(!IsRunning());
if (IsRunning())
@ -225,7 +224,6 @@ bool Thread::WrapCurrent() {
}
void Thread::UnwrapCurrent() {
RTC_DCHECK_RUN_ON(&thread_checker_);
// Clears the platform-specific thread-specific storage.
ThreadManager::Instance()->SetCurrentThread(nullptr);
#if defined(WEBRTC_WIN)
@ -240,7 +238,6 @@ void Thread::UnwrapCurrent() {
#elif defined(WEBRTC_POSIX)
thread_ = 0;
#endif
thread_checker_.DetachFromThread();
}
void Thread::SafeWrapCurrent() {
@ -248,7 +245,6 @@ void Thread::SafeWrapCurrent() {
}
void Thread::Join() {
RTC_DCHECK_RUN_ON(&thread_checker_);
if (!IsRunning())
return;
@ -268,7 +264,6 @@ void Thread::Join() {
pthread_join(thread_, nullptr);
thread_ = 0;
#endif
thread_checker_.DetachFromThread();
}
bool Thread::SetAllowBlockingCalls(bool allow) {
@ -316,16 +311,13 @@ void Thread::Run() {
}
bool Thread::IsOwned() {
RTC_DCHECK_RUN_ON(&thread_checker_);
RTC_DCHECK(IsRunning());
return owned_;
}
void Thread::Stop() {
RTC_DCHECK_RUN_ON(&thread_checker_);
MessageQueue::Quit();
Join();
thread_checker_.DetachFromThread();
}
void Thread::Send(const Location& posted_from,
@ -499,7 +491,6 @@ bool Thread::ProcessMessages(int cmsLoop) {
bool Thread::WrapCurrentWithThreadManager(ThreadManager* thread_manager,
bool need_synchronize_access) {
RTC_DCHECK_RUN_ON(&thread_checker_);
RTC_DCHECK(!IsRunning());
#if defined(WEBRTC_WIN)
@ -522,7 +513,6 @@ bool Thread::WrapCurrentWithThreadManager(ThreadManager* thread_manager,
}
bool Thread::IsRunning() {
RTC_DCHECK_RUN_ON(&thread_checker_);
#if defined(WEBRTC_WIN)
return thread_ != nullptr;
#elif defined(WEBRTC_POSIX)

View File

@ -24,7 +24,6 @@
#include "rtc_base/constructormagic.h"
#include "rtc_base/messagequeue.h"
#include "rtc_base/platform_thread_types.h"
#include "rtc_base/thread_checker.h"
#if defined(WEBRTC_WIN)
#include "rtc_base/win32.h"
@ -274,21 +273,16 @@ class RTC_LOCKABLE Thread : public MessageQueue {
std::list<_SendMessage> sendlist_;
std::string name_;
// Used to check access to unguarded thread control state variables and ensure
// that control functions are called on the right thread.
// The |thread_checker_| might represent a 'parent' thread from which
// Start()/Stop() are called or it could represent the worker thread itself in
// case the thread is wrapped since the functions that modified the control
// state will in this case be called from that thread.
ThreadChecker thread_checker_;
// TODO(tommi): Add thread checks for proper use of control methods.
// Ideally we should be able to just use PlatformThread.
#if defined(WEBRTC_POSIX)
pthread_t thread_ RTC_ACCESS_ON(thread_checker_) = 0;
pthread_t thread_ = 0;
#endif
#if defined(WEBRTC_WIN)
HANDLE thread_ RTC_ACCESS_ON(thread_checker_) = nullptr;
DWORD thread_id_ RTC_ACCESS_ON(thread_checker_) = 0;
HANDLE thread_ = nullptr;
DWORD thread_id_ = 0;
#endif
// Indicates whether or not ownership of the worker thread lies with