Index: base/task_scheduler/task_tracker_posix.h |
diff --git a/base/task_scheduler/task_tracker_posix.h b/base/task_scheduler/task_tracker_posix.h |
index 53859b21ab63654d9ef7d7a7e68580acd4558b0b..126bbb9a0e8f2b4b8314792e79228550eb2e6c8c 100644 |
--- a/base/task_scheduler/task_tracker_posix.h |
+++ b/base/task_scheduler/task_tracker_posix.h |
@@ -8,8 +8,10 @@ |
#include <memory> |
#include "base/base_export.h" |
+#include "base/logging.h" |
#include "base/macros.h" |
#include "base/task_scheduler/task_tracker.h" |
+#include "base/threading/platform_thread.h" |
namespace base { |
@@ -37,12 +39,31 @@ class BASE_EXPORT TaskTrackerPosix : public TaskTracker { |
watch_file_descriptor_message_loop_ = watch_file_descriptor_message_loop; |
} |
+#if DCHECK_IS_ON() |
+ // TODO(robliao): http://crbug.com/698140. This addresses service thread tasks |
+ // that could run after the task scheduler has shut down. Anything from the |
+ // service thread is exempted from the task scheduler shutdown DCHECKs. |
+ void set_service_thread_handle( |
gab
2017/05/04 17:36:11
Can you set a bit in TLS in TaskTracker instead of
robliao
2017/05/04 17:43:24
That would create a race between starting the thre
robliao
2017/05/04 17:44:06
One more note, this code will go away once we fix
|
+ const PlatformThreadHandle& service_thread_handle) { |
+ DCHECK(!service_thread_handle.is_null()); |
+ service_thread_handle_ = service_thread_handle; |
+ } |
+#endif |
+ |
private: |
// TaskTracker: |
void PerformRunTask(std::unique_ptr<Task> task) override; |
+#if DCHECK_IS_ON() |
+ bool IsExemptFromBlockingShutdownChecks() override; |
gab
2017/05/04 17:36:11
Why is this POSIX only?
robliao
2017/05/04 17:43:24
FileDescriptorWatchers only exist on POSIX. Delaye
|
+#endif |
+ |
MessageLoopForIO* watch_file_descriptor_message_loop_ = nullptr; |
+#if DCHECK_IS_ON() |
+ PlatformThreadHandle service_thread_handle_; |
+#endif |
+ |
DISALLOW_COPY_AND_ASSIGN(TaskTrackerPosix); |
}; |