Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_TASK_SCHEDULER_TASK_TRACKER_POSIX_H_ | 5 #ifndef BASE_TASK_SCHEDULER_TASK_TRACKER_POSIX_H_ |
| 6 #define BASE_TASK_SCHEDULER_TASK_TRACKER_POSIX_H_ | 6 #define BASE_TASK_SCHEDULER_TASK_TRACKER_POSIX_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/task_scheduler/task_tracker.h" | 12 #include "base/task_scheduler/task_tracker.h" |
| 13 | 13 |
| 14 namespace base { | 14 namespace base { |
| 15 | 15 |
| 16 class MessageLoopForIO; | 16 class MessageLoopForIO; |
| 17 | 17 |
| 18 namespace internal { | 18 namespace internal { |
| 19 | 19 |
| 20 struct Task; | 20 struct Task; |
| 21 | 21 |
| 22 // A TaskTracker that instantiates a FileDescriptorWatcher in the scope in which | 22 // A TaskTracker that instantiates a FileDescriptorWatcher in the scope in which |
| 23 // a task runs. Used on all POSIX platforms except NaCl SFI. | 23 // a task runs. Used on all POSIX platforms except NaCl SFI. Start() must be |
| 24 // called before the TaskTracker can run tasks. | |
| 24 class BASE_EXPORT TaskTrackerPosix : public TaskTracker { | 25 class BASE_EXPORT TaskTrackerPosix : public TaskTracker { |
| 25 public: | 26 public: |
| 27 TaskTrackerPosix(); | |
| 28 ~TaskTrackerPosix(); | |
| 29 | |
| 26 // |watch_file_descriptor_message_loop| is used to setup FileDescriptorWatcher | 30 // |watch_file_descriptor_message_loop| is used to setup FileDescriptorWatcher |
| 27 // in the scope in which a Task runs. | 31 // in the scope in which a Task runs. |
| 28 TaskTrackerPosix(MessageLoopForIO* watch_file_descriptor_message_loop); | 32 void Start(MessageLoopForIO* watch_file_descriptor_message_loop); |
| 29 ~TaskTrackerPosix(); | |
| 30 | 33 |
| 31 private: | 34 private: |
| 32 // TaskTracker: | 35 // TaskTracker: |
| 33 void PerformRunTask(std::unique_ptr<Task> task) override; | 36 void PerformRunTask(std::unique_ptr<Task> task) override; |
| 34 | 37 |
| 35 MessageLoopForIO* const watch_file_descriptor_message_loop_; | 38 // 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
| |
| 39 MessageLoopForIO* watch_file_descriptor_message_loop_; | |
| 36 | 40 |
| 37 DISALLOW_COPY_AND_ASSIGN(TaskTrackerPosix); | 41 DISALLOW_COPY_AND_ASSIGN(TaskTrackerPosix); |
| 38 }; | 42 }; |
| 39 | 43 |
| 40 } // namespace internal | 44 } // namespace internal |
| 41 } // namespace base | 45 } // namespace base |
| 42 | 46 |
| 43 #endif // BASE_TASK_SCHEDULER_TASK_TRACKER_POSIX_H_ | 47 #endif // BASE_TASK_SCHEDULER_TASK_TRACKER_POSIX_H_ |
| OLD | NEW |