Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Unified Diff: base/task_scheduler/task_tracker_posix.h

Issue 2857103005: Exempt the Service Thread from BLOCK_SHUTDOWN DCHECKs (Closed)
Patch Set: CR Feedback Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/task_scheduler/task_tracker.cc ('k') | base/task_scheduler/task_tracker_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..040895317a8163b13417ab935dfade45cc74e2d6 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(
+ 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 IsPostingBlockShutdownTaskAfterShutdownAllowed() override;
+#endif
+
MessageLoopForIO* watch_file_descriptor_message_loop_ = nullptr;
+#if DCHECK_IS_ON()
+ PlatformThreadHandle service_thread_handle_;
+#endif
+
DISALLOW_COPY_AND_ASSIGN(TaskTrackerPosix);
};
« no previous file with comments | « base/task_scheduler/task_tracker.cc ('k') | base/task_scheduler/task_tracker_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698