Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Unified Diff: base/threading/thread_perftest.cc

Issue 2033433002: Migrate WaitableEvent enum-based constructor in templated EventPerfTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@base
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/thread_perftest.cc
diff --git a/base/threading/thread_perftest.cc b/base/threading/thread_perftest.cc
index 2071889848469d73eb303cfe119943e808c39555..1df13883169ebab2e73ef39dd31b620913fa83ca 100644
--- a/base/threading/thread_perftest.cc
+++ b/base/threading/thread_perftest.cc
@@ -180,8 +180,11 @@ template <typename WaitableEventType>
class EventPerfTest : public ThreadPerfTest {
public:
void Init() override {
- for (size_t i = 0; i < threads_.size(); i++)
- events_.push_back(new WaitableEventType(false, false));
+ for (size_t i = 0; i < threads_.size(); i++) {
+ events_.push_back(
+ new WaitableEventType(WaitableEvent::ResetPolicy::AUTOMATIC,
+ WaitableEvent::InitialState::NOT_SIGNALED));
+ }
}
void Reset() override { events_.clear(); }
@@ -228,10 +231,11 @@ TEST_F(WaitableEventPerfTest, EventPingPong) {
// Build a minimal event using ConditionVariable.
class ConditionVariableEvent {
public:
- ConditionVariableEvent(bool manual_reset, bool initially_signaled)
+ ConditionVariableEvent(WaitableEvent::ResetPolicy reset_policy,
+ WaitableEvent::InitialState initial_state)
: cond_(&lock_), signaled_(false) {
- DCHECK(!manual_reset);
- DCHECK(!initially_signaled);
+ DCHECK_EQ(WaitableEvent::ResetPolicy::AUTOMATIC, reset_policy);
+ DCHECK_EQ(WaitableEvent::InitialState::NOT_SIGNALED, initial_state);
}
void Signal() {
@@ -267,9 +271,10 @@ TEST_F(ConditionVariablePerfTest, EventPingPong) {
// way to force a context switch, we should use that instead.
class PthreadEvent {
public:
- PthreadEvent(bool manual_reset, bool initially_signaled) {
- DCHECK(!manual_reset);
- DCHECK(!initially_signaled);
+ PthreadEvent(WaitableEvent::ResetPolicy reset_policy,
+ WaitableEvent::InitialState initial_state) {
+ DCHECK_EQ(WaitableEvent::ResetPolicy::AUTOMATIC, reset_policy);
+ DCHECK_EQ(WaitableEvent::InitialState::NOT_SIGNALED, initial_state);
pthread_mutex_init(&mutex_, 0);
pthread_cond_init(&cond_, 0);
signaled_ = false;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698