MessageLoopCurrent

This commit is contained in:
Jeremy Apthorp 2018-09-14 17:19:19 -07:00 committed by Aleksei Kuzmin
parent 08265ba3e2
commit 5d9ba8b821
2 changed files with 5 additions and 9 deletions

View file

@ -14,7 +14,7 @@ BridgeTaskRunner::BridgeTaskRunner() = default;
BridgeTaskRunner::~BridgeTaskRunner() = default;
void BridgeTaskRunner::MessageLoopIsReady() {
auto* message_loop = base::MessageLoop::current();
auto message_loop = base::MessageLoop::current();
CHECK(message_loop);
for (TaskPair& task : tasks_) {
message_loop->task_runner()->PostDelayedTask(
@ -29,7 +29,7 @@ void BridgeTaskRunner::MessageLoopIsReady() {
bool BridgeTaskRunner::PostDelayedTask(const base::Location& from_here,
base::OnceClosure task,
base::TimeDelta delay) {
auto* message_loop = base::MessageLoop::current();
auto message_loop = base::MessageLoop::current();
if (!message_loop) {
tasks_.push_back(std::make_tuple(from_here, std::move(task), delay));
return true;
@ -40,7 +40,7 @@ bool BridgeTaskRunner::PostDelayedTask(const base::Location& from_here,
}
bool BridgeTaskRunner::RunsTasksInCurrentSequence() const {
auto* message_loop = base::MessageLoop::current();
auto message_loop = base::MessageLoop::current();
if (!message_loop)
return true;
@ -51,7 +51,7 @@ bool BridgeTaskRunner::PostNonNestableDelayedTask(
const base::Location& from_here,
base::OnceClosure task,
base::TimeDelta delay) {
auto* message_loop = base::MessageLoop::current();
auto message_loop = base::MessageLoop::current();
if (!message_loop) {
non_nestable_tasks_.push_back(
std::make_tuple(from_here, std::move(task), delay));

View file

@ -44,11 +44,7 @@ void HoldRefCallback(const scoped_refptr<PrintJobWorkerOwner>& owner,
PrintJob::PrintJob()
: is_job_pending_(false), is_canceling_(false), quit_factory_(this) {
// This is normally a UI message loop, but in unit tests, the message loop is
// of the 'default' type.
DCHECK(base::MessageLoopForUI::IsCurrent() ||
base::MessageLoop::current()->type() ==
base::MessageLoop::TYPE_DEFAULT);
DCHECK(base::MessageLoopForUI::IsCurrent());
}
PrintJob::~PrintJob() {