Move ThreadWrapper to ProcessThread in base.
Also removes all virtual methods. Permits using a thread from rtc_base_approved (namely event tracing). BUG=webrtc:5158 R=tommi@webrtc.org Review URL: https://codereview.webrtc.org/1469013002 Cr-Commit-Position: refs/heads/master@{#10760}
This commit is contained in:
@ -13,6 +13,7 @@
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webrtc/base/md5digest.h"
|
||||
#include "webrtc/base/platform_thread.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/base/thread_annotations.h"
|
||||
#include "webrtc/modules/audio_coding/codecs/audio_encoder.h"
|
||||
@ -38,7 +39,6 @@
|
||||
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
|
||||
#include "webrtc/system_wrappers/include/event_wrapper.h"
|
||||
#include "webrtc/system_wrappers/include/sleep.h"
|
||||
#include "webrtc/system_wrappers/include/thread_wrapper.h"
|
||||
#include "webrtc/test/testsupport/fileutils.h"
|
||||
#include "webrtc/test/testsupport/gtest_disable.h"
|
||||
|
||||
@ -457,11 +457,13 @@ class AudioCodingModuleMtTestOldApi : public AudioCodingModuleTestOldApi {
|
||||
|
||||
AudioCodingModuleMtTestOldApi()
|
||||
: AudioCodingModuleTestOldApi(),
|
||||
send_thread_(ThreadWrapper::CreateThread(CbSendThread, this, "send")),
|
||||
insert_packet_thread_(ThreadWrapper::CreateThread(
|
||||
CbInsertPacketThread, this, "insert_packet")),
|
||||
pull_audio_thread_(ThreadWrapper::CreateThread(
|
||||
CbPullAudioThread, this, "pull_audio")),
|
||||
send_thread_(PlatformThread::CreateThread(CbSendThread, this, "send")),
|
||||
insert_packet_thread_(PlatformThread::CreateThread(CbInsertPacketThread,
|
||||
this,
|
||||
"insert_packet")),
|
||||
pull_audio_thread_(PlatformThread::CreateThread(CbPullAudioThread,
|
||||
this,
|
||||
"pull_audio")),
|
||||
test_complete_(EventWrapper::Create()),
|
||||
send_count_(0),
|
||||
insert_packet_count_(0),
|
||||
@ -571,9 +573,9 @@ class AudioCodingModuleMtTestOldApi : public AudioCodingModuleTestOldApi {
|
||||
return true;
|
||||
}
|
||||
|
||||
rtc::scoped_ptr<ThreadWrapper> send_thread_;
|
||||
rtc::scoped_ptr<ThreadWrapper> insert_packet_thread_;
|
||||
rtc::scoped_ptr<ThreadWrapper> pull_audio_thread_;
|
||||
rtc::scoped_ptr<PlatformThread> send_thread_;
|
||||
rtc::scoped_ptr<PlatformThread> insert_packet_thread_;
|
||||
rtc::scoped_ptr<PlatformThread> pull_audio_thread_;
|
||||
const rtc::scoped_ptr<EventWrapper> test_complete_;
|
||||
int send_count_;
|
||||
int insert_packet_count_;
|
||||
@ -701,11 +703,11 @@ class AcmReRegisterIsacMtTestOldApi : public AudioCodingModuleTestOldApi {
|
||||
AcmReRegisterIsacMtTestOldApi()
|
||||
: AudioCodingModuleTestOldApi(),
|
||||
receive_thread_(
|
||||
ThreadWrapper::CreateThread(CbReceiveThread, this, "receive")),
|
||||
PlatformThread::CreateThread(CbReceiveThread, this, "receive")),
|
||||
codec_registration_thread_(
|
||||
ThreadWrapper::CreateThread(CbCodecRegistrationThread,
|
||||
this,
|
||||
"codec_registration")),
|
||||
PlatformThread::CreateThread(CbCodecRegistrationThread,
|
||||
this,
|
||||
"codec_registration")),
|
||||
test_complete_(EventWrapper::Create()),
|
||||
crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
codec_registered_(false),
|
||||
@ -829,8 +831,8 @@ class AcmReRegisterIsacMtTestOldApi : public AudioCodingModuleTestOldApi {
|
||||
return true;
|
||||
}
|
||||
|
||||
rtc::scoped_ptr<ThreadWrapper> receive_thread_;
|
||||
rtc::scoped_ptr<ThreadWrapper> codec_registration_thread_;
|
||||
rtc::scoped_ptr<PlatformThread> receive_thread_;
|
||||
rtc::scoped_ptr<PlatformThread> codec_registration_thread_;
|
||||
const rtc::scoped_ptr<EventWrapper> test_complete_;
|
||||
const rtc::scoped_ptr<CriticalSectionWrapper> crit_sect_;
|
||||
bool codec_registered_ GUARDED_BY(crit_sect_);
|
||||
|
||||
@ -20,13 +20,13 @@
|
||||
#include <string>
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webrtc/base/platform_thread.h"
|
||||
#include "webrtc/common.h"
|
||||
#include "webrtc/common_types.h"
|
||||
#include "webrtc/engine_configurations.h"
|
||||
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
|
||||
#include "webrtc/modules/audio_coding/main/test/utility.h"
|
||||
#include "webrtc/system_wrappers/include/event_wrapper.h"
|
||||
#include "webrtc/system_wrappers/include/thread_wrapper.h"
|
||||
#include "webrtc/system_wrappers/include/tick_util.h"
|
||||
#include "webrtc/system_wrappers/include/trace.h"
|
||||
#include "webrtc/test/testsupport/fileutils.h"
|
||||
@ -522,37 +522,37 @@ void APITest::Perform() {
|
||||
//--- THREADS
|
||||
// A
|
||||
// PUSH
|
||||
rtc::scoped_ptr<ThreadWrapper> myPushAudioThreadA =
|
||||
ThreadWrapper::CreateThread(PushAudioThreadA, this, "PushAudioThreadA");
|
||||
rtc::scoped_ptr<PlatformThread> myPushAudioThreadA =
|
||||
PlatformThread::CreateThread(PushAudioThreadA, this, "PushAudioThreadA");
|
||||
CHECK_THREAD_NULLITY(myPushAudioThreadA, "Unable to start A::PUSH thread");
|
||||
// PULL
|
||||
rtc::scoped_ptr<ThreadWrapper> myPullAudioThreadA =
|
||||
ThreadWrapper::CreateThread(PullAudioThreadA, this, "PullAudioThreadA");
|
||||
rtc::scoped_ptr<PlatformThread> myPullAudioThreadA =
|
||||
PlatformThread::CreateThread(PullAudioThreadA, this, "PullAudioThreadA");
|
||||
CHECK_THREAD_NULLITY(myPullAudioThreadA, "Unable to start A::PULL thread");
|
||||
// Process
|
||||
rtc::scoped_ptr<ThreadWrapper> myProcessThreadA = ThreadWrapper::CreateThread(
|
||||
ProcessThreadA, this, "ProcessThreadA");
|
||||
rtc::scoped_ptr<PlatformThread> myProcessThreadA =
|
||||
PlatformThread::CreateThread(ProcessThreadA, this, "ProcessThreadA");
|
||||
CHECK_THREAD_NULLITY(myProcessThreadA, "Unable to start A::Process thread");
|
||||
// API
|
||||
rtc::scoped_ptr<ThreadWrapper> myAPIThreadA = ThreadWrapper::CreateThread(
|
||||
APIThreadA, this, "APIThreadA");
|
||||
rtc::scoped_ptr<PlatformThread> myAPIThreadA =
|
||||
PlatformThread::CreateThread(APIThreadA, this, "APIThreadA");
|
||||
CHECK_THREAD_NULLITY(myAPIThreadA, "Unable to start A::API thread");
|
||||
// B
|
||||
// PUSH
|
||||
rtc::scoped_ptr<ThreadWrapper> myPushAudioThreadB =
|
||||
ThreadWrapper::CreateThread(PushAudioThreadB, this, "PushAudioThreadB");
|
||||
rtc::scoped_ptr<PlatformThread> myPushAudioThreadB =
|
||||
PlatformThread::CreateThread(PushAudioThreadB, this, "PushAudioThreadB");
|
||||
CHECK_THREAD_NULLITY(myPushAudioThreadB, "Unable to start B::PUSH thread");
|
||||
// PULL
|
||||
rtc::scoped_ptr<ThreadWrapper> myPullAudioThreadB =
|
||||
ThreadWrapper::CreateThread(PullAudioThreadB, this, "PullAudioThreadB");
|
||||
rtc::scoped_ptr<PlatformThread> myPullAudioThreadB =
|
||||
PlatformThread::CreateThread(PullAudioThreadB, this, "PullAudioThreadB");
|
||||
CHECK_THREAD_NULLITY(myPullAudioThreadB, "Unable to start B::PULL thread");
|
||||
// Process
|
||||
rtc::scoped_ptr<ThreadWrapper> myProcessThreadB = ThreadWrapper::CreateThread(
|
||||
ProcessThreadB, this, "ProcessThreadB");
|
||||
rtc::scoped_ptr<PlatformThread> myProcessThreadB =
|
||||
PlatformThread::CreateThread(ProcessThreadB, this, "ProcessThreadB");
|
||||
CHECK_THREAD_NULLITY(myProcessThreadB, "Unable to start B::Process thread");
|
||||
// API
|
||||
rtc::scoped_ptr<ThreadWrapper> myAPIThreadB = ThreadWrapper::CreateThread(
|
||||
APIThreadB, this, "APIThreadB");
|
||||
rtc::scoped_ptr<PlatformThread> myAPIThreadB =
|
||||
PlatformThread::CreateThread(APIThreadB, this, "APIThreadB");
|
||||
CHECK_THREAD_NULLITY(myAPIThreadB, "Unable to start B::API thread");
|
||||
|
||||
//_apiEventA->StartTimer(true, 5000);
|
||||
|
||||
Reference in New Issue
Block a user