Replace some usage of EventWrapper with rtc::Event.
Bug: webrtc:3380
Change-Id: Id33b19bf107273e6f838aa633784db73d02ae2c2
Reviewed-on: https://webrtc-review.googlesource.com/c/107888
Reviewed-by: Henrik Grunell <henrikg@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25407}
diff --git a/modules/audio_coding/acm2/audio_coding_module_unittest.cc b/modules/audio_coding/acm2/audio_coding_module_unittest.cc
index 5ac6102..302b19c 100644
--- a/modules/audio_coding/acm2/audio_coding_module_unittest.cc
+++ b/modules/audio_coding/acm2/audio_coding_module_unittest.cc
@@ -35,6 +35,7 @@
#include "modules/audio_coding/neteq/tools/packet.h"
#include "modules/audio_coding/neteq/tools/rtp_file_source.h"
#include "rtc_base/criticalsection.h"
+#include "rtc_base/event.h"
#include "rtc_base/messagedigest.h"
#include "rtc_base/numerics/safe_conversions.h"
#include "rtc_base/platform_thread.h"
@@ -42,7 +43,6 @@
#include "rtc_base/system/arch.h"
#include "rtc_base/thread_annotations.h"
#include "system_wrappers/include/clock.h"
-#include "system_wrappers/include/event_wrapper.h"
#include "system_wrappers/include/sleep.h"
#include "test/gtest.h"
#include "test/mock_audio_decoder.h"
@@ -481,7 +481,7 @@
send_thread_(CbSendThread, this, "send"),
insert_packet_thread_(CbInsertPacketThread, this, "insert_packet"),
pull_audio_thread_(CbPullAudioThread, this, "pull_audio"),
- test_complete_(EventWrapper::Create()),
+ test_complete_(false, false),
send_count_(0),
insert_packet_count_(0),
pull_audio_count_(0),
@@ -512,8 +512,8 @@
insert_packet_thread_.Stop();
}
- EventTypeWrapper RunTest() {
- return test_complete_->Wait(10 * 60 * 1000); // 10 minutes' timeout.
+ bool RunTest() {
+ return test_complete_.Wait(10 * 60 * 1000); // 10 minutes' timeout.
}
virtual bool TestDone() {
@@ -538,12 +538,12 @@
SleepMs(1);
if (HasFatalFailure()) {
// End the test early if a fatal failure (ASSERT_*) has occurred.
- test_complete_->Set();
+ test_complete_.Set();
}
++send_count_;
InsertAudioAndVerifyEncoding();
if (TestDone()) {
- test_complete_->Set();
+ test_complete_.Set();
}
return true;
}
@@ -592,7 +592,7 @@
rtc::PlatformThread send_thread_;
rtc::PlatformThread insert_packet_thread_;
rtc::PlatformThread pull_audio_thread_;
- const std::unique_ptr<EventWrapper> test_complete_;
+ rtc::Event test_complete_;
int send_count_;
int insert_packet_count_;
int pull_audio_count_ RTC_GUARDED_BY(crit_sect_);
@@ -607,7 +607,7 @@
#define MAYBE_DoTest DoTest
#endif
TEST_F(AudioCodingModuleMtTestOldApi, MAYBE_DoTest) {
- EXPECT_EQ(kEventSignaled, RunTest());
+ EXPECT_TRUE(RunTest());
}
// This is a multi-threaded ACM test using iSAC. The test encodes audio
@@ -717,7 +717,7 @@
#endif
#if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
TEST_F(AcmIsacMtTestOldApi, MAYBE_DoTest) {
- EXPECT_EQ(kEventSignaled, RunTest());
+ EXPECT_TRUE(RunTest());
}
#endif
@@ -734,7 +734,7 @@
codec_registration_thread_(CbCodecRegistrationThread,
this,
"codec_registration"),
- test_complete_(EventWrapper::Create()),
+ test_complete_(false, false),
codec_registered_(false),
receive_packet_count_(0),
next_insert_packet_time_ms_(0),
@@ -781,8 +781,8 @@
codec_registration_thread_.Stop();
}
- EventTypeWrapper RunTest() {
- return test_complete_->Wait(10 * 60 * 1000); // 10 minutes' timeout.
+ bool RunTest() {
+ return test_complete_.Wait(10 * 60 * 1000); // 10 minutes' timeout.
}
static bool CbReceiveThread(void* context) {
@@ -845,7 +845,7 @@
SleepMs(1);
if (HasFatalFailure()) {
// End the test early if a fatal failure (ASSERT_*) has occurred.
- test_complete_->Set();
+ test_complete_.Set();
}
rtc::CritScope lock(&crit_sect_);
if (!codec_registered_ &&
@@ -856,14 +856,14 @@
codec_registered_ = true;
}
if (codec_registered_ && receive_packet_count_ > kNumPackets) {
- test_complete_->Set();
+ test_complete_.Set();
}
return true;
}
rtc::PlatformThread receive_thread_;
rtc::PlatformThread codec_registration_thread_;
- const std::unique_ptr<EventWrapper> test_complete_;
+ rtc::Event test_complete_;
rtc::CriticalSection crit_sect_;
bool codec_registered_ RTC_GUARDED_BY(crit_sect_);
int receive_packet_count_ RTC_GUARDED_BY(crit_sect_);
@@ -880,7 +880,7 @@
#endif
#if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
TEST_F(AcmReRegisterIsacMtTestOldApi, MAYBE_DoTest) {
- EXPECT_EQ(kEventSignaled, RunTest());
+ EXPECT_TRUE(RunTest());
}
#endif
diff --git a/modules/audio_device/dummy/file_audio_device.h b/modules/audio_device/dummy/file_audio_device.h
index f07690e..210c8f7 100644
--- a/modules/audio_device/dummy/file_audio_device.h
+++ b/modules/audio_device/dummy/file_audio_device.h
@@ -26,7 +26,6 @@
} // namespace rtc
namespace webrtc {
-class EventWrapper;
// This is a fake audio device which plays audio from a file as its microphone
// and plays out into a file.
diff --git a/modules/audio_device/linux/audio_device_alsa_linux.h b/modules/audio_device/linux/audio_device_alsa_linux.h
index 3d15565..d60dcaf 100644
--- a/modules/audio_device/linux/audio_device_alsa_linux.h
+++ b/modules/audio_device/linux/audio_device_alsa_linux.h
@@ -29,7 +29,6 @@
WebRTCAlsaSymbolTable* GetAlsaSymbolTable();
namespace webrtc {
-class EventWrapper;
class AudioDeviceLinuxALSA : public AudioDeviceGeneric {
public:
diff --git a/modules/audio_device/linux/audio_device_pulse_linux.cc b/modules/audio_device/linux/audio_device_pulse_linux.cc
index feff883..d1ff8c4 100644
--- a/modules/audio_device/linux/audio_device_pulse_linux.cc
+++ b/modules/audio_device/linux/audio_device_pulse_linux.cc
@@ -14,7 +14,6 @@
#include "modules/audio_device/linux/latebindingsymboltable_linux.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
-#include "system_wrappers/include/event_wrapper.h"
WebRTCPulseSymbolTable* GetPulseSymbolTable() {
static WebRTCPulseSymbolTable* pulse_symbol_table =
@@ -33,10 +32,10 @@
AudioDeviceLinuxPulse::AudioDeviceLinuxPulse()
: _ptrAudioBuffer(NULL),
- _timeEventRec(*EventWrapper::Create()),
- _timeEventPlay(*EventWrapper::Create()),
- _recStartEvent(*EventWrapper::Create()),
- _playStartEvent(*EventWrapper::Create()),
+ _timeEventRec(false, false),
+ _timeEventPlay(false, false),
+ _recStartEvent(false, false),
+ _playStartEvent(false, false),
_inputDeviceIndex(0),
_outputDeviceIndex(0),
_inputDeviceIsSpecified(false),
@@ -113,11 +112,6 @@
delete[] _recDeviceName;
_recDeviceName = NULL;
}
-
- delete &_recStartEvent;
- delete &_playStartEvent;
- delete &_timeEventRec;
- delete &_timeEventPlay;
}
void AudioDeviceLinuxPulse::AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) {
@@ -1067,7 +1061,7 @@
// The audio thread will signal when recording has started.
_timeEventRec.Set();
- if (kEventTimeout == _recStartEvent.Wait(10000)) {
+ if (!_recStartEvent.Wait(10000)) {
{
rtc::CritScope lock(&_critSect);
_startRec = false;
@@ -1182,7 +1176,7 @@
// The audio thread will signal when playout has started.
_timeEventPlay.Set();
- if (kEventTimeout == _playStartEvent.Wait(10000)) {
+ if (!_playStartEvent.Wait(10000)) {
{
rtc::CritScope lock(&_critSect);
_startPlay = false;
@@ -1996,14 +1990,8 @@
}
bool AudioDeviceLinuxPulse::PlayThreadProcess() {
- switch (_timeEventPlay.Wait(1000)) {
- case kEventSignaled:
- break;
- case kEventError:
- RTC_LOG(LS_WARNING) << "EventWrapper::Wait() failed";
- return true;
- case kEventTimeout:
- return true;
+ if (!_timeEventPlay.Wait(1000)) {
+ return true;
}
rtc::CritScope lock(&_critSect);
@@ -2170,14 +2158,8 @@
}
bool AudioDeviceLinuxPulse::RecThreadProcess() {
- switch (_timeEventRec.Wait(1000)) {
- case kEventSignaled:
- break;
- case kEventError:
- RTC_LOG(LS_WARNING) << "EventWrapper::Wait() failed";
- return true;
- case kEventTimeout:
- return true;
+ if (!_timeEventRec.Wait(1000)) {
+ return true;
}
rtc::CritScope lock(&_critSect);
diff --git a/modules/audio_device/linux/audio_device_pulse_linux.h b/modules/audio_device/linux/audio_device_pulse_linux.h
index 263ed75..4de87fc 100644
--- a/modules/audio_device/linux/audio_device_pulse_linux.h
+++ b/modules/audio_device/linux/audio_device_pulse_linux.h
@@ -20,6 +20,7 @@
#include "modules/audio_device/linux/audio_mixer_manager_pulse_linux.h"
#include "modules/audio_device/linux/pulseaudiosymboltable_linux.h"
#include "rtc_base/criticalsection.h"
+#include "rtc_base/event.h"
#include "rtc_base/platform_thread.h"
#include "rtc_base/thread_annotations.h"
#include "rtc_base/thread_checker.h"
@@ -103,7 +104,6 @@
WebRTCPulseSymbolTable* GetPulseSymbolTable();
namespace webrtc {
-class EventWrapper;
class AudioDeviceLinuxPulse : public AudioDeviceGeneric {
public:
@@ -262,10 +262,10 @@
AudioDeviceBuffer* _ptrAudioBuffer;
rtc::CriticalSection _critSect;
- EventWrapper& _timeEventRec;
- EventWrapper& _timeEventPlay;
- EventWrapper& _recStartEvent;
- EventWrapper& _playStartEvent;
+ rtc::Event _timeEventRec;
+ rtc::Event _timeEventPlay;
+ rtc::Event _recStartEvent;
+ rtc::Event _playStartEvent;
// TODO(pbos): Remove unique_ptr and use directly without resetting.
std::unique_ptr<rtc::PlatformThread> _ptrThreadPlay;
diff --git a/modules/audio_processing/audio_processing_performance_unittest.cc b/modules/audio_processing/audio_processing_performance_unittest.cc
index 95f736c..7c774f2 100644
--- a/modules/audio_processing/audio_processing_performance_unittest.cc
+++ b/modules/audio_processing/audio_processing_performance_unittest.cc
@@ -18,11 +18,11 @@
#include "api/array_view.h"
#include "modules/audio_processing/test/test_utils.h"
#include "rtc_base/atomicops.h"
+#include "rtc_base/event.h"
#include "rtc_base/numerics/safe_conversions.h"
#include "rtc_base/platform_thread.h"
#include "rtc_base/random.h"
#include "system_wrappers/include/clock.h"
-#include "system_wrappers/include/event_wrapper.h"
#include "test/gtest.h"
#include "test/testsupport/perf_test.h"
@@ -391,7 +391,7 @@
class CallSimulator : public ::testing::TestWithParam<SimulationConfig> {
public:
CallSimulator()
- : test_complete_(EventWrapper::Create()),
+ : test_complete_(false, false),
render_thread_(
new rtc::PlatformThread(RenderProcessorThreadFunc, this, "render")),
capture_thread_(new rtc::PlatformThread(CaptureProcessorThreadFunc,
@@ -401,10 +401,10 @@
simulation_config_(static_cast<SimulationConfig>(GetParam())) {}
// Run the call simulation with a timeout.
- EventTypeWrapper Run() {
+ bool Run() {
StartThreads();
- EventTypeWrapper result = test_complete_->Wait(kTestTimeout);
+ bool result = test_complete_.Wait(kTestTimeout);
StopThreads();
@@ -420,7 +420,7 @@
// done.
bool MaybeEndTest() {
if (frame_counters_.BothCountersExceedeThreshold(kMinNumFramesToProcess)) {
- test_complete_->Set();
+ test_complete_.Set();
return true;
}
return false;
@@ -570,7 +570,7 @@
}
// Event handler for the test.
- const std::unique_ptr<EventWrapper> test_complete_;
+ rtc::Event test_complete_;
// Thread related variables.
std::unique_ptr<rtc::PlatformThread> render_thread_;
@@ -619,7 +619,7 @@
// TODO(peah): Reactivate once issue 7712 has been resolved.
TEST_P(CallSimulator, DISABLED_ApiCallDurationTest) {
// Run test and verify that it did not time out.
- EXPECT_EQ(kEventSignaled, Run());
+ EXPECT_TRUE(Run());
}
INSTANTIATE_TEST_CASE_P(
diff --git a/modules/utility/source/process_thread_impl.cc b/modules/utility/source/process_thread_impl.cc
index 9756250..73338ac 100644
--- a/modules/utility/source/process_thread_impl.cc
+++ b/modules/utility/source/process_thread_impl.cc
@@ -44,7 +44,7 @@
}
ProcessThreadImpl::ProcessThreadImpl(const char* thread_name)
- : wake_up_(EventWrapper::Create()),
+ : wake_up_(/*manual_reset=*/false, /*initially_signaled=*/false),
stop_(false),
thread_name_(thread_name) {}
@@ -85,7 +85,7 @@
stop_ = true;
}
- wake_up_->Set();
+ wake_up_.Set();
thread_->Stop();
stop_ = false;
@@ -104,7 +104,7 @@
m.next_callback = kCallProcessImmediately;
}
}
- wake_up_->Set();
+ wake_up_.Set();
}
void ProcessThreadImpl::PostTask(std::unique_ptr<rtc::QueuedTask> task) {
@@ -113,7 +113,7 @@
rtc::CritScope lock(&lock_);
queue_.push(task.release());
}
- wake_up_->Set();
+ wake_up_.Set();
}
void ProcessThreadImpl::RegisterModule(Module* module,
@@ -147,7 +147,7 @@
// Wake the thread calling ProcessThreadImpl::Process() to update the
// waiting time. The waiting time for the just registered module may be
// shorter than all other registered modules.
- wake_up_->Set();
+ wake_up_.Set();
}
void ProcessThreadImpl::DeRegisterModule(Module* module) {
@@ -217,7 +217,7 @@
int64_t time_to_wait = next_checkpoint - rtc::TimeMillis();
if (time_to_wait > 0)
- wake_up_->Wait(static_cast<unsigned long>(time_to_wait));
+ wake_up_.Wait(static_cast<int>(time_to_wait));
return true;
}
diff --git a/modules/utility/source/process_thread_impl.h b/modules/utility/source/process_thread_impl.h
index 6f119d4..fff21d0 100644
--- a/modules/utility/source/process_thread_impl.h
+++ b/modules/utility/source/process_thread_impl.h
@@ -19,11 +19,11 @@
#include "modules/include/module.h"
#include "modules/utility/include/process_thread.h"
#include "rtc_base/criticalsection.h"
+#include "rtc_base/event.h"
#include "rtc_base/location.h"
#include "rtc_base/platform_thread.h"
#include "rtc_base/task_queue.h"
#include "rtc_base/thread_checker.h"
-#include "system_wrappers/include/event_wrapper.h"
namespace webrtc {
@@ -75,7 +75,7 @@
rtc::CriticalSection lock_; // Used to guard modules_, tasks_ and stop_.
rtc::ThreadChecker thread_checker_;
- const std::unique_ptr<EventWrapper> wake_up_;
+ rtc::Event wake_up_;
// TODO(pbos): Remove unique_ptr and stop recreating the thread.
std::unique_ptr<rtc::PlatformThread> thread_;
diff --git a/modules/utility/source/process_thread_impl_unittest.cc b/modules/utility/source/process_thread_impl_unittest.cc
index d5926b2..730ea94 100644
--- a/modules/utility/source/process_thread_impl_unittest.cc
+++ b/modules/utility/source/process_thread_impl_unittest.cc
@@ -42,14 +42,14 @@
class RaiseEventTask : public rtc::QueuedTask {
public:
- RaiseEventTask(EventWrapper* event) : event_(event) {}
+ RaiseEventTask(rtc::Event* event) : event_(event) {}
bool Run() override {
event_->Set();
return true;
}
private:
- EventWrapper* event_;
+ rtc::Event* event_;
};
ACTION_P(SetEvent, event) {
@@ -83,19 +83,19 @@
ProcessThreadImpl thread("ProcessThread");
thread.Start();
- std::unique_ptr<EventWrapper> event(EventWrapper::Create());
+ rtc::Event event(false, false);
MockModule module;
EXPECT_CALL(module, TimeUntilNextProcess())
.WillOnce(Return(0))
.WillRepeatedly(Return(1));
EXPECT_CALL(module, Process())
- .WillOnce(DoAll(SetEvent(event.get()), Return()))
+ .WillOnce(DoAll(SetEvent(&event), Return()))
.WillRepeatedly(Return());
EXPECT_CALL(module, ProcessThreadAttached(&thread)).Times(1);
thread.RegisterModule(&module, RTC_FROM_HERE);
- EXPECT_EQ(kEventSignaled, event->Wait(kEventWaitTimeout));
+ EXPECT_TRUE(event.Wait(kEventWaitTimeout));
EXPECT_CALL(module, ProcessThreadAttached(nullptr)).Times(1);
thread.Stop();
@@ -105,21 +105,21 @@
// call to Start().
TEST(ProcessThreadImpl, ProcessCall2) {
ProcessThreadImpl thread("ProcessThread");
- std::unique_ptr<EventWrapper> event(EventWrapper::Create());
+ rtc::Event event(false, false);
MockModule module;
EXPECT_CALL(module, TimeUntilNextProcess())
.WillOnce(Return(0))
.WillRepeatedly(Return(1));
EXPECT_CALL(module, Process())
- .WillOnce(DoAll(SetEvent(event.get()), Return()))
+ .WillOnce(DoAll(SetEvent(&event), Return()))
.WillRepeatedly(Return());
thread.RegisterModule(&module, RTC_FROM_HERE);
EXPECT_CALL(module, ProcessThreadAttached(&thread)).Times(1);
thread.Start();
- EXPECT_EQ(kEventSignaled, event->Wait(kEventWaitTimeout));
+ EXPECT_TRUE(event.Wait(kEventWaitTimeout));
EXPECT_CALL(module, ProcessThreadAttached(nullptr)).Times(1);
thread.Stop();
@@ -129,7 +129,7 @@
// After unregistration, we should not receive any further callbacks.
TEST(ProcessThreadImpl, Deregister) {
ProcessThreadImpl thread("ProcessThread");
- std::unique_ptr<EventWrapper> event(EventWrapper::Create());
+ rtc::Event event(false, false);
int process_count = 0;
MockModule module;
@@ -137,8 +137,7 @@
.WillOnce(Return(0))
.WillRepeatedly(Return(1));
EXPECT_CALL(module, Process())
- .WillOnce(
- DoAll(SetEvent(event.get()), Increment(&process_count), Return()))
+ .WillOnce(DoAll(SetEvent(&event), Increment(&process_count), Return()))
.WillRepeatedly(DoAll(Increment(&process_count), Return()));
thread.RegisterModule(&module, RTC_FROM_HERE);
@@ -146,7 +145,7 @@
EXPECT_CALL(module, ProcessThreadAttached(&thread)).Times(1);
thread.Start();
- EXPECT_EQ(kEventSignaled, event->Wait(kEventWaitTimeout));
+ EXPECT_TRUE(event.Wait(kEventWaitTimeout));
EXPECT_CALL(module, ProcessThreadAttached(nullptr)).Times(1);
thread.DeRegisterModule(&module);
@@ -155,7 +154,7 @@
int count_after_deregister = process_count;
// We shouldn't get any more callbacks.
- EXPECT_EQ(kEventTimeout, event->Wait(20));
+ EXPECT_FALSE(event.Wait(20));
EXPECT_EQ(count_after_deregister, process_count);
thread.Stop();
}
@@ -167,7 +166,7 @@
ProcessThreadImpl thread("ProcessThread");
thread.Start();
- std::unique_ptr<EventWrapper> event(EventWrapper::Create());
+ rtc::Event event(false, false);
MockModule module;
int64_t start_time = 0;
@@ -176,8 +175,7 @@
.WillOnce(DoAll(SetTimestamp(&start_time), Return(milliseconds)))
.WillRepeatedly(Return(milliseconds));
EXPECT_CALL(module, Process())
- .WillOnce(
- DoAll(SetTimestamp(&called_time), SetEvent(event.get()), Return()))
+ .WillOnce(DoAll(SetTimestamp(&called_time), SetEvent(&event), Return()))
.WillRepeatedly(Return());
EXPECT_CALL(module, ProcessThreadAttached(&thread)).Times(1);
@@ -185,7 +183,7 @@
// Add a buffer of 50ms due to slowness of some trybots
// (e.g. win_drmemory_light)
- EXPECT_EQ(kEventSignaled, event->Wait(milliseconds + 50));
+ EXPECT_TRUE(event.Wait(milliseconds + 50));
EXPECT_CALL(module, ProcessThreadAttached(nullptr)).Times(1);
thread.Stop();
@@ -230,7 +228,7 @@
ProcessThreadImpl thread("ProcessThread");
thread.Start();
- std::unique_ptr<EventWrapper> event(EventWrapper::Create());
+ rtc::Event event(false, false);
MockModule module;
int callback_count = 0;
@@ -242,7 +240,7 @@
EXPECT_CALL(module, ProcessThreadAttached(&thread)).Times(1);
thread.RegisterModule(&module, RTC_FROM_HERE);
- EXPECT_EQ(kEventTimeout, event->Wait(1000));
+ EXPECT_TRUE(event.Wait(1000));
EXPECT_CALL(module, ProcessThreadAttached(nullptr)).Times(1);
thread.Stop();
@@ -261,8 +259,8 @@
ProcessThreadImpl thread("ProcessThread");
thread.Start();
- std::unique_ptr<EventWrapper> started(EventWrapper::Create());
- std::unique_ptr<EventWrapper> called(EventWrapper::Create());
+ rtc::Event started(false, false);
+ rtc::Event called(false, false);
MockModule module;
int64_t start_time;
@@ -276,20 +274,19 @@
// The second time TimeUntilNextProcess is then called, is after Process
// has been called and we don't expect any more calls.
EXPECT_CALL(module, TimeUntilNextProcess())
- .WillOnce(DoAll(SetTimestamp(&start_time), SetEvent(started.get()),
- Return(1000)))
+ .WillOnce(
+ DoAll(SetTimestamp(&start_time), SetEvent(&started), Return(1000)))
.WillOnce(Return(1000));
EXPECT_CALL(module, Process())
- .WillOnce(
- DoAll(SetTimestamp(&called_time), SetEvent(called.get()), Return()))
+ .WillOnce(DoAll(SetTimestamp(&called_time), SetEvent(&called), Return()))
.WillRepeatedly(Return());
EXPECT_CALL(module, ProcessThreadAttached(&thread)).Times(1);
thread.RegisterModule(&module, RTC_FROM_HERE);
- EXPECT_EQ(kEventSignaled, started->Wait(kEventWaitTimeout));
+ EXPECT_TRUE(started.Wait(kEventWaitTimeout));
thread.WakeUp(&module);
- EXPECT_EQ(kEventSignaled, called->Wait(kEventWaitTimeout));
+ EXPECT_TRUE(called.Wait(kEventWaitTimeout));
EXPECT_CALL(module, ProcessThreadAttached(nullptr)).Times(1);
thread.Stop();
@@ -304,11 +301,11 @@
// thread.
TEST(ProcessThreadImpl, PostTask) {
ProcessThreadImpl thread("ProcessThread");
- std::unique_ptr<EventWrapper> task_ran(EventWrapper::Create());
- std::unique_ptr<RaiseEventTask> task(new RaiseEventTask(task_ran.get()));
+ rtc::Event task_ran(false, false);
+ std::unique_ptr<RaiseEventTask> task(new RaiseEventTask(&task_ran));
thread.Start();
thread.PostTask(std::move(task));
- EXPECT_EQ(kEventSignaled, task_ran->Wait(kEventWaitTimeout));
+ EXPECT_TRUE(task_ran.Wait(kEventWaitTimeout));
thread.Stop();
}
diff --git a/system_wrappers/include/event_wrapper.h b/system_wrappers/include/event_wrapper.h
index 0531ddb..989e792 100644
--- a/system_wrappers/include/event_wrapper.h
+++ b/system_wrappers/include/event_wrapper.h
@@ -12,11 +12,7 @@
#define SYSTEM_WRAPPERS_INCLUDE_EVENT_WRAPPER_H_
namespace webrtc {
-enum EventTypeWrapper {
- kEventSignaled = 1,
- kEventError = 2,
- kEventTimeout = 3
-};
+enum EventTypeWrapper { kEventSignaled = 1, kEventTimeout = 2 };
#define WEBRTC_EVENT_INFINITE 0xffffffff