Chromium Code Reviews| Index: base/task_scheduler/scheduler_worker.h |
| diff --git a/base/task_scheduler/scheduler_worker.h b/base/task_scheduler/scheduler_worker.h |
| index b9958be019bd479419367fae739a3808a972d92e..83843da570bc2c0af334ac3e09926bef8c3580ed 100644 |
| --- a/base/task_scheduler/scheduler_worker.h |
| +++ b/base/task_scheduler/scheduler_worker.h |
| @@ -38,7 +38,8 @@ class TaskTracker; |
| class BASE_EXPORT SchedulerWorker { |
| public: |
| // Delegate interface for SchedulerWorker. The methods are always called from |
| - // a thread managed by the SchedulerWorker instance. |
| + // a thread managed by the SchedulerWorker instance. The methods are never |
|
gab
2016/10/19 18:12:23
s/a thread/the thread/ (and remove last sentence -
fdoray
2016/10/20 13:45:02
Done.
|
| + // called concurrently. |
| class Delegate { |
| public: |
| virtual ~Delegate() = default; |
| @@ -47,8 +48,7 @@ class BASE_EXPORT SchedulerWorker { |
| // If a thread is recreated after detachment, |detach_duration| is the time |
| // elapsed since detachment. Otherwise, if this is the first thread created |
| // for |worker|, |detach_duration| is TimeDelta::Max(). |
| - virtual void OnMainEntry(SchedulerWorker* worker, |
| - const TimeDelta& detach_duration) = 0; |
| + virtual void OnMainEntry(SchedulerWorker* worker) = 0; |
| // Called by a thread managed by |worker| to get a Sequence from which to |
| // run a Task. |
| @@ -83,6 +83,11 @@ class BASE_EXPORT SchedulerWorker { |
| // This MUST return false if SchedulerWorker::JoinForTesting() is in |
| // progress. |
| virtual bool CanDetach(SchedulerWorker* worker) = 0; |
| + |
| + // Called by a thread before it detaches. This method is not allowed to |
| + // acquire a SchedulerLock because it is called within the scope of another |
| + // SchedulerLock. |
| + virtual void OnDetach() = 0; |
| }; |
| enum class InitialState { ALIVE, DETACHED }; |
| @@ -143,10 +148,6 @@ class BASE_EXPORT SchedulerWorker { |
| // The underlying thread for this SchedulerWorker. |
| std::unique_ptr<Thread> thread_; |
| - // Time of the last successful Detach(). Is only accessed from the thread |
| - // managed by this SchedulerWorker. |
| - TimeTicks last_detach_time_; |
| - |
| const ThreadPriority priority_hint_; |
| const std::unique_ptr<Delegate> delegate_; |
| TaskTracker* const task_tracker_; |