| Index: base/task_scheduler/task_tracker.cc
|
| diff --git a/base/task_scheduler/task_tracker.cc b/base/task_scheduler/task_tracker.cc
|
| index da21d5ea8ef510c33636cc993b34e3501aa09101..277d2e16851ada19e196aadb6a0c9399bbb572bf 100644
|
| --- a/base/task_scheduler/task_tracker.cc
|
| +++ b/base/task_scheduler/task_tracker.cc
|
| @@ -10,7 +10,6 @@
|
| #include "base/callback.h"
|
| #include "base/debug/task_annotator.h"
|
| #include "base/json/json_writer.h"
|
| -#include "base/logging.h"
|
| #include "base/memory/ptr_util.h"
|
| #include "base/metrics/histogram_macros.h"
|
| #include "base/sequence_token.h"
|
| @@ -379,6 +378,12 @@ void TaskTracker::PerformShutdown() {
|
| }
|
| }
|
|
|
| +#if DCHECK_IS_ON()
|
| +bool TaskTracker::IsPostingBlockShutdownTaskAfterShutdownAllowed() {
|
| + return false;
|
| +}
|
| +#endif
|
| +
|
| bool TaskTracker::BeforePostTask(TaskShutdownBehavior shutdown_behavior) {
|
| if (shutdown_behavior == TaskShutdownBehavior::BLOCK_SHUTDOWN) {
|
| // BLOCK_SHUTDOWN tasks block shutdown between the moment they are posted
|
| @@ -391,7 +396,17 @@ bool TaskTracker::BeforePostTask(TaskShutdownBehavior shutdown_behavior) {
|
| // A BLOCK_SHUTDOWN task posted after shutdown has completed is an
|
| // ordering bug. This aims to catch those early.
|
| DCHECK(shutdown_event_);
|
| - DCHECK(!shutdown_event_->IsSignaled());
|
| + if (shutdown_event_->IsSignaled()) {
|
| + // TODO(robliao): http://crbug.com/698140. Since the service thread
|
| + // doesn't stop processing its own tasks at shutdown, we may still
|
| + // attempt to post a BLOCK_SHUTDOWN task in response to a
|
| + // FileDescriptorWatcher.
|
| +#if DCHECK_IS_ON()
|
| + DCHECK(IsPostingBlockShutdownTaskAfterShutdownAllowed());
|
| +#endif
|
| + state_->DecrementNumTasksBlockingShutdown();
|
| + return false;
|
| + }
|
|
|
| ++num_block_shutdown_tasks_posted_during_shutdown_;
|
|
|
|
|