Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: base/task_scheduler/scheduler_worker_thread_delegate.h

Issue 1864333002: TaskScheduler: Delegate instead of callbacks for SchedulerWorkerThread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR robliao #5 Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef BASE_TASK_SCHEDULER_SCHEDULER_WORKER_THREAD_DELEGATE_H_
6 #define BASE_TASK_SCHEDULER_SCHEDULER_WORKER_THREAD_DELEGATE_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "base/task_scheduler/sequence.h"
10
11 namespace base {
12 namespace internal {
13
14 // Delegate interface for SchedulerWorkerThread. The methods are always called
15 // from the thread managed by the SchedulerWorkerThread instance.
16 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.
17 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.
18 // Called when the main function of the SchedulerWorkerThread enters.
19 virtual void OnMainEntry() = 0;
20
21 // Called when the main function of the SchedulerWorkerThread exits.
22 virtual void OnMainExit() = 0;
23
24 // Called by the SchedulerWorkerThread to get a Sequence from which to run a
25 // Task.
26 virtual scoped_refptr<Sequence> GetWork() = 0;
27
28 // Called after the SchedulerWorkerThread has tried to run a Task from
29 // |sequence| (a TaskTracker might have prevented the Task from running).
30 virtual void RanTaskFromSequence(scoped_refptr<Sequence> sequence) = 0;
31 };
32
33 } // namespace internal
34 } // namespace base
35
36 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_THREAD_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698