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 f957e4c0daf4d8b402a9b0ef413365b48955be90..53859b21ab63654d9ef7d7a7e68580acd4558b0b 100644 |
--- a/base/task_scheduler/task_tracker_posix.h |
+++ b/base/task_scheduler/task_tracker_posix.h |
@@ -21,18 +21,27 @@ struct Task; |
// A TaskTracker that instantiates a FileDescriptorWatcher in the scope in which |
// a task runs. Used on all POSIX platforms except NaCl SFI. |
+// set_watch_file_descriptor_message_loop() must be called before the |
+// TaskTracker can run tasks. |
class BASE_EXPORT TaskTrackerPosix : public TaskTracker { |
public: |
- // |watch_file_descriptor_message_loop| is used to setup FileDescriptorWatcher |
- // in the scope in which a Task runs. |
- TaskTrackerPosix(MessageLoopForIO* watch_file_descriptor_message_loop); |
+ TaskTrackerPosix(); |
~TaskTrackerPosix(); |
+ // Sets the MessageLoopForIO with which to setup FileDescriptorWatcher in the |
+ // scope in which tasks run. Must be called before starting to run tasks. |
+ // External synchronization is required between a call to this and a call to |
+ // RunTask(). |
+ void set_watch_file_descriptor_message_loop( |
+ MessageLoopForIO* watch_file_descriptor_message_loop) { |
+ watch_file_descriptor_message_loop_ = watch_file_descriptor_message_loop; |
+ } |
+ |
private: |
// TaskTracker: |
void PerformRunTask(std::unique_ptr<Task> task) override; |
- MessageLoopForIO* const watch_file_descriptor_message_loop_; |
+ MessageLoopForIO* watch_file_descriptor_message_loop_ = nullptr; |
DISALLOW_COPY_AND_ASSIGN(TaskTrackerPosix); |
}; |