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

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

Issue 1876363004: TaskScheduler [11] Support ExecutionMode::SINGLE_THREADED. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@8_delayed
Patch Set: rebase 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_TASK_SCHEDULER_SCHEDULER_WORKER_THREAD_H_ 5 #ifndef BASE_TASK_SCHEDULER_SCHEDULER_WORKER_THREAD_H_
6 #define BASE_TASK_SCHEDULER_SCHEDULER_WORKER_THREAD_H_ 6 #define BASE_TASK_SCHEDULER_SCHEDULER_WORKER_THREAD_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/base_export.h" 10 #include "base/base_export.h"
(...skipping 19 matching lines...) Expand all
30 // 30 //
31 // This class is thread-safe. 31 // This class is thread-safe.
32 class BASE_EXPORT SchedulerWorkerThread : public PlatformThread::Delegate { 32 class BASE_EXPORT SchedulerWorkerThread : public PlatformThread::Delegate {
33 public: 33 public:
34 // Delegate interface for SchedulerWorkerThread. The methods are always called 34 // Delegate interface for SchedulerWorkerThread. The methods are always called
35 // from the thread managed by the SchedulerWorkerThread instance. 35 // from the thread managed by the SchedulerWorkerThread instance.
36 class Delegate { 36 class Delegate {
37 public: 37 public:
38 virtual ~Delegate() = default; 38 virtual ~Delegate() = default;
39 39
40 // Called when the main function of the SchedulerWorkerThread enters. 40 // Called by |worker_thread| when it enters its main function.
41 virtual void OnMainEntry() = 0; 41 virtual void OnMainEntry(SchedulerWorkerThread* worker_thread) = 0;
42 42
43 // Called by |worker_thread| to get a Sequence from which to run a Task. 43 // Called by |worker_thread| to get a Sequence from which to run a Task.
44 virtual scoped_refptr<Sequence> GetWork( 44 virtual scoped_refptr<Sequence> GetWork(
45 SchedulerWorkerThread* worker_thread) = 0; 45 SchedulerWorkerThread* worker_thread) = 0;
46 46
47 // Called when |sequence| isn't empty after the SchedulerWorkerThread pops a 47 // Called when |sequence| isn't empty after the SchedulerWorkerThread pops a
48 // Task from it. |sequence| is the last Sequence returned by GetWork(). 48 // Task from it. |sequence| is the last Sequence returned by GetWork().
49 virtual void ReEnqueueSequence(scoped_refptr<Sequence> sequence) = 0; 49 virtual void ReEnqueueSequence(scoped_refptr<Sequence> sequence) = 0;
50 }; 50 };
51 51
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // True once JoinForTesting() has been called. 97 // True once JoinForTesting() has been called.
98 bool should_exit_for_testing_ = false; 98 bool should_exit_for_testing_ = false;
99 99
100 DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerThread); 100 DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerThread);
101 }; 101 };
102 102
103 } // namespace internal 103 } // namespace internal
104 } // namespace base 104 } // namespace base
105 105
106 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_THREAD_H_ 106 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698