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

Unified Diff: base/task_scheduler/task_tracker_posix.h

Issue 2816653003: Do not take a MessageLoopForIO in the constructor of TaskTrackerPosix. (Closed)
Patch Set: self-review Created 3 years, 8 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
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..db56570229503dc16bc29b35d59a1ea4c680ae30 100644
--- a/base/task_scheduler/task_tracker_posix.h
+++ b/base/task_scheduler/task_tracker_posix.h
@@ -20,19 +20,23 @@ namespace internal {
struct Task;
// A TaskTracker that instantiates a FileDescriptorWatcher in the scope in which
-// a task runs. Used on all POSIX platforms except NaCl SFI.
+// a task runs. Used on all POSIX platforms except NaCl SFI. Start() must be
+// called before the TaskTracker can run tasks.
class BASE_EXPORT TaskTrackerPosix : public TaskTracker {
public:
+ TaskTrackerPosix();
+ ~TaskTrackerPosix();
+
// |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();
+ void Start(MessageLoopForIO* watch_file_descriptor_message_loop);
private:
// TaskTracker:
void PerformRunTask(std::unique_ptr<Task> task) override;
- MessageLoopForIO* const watch_file_descriptor_message_loop_;
+ // Set in Start() and cannot be read before Start().
gab 2017/04/12 19:17:34 s/cannot/must not/
fdoray 2017/04/13 12:29:08 n/a. superseded by comment about external synchron
+ MessageLoopForIO* watch_file_descriptor_message_loop_;
DISALLOW_COPY_AND_ASSIGN(TaskTrackerPosix);
};

Powered by Google App Engine
This is Rietveld 408576698