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

Unified Diff: media/base/test_helpers.cc

Issue 2076423004: Remove calls to MessageLoop::current() in media. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
Index: media/base/test_helpers.cc
diff --git a/media/base/test_helpers.cc b/media/base/test_helpers.cc
index 60581554ea797e0e54c71e4f952e7374ca74cf49..fb27562c070560bbeedf5ae7d037b590873b99fd 100644
--- a/media/base/test_helpers.cc
+++ b/media/base/test_helpers.cc
@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/logging.h"
#include "base/macros.h"
-#include "base/message_loop/message_loop.h"
#include "base/pickle.h"
#include "base/run_loop.h"
#include "base/test/test_timeouts.h"
@@ -67,24 +66,24 @@ WaitableMessageLoopEvent::WaitableMessageLoopEvent()
: WaitableMessageLoopEvent(TestTimeouts::action_timeout()) {}
WaitableMessageLoopEvent::WaitableMessageLoopEvent(base::TimeDelta timeout)
- : message_loop_(base::MessageLoop::current()),
+ : task_runner_(base::ThreadTaskRunnerHandle::Get()),
signaled_(false),
status_(PIPELINE_OK),
timeout_(timeout) {
- DCHECK(message_loop_);
+ DCHECK(!!task_runner_);
chcunningham 2016/06/21 01:34:36 Is the !! needed?
fdoray 2016/06/29 15:44:31 no, removed it
}
WaitableMessageLoopEvent::~WaitableMessageLoopEvent() {}
base::Closure WaitableMessageLoopEvent::GetClosure() {
- DCHECK_EQ(message_loop_, base::MessageLoop::current());
+ DCHECK(task_runner_->BelongsToCurrentThread());
return BindToCurrentLoop(base::Bind(
&WaitableMessageLoopEvent::OnCallback, base::Unretained(this),
PIPELINE_OK));
}
PipelineStatusCB WaitableMessageLoopEvent::GetPipelineStatusCB() {
- DCHECK_EQ(message_loop_, base::MessageLoop::current());
+ DCHECK(task_runner_->BelongsToCurrentThread());
return BindToCurrentLoop(base::Bind(
&WaitableMessageLoopEvent::OnCallback, base::Unretained(this)));
}
@@ -94,7 +93,7 @@ void WaitableMessageLoopEvent::RunAndWait() {
}
void WaitableMessageLoopEvent::RunAndWaitForStatus(PipelineStatus expected) {
- DCHECK_EQ(message_loop_, base::MessageLoop::current());
+ DCHECK(task_runner_->BelongsToCurrentThread());
if (signaled_) {
EXPECT_EQ(expected, status_);
return;
@@ -113,7 +112,7 @@ void WaitableMessageLoopEvent::RunAndWaitForStatus(PipelineStatus expected) {
}
void WaitableMessageLoopEvent::OnCallback(PipelineStatus status) {
- DCHECK_EQ(message_loop_, base::MessageLoop::current());
+ DCHECK(task_runner_->BelongsToCurrentThread());
signaled_ = true;
status_ = status;
@@ -123,7 +122,7 @@ void WaitableMessageLoopEvent::OnCallback(PipelineStatus status) {
}
void WaitableMessageLoopEvent::OnTimeout() {
- DCHECK_EQ(message_loop_, base::MessageLoop::current());
+ DCHECK(task_runner_->BelongsToCurrentThread());
ADD_FAILURE() << "Timed out waiting for message loop to quit";
run_loop_->Quit();
}

Powered by Google App Engine
This is Rietveld 408576698