 Chromium Code Reviews
 Chromium Code Reviews Issue 1864333002:
  TaskScheduler: Delegate instead of callbacks for SchedulerWorkerThread.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1864333002:
  TaskScheduler: Delegate instead of callbacks for SchedulerWorkerThread.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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..ceca7da3d4a082cc2a0eb8fed4468115faad705b | 
| --- /dev/null | 
| +++ b/base/task_scheduler/scheduler_worker_thread_delegate.h | 
| @@ -0,0 +1,38 @@ | 
| +// 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 { | 
| + | 
| +class SchedulerWorkerThread; | 
| 
robliao
2016/04/06 20:50:18
Remove forward declaration.
 
fdoray
2016/04/06 21:11:38
Done.
 | 
| + | 
| +// 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. | 
| + 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_ |