Chromium Code Reviews| Index: base/task_scheduler/scheduler_worker_thread_delegate.h |
| diff --git a/base/task_scheduler/scheduler_worker_thread_delegate.h b/base/task_scheduler/scheduler_worker_thread_delegate.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c6a3347d3ac66c254309683b1f8061096c0c2858 |
| --- /dev/null |
| +++ b/base/task_scheduler/scheduler_worker_thread_delegate.h |
| @@ -0,0 +1,36 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef BASE_TASK_SCHEDULER_SCHEDULER_WORKER_THREAD_DELEGATE_H_ |
| +#define BASE_TASK_SCHEDULER_SCHEDULER_WORKER_THREAD_DELEGATE_H_ |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "base/task_scheduler/sequence.h" |
| + |
| +namespace base { |
| +namespace internal { |
| + |
| +// Delegate interface for SchedulerWorkerThread. The methods are always called |
| +// from the thread managed by the SchedulerWorkerThread instance. |
| +class SchedulerWorkerThreadDelegate { |
| + public: |
| + // Called when the main function of the SchedulerWorkerThread is entered. |
|
robliao
2016/04/06 21:28:20
Nit: 'SchedulerWorkerThread starts.'
'SchedulerWo
fdoray
2016/04/07 13:53:41
Done.
|
| + virtual void OnMainEntry() = 0; |
| + |
| + // Called when the main function of the SchedulerWorkerThread exits. |
| + virtual void OnMainExit() = 0; |
| + |
| + // Called by the SchedulerWorkerThread to get a Sequence from which to run a |
| + // Task. |
| + virtual scoped_refptr<Sequence> GetWork() = 0; |
| + |
| + // Called after the SchedulerWorkerThread has tried to run a Task from |
| + // |sequence| (a TaskTracker might have prevented the Task from running). |
| + virtual void RanTaskFromSequence(scoped_refptr<Sequence> sequence) = 0; |
| +}; |
| + |
| +} // namespace internal |
| +} // namespace base |
| + |
| +#endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_THREAD_DELEGATE_H_ |