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

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

Issue 1862243005: TaskScheduler: Pop a Task from its Sequence from SchedulerWorkerThread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@5_pq_callback
Patch Set: CR robliao #6 (improve comments) 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
« no previous file with comments | « no previous file | base/task_scheduler/scheduler_worker_thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 29 matching lines...) Expand all
40 // Called when the main function of the SchedulerWorkerThread enters. 40 // Called when the main function of the SchedulerWorkerThread enters.
41 virtual void OnMainEntry() = 0; 41 virtual void OnMainEntry() = 0;
42 42
43 // Called when the main function of the SchedulerWorkerThread exits. 43 // Called when the main function of the SchedulerWorkerThread exits.
44 virtual void OnMainExit() = 0; 44 virtual void OnMainExit() = 0;
45 45
46 // Called by |worker_thread| to get a Sequence from which to run a Task. 46 // Called by |worker_thread| to get a Sequence from which to run a Task.
47 virtual scoped_refptr<Sequence> GetWork( 47 virtual scoped_refptr<Sequence> GetWork(
48 SchedulerWorkerThread* worker_thread) = 0; 48 SchedulerWorkerThread* worker_thread) = 0;
49 49
50 // Called after the SchedulerWorkerThread has tried to run a Task from 50 // Called when |sequence| isn't empty after the SchedulerWorkerThread pops a
51 // |sequence| (a TaskTracker might have prevented the Task from running). 51 // Task from it. |sequence| is the last Sequence returned by GetWork().
52 // The Task is still in |sequence| when this is called. 52 virtual void EnqueueSequence(scoped_refptr<Sequence> sequence) = 0;
53 virtual void RanTaskFromSequence(scoped_refptr<Sequence> sequence) = 0;
54 }; 53 };
55 54
56 // Creates a SchedulerWorkerThread with priority |thread_priority| that runs 55 // Creates a SchedulerWorkerThread with priority |thread_priority| that runs
57 // Tasks from Sequences returned by |delegate|. |task_tracker| is used to 56 // Tasks from Sequences returned by |delegate|. |task_tracker| is used to
58 // handle shutdown behavior of Tasks. Returns nullptr if creating the 57 // handle shutdown behavior of Tasks. Returns nullptr if creating the
59 // underlying platform thread fails. 58 // underlying platform thread fails.
60 static std::unique_ptr<SchedulerWorkerThread> CreateSchedulerWorkerThread( 59 static std::unique_ptr<SchedulerWorkerThread> CreateSchedulerWorkerThread(
61 ThreadPriority thread_priority, 60 ThreadPriority thread_priority,
62 Delegate* delegate, 61 Delegate* delegate,
63 TaskTracker* task_tracker); 62 TaskTracker* task_tracker);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // True once JoinForTesting() has been called. 100 // True once JoinForTesting() has been called.
102 bool should_exit_for_testing_ = false; 101 bool should_exit_for_testing_ = false;
103 102
104 DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerThread); 103 DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerThread);
105 }; 104 };
106 105
107 } // namespace internal 106 } // namespace internal
108 } // namespace base 107 } // namespace base
109 108
110 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_THREAD_H_ 109 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_THREAD_H_
OLDNEW
« no previous file with comments | « no previous file | base/task_scheduler/scheduler_worker_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698