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..978eed1477acb476f3ac5ac6f5718321727190dd |
| --- /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 { |
|
gab
2016/04/07 16:42:08
I think it's better to define this on SchedulerWor
fdoray
2016/04/07 17:59:32
Done.
|
| + public: |
|
gab
2016/04/07 16:42:08
I think you need to explicitly make the destructor
fdoray
2016/04/07 17:59:32
Done.
|
| + // Called when the main function of the SchedulerWorkerThread enters. |
| + 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_ |