Introduce TaskRunner::RunsTasksInCurrentSequence()

https://codereview.chromium.org/2823103003
This commit is contained in:
Aleksei Kuzmin 2017-08-08 00:14:35 +03:00 committed by Cheng Zhao
parent f2bcdab037
commit 11fa935359
9 changed files with 26 additions and 26 deletions

View file

@ -62,7 +62,7 @@ PrintJob::~PrintJob() {
DCHECK(!is_job_pending_);
DCHECK(!is_canceling_);
DCHECK(!worker_ || !worker_->IsRunning());
DCHECK(RunsTasksOnCurrentThread());
DCHECK(RunsTasksInCurrentSequence());
}
void PrintJob::Initialize(PrintJobWorkerOwner* job,
@ -93,7 +93,7 @@ void PrintJob::Initialize(PrintJobWorkerOwner* job,
void PrintJob::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
DCHECK(RunsTasksOnCurrentThread());
DCHECK(RunsTasksInCurrentSequence());
DCHECK_EQ(chrome::NOTIFICATION_PRINT_JOB_EVENT, type);
OnNotifyPrintJobEvent(*content::Details<JobEventDetails>(details).ptr());
@ -122,7 +122,7 @@ int PrintJob::cookie() const {
}
void PrintJob::StartPrinting() {
DCHECK(RunsTasksOnCurrentThread());
DCHECK(RunsTasksInCurrentSequence());
if (!worker_->IsRunning() || is_job_pending_) {
NOTREACHED();
return;
@ -147,7 +147,7 @@ void PrintJob::StartPrinting() {
}
void PrintJob::Stop() {
DCHECK(RunsTasksOnCurrentThread());
DCHECK(RunsTasksInCurrentSequence());
if (quit_factory_.HasWeakPtrs()) {
// In case we're running a nested message loop to wait for a job to finish,
@ -176,7 +176,7 @@ void PrintJob::Cancel() {
// Be sure to live long enough.
scoped_refptr<PrintJob> handle(this);
DCHECK(RunsTasksOnCurrentThread());
DCHECK(RunsTasksInCurrentSequence());
if (worker_ && worker_->IsRunning()) {
// Call this right now so it renders the context invalid. Do not use
// InvokeLater since it would take too much time.
@ -419,7 +419,7 @@ void PrintJob::OnDocumentDone() {
}
void PrintJob::ControlledWorkerShutdown() {
DCHECK(RunsTasksOnCurrentThread());
DCHECK(RunsTasksInCurrentSequence());
// The deadlock this code works around is specific to window messaging on
// Windows, so we aren't likely to need it on any other platforms.