MessageLoopCurrent
This commit is contained in:
parent
08265ba3e2
commit
5d9ba8b821
2 changed files with 5 additions and 9 deletions
|
@ -14,7 +14,7 @@ BridgeTaskRunner::BridgeTaskRunner() = default;
|
||||||
BridgeTaskRunner::~BridgeTaskRunner() = default;
|
BridgeTaskRunner::~BridgeTaskRunner() = default;
|
||||||
|
|
||||||
void BridgeTaskRunner::MessageLoopIsReady() {
|
void BridgeTaskRunner::MessageLoopIsReady() {
|
||||||
auto* message_loop = base::MessageLoop::current();
|
auto message_loop = base::MessageLoop::current();
|
||||||
CHECK(message_loop);
|
CHECK(message_loop);
|
||||||
for (TaskPair& task : tasks_) {
|
for (TaskPair& task : tasks_) {
|
||||||
message_loop->task_runner()->PostDelayedTask(
|
message_loop->task_runner()->PostDelayedTask(
|
||||||
|
@ -29,7 +29,7 @@ void BridgeTaskRunner::MessageLoopIsReady() {
|
||||||
bool BridgeTaskRunner::PostDelayedTask(const base::Location& from_here,
|
bool BridgeTaskRunner::PostDelayedTask(const base::Location& from_here,
|
||||||
base::OnceClosure task,
|
base::OnceClosure task,
|
||||||
base::TimeDelta delay) {
|
base::TimeDelta delay) {
|
||||||
auto* message_loop = base::MessageLoop::current();
|
auto message_loop = base::MessageLoop::current();
|
||||||
if (!message_loop) {
|
if (!message_loop) {
|
||||||
tasks_.push_back(std::make_tuple(from_here, std::move(task), delay));
|
tasks_.push_back(std::make_tuple(from_here, std::move(task), delay));
|
||||||
return true;
|
return true;
|
||||||
|
@ -40,7 +40,7 @@ bool BridgeTaskRunner::PostDelayedTask(const base::Location& from_here,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BridgeTaskRunner::RunsTasksInCurrentSequence() const {
|
bool BridgeTaskRunner::RunsTasksInCurrentSequence() const {
|
||||||
auto* message_loop = base::MessageLoop::current();
|
auto message_loop = base::MessageLoop::current();
|
||||||
if (!message_loop)
|
if (!message_loop)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ bool BridgeTaskRunner::PostNonNestableDelayedTask(
|
||||||
const base::Location& from_here,
|
const base::Location& from_here,
|
||||||
base::OnceClosure task,
|
base::OnceClosure task,
|
||||||
base::TimeDelta delay) {
|
base::TimeDelta delay) {
|
||||||
auto* message_loop = base::MessageLoop::current();
|
auto message_loop = base::MessageLoop::current();
|
||||||
if (!message_loop) {
|
if (!message_loop) {
|
||||||
non_nestable_tasks_.push_back(
|
non_nestable_tasks_.push_back(
|
||||||
std::make_tuple(from_here, std::move(task), delay));
|
std::make_tuple(from_here, std::move(task), delay));
|
||||||
|
|
|
@ -44,11 +44,7 @@ void HoldRefCallback(const scoped_refptr<PrintJobWorkerOwner>& owner,
|
||||||
|
|
||||||
PrintJob::PrintJob()
|
PrintJob::PrintJob()
|
||||||
: is_job_pending_(false), is_canceling_(false), quit_factory_(this) {
|
: 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
|
DCHECK(base::MessageLoopForUI::IsCurrent());
|
||||||
// of the 'default' type.
|
|
||||||
DCHECK(base::MessageLoopForUI::IsCurrent() ||
|
|
||||||
base::MessageLoop::current()->type() ==
|
|
||||||
base::MessageLoop::TYPE_DEFAULT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintJob::~PrintJob() {
|
PrintJob::~PrintJob() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue