| OLD | NEW |
| 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 22 matching lines...) Expand all Loading... |
| 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 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. | |
| 44 virtual void OnMainExit() = 0; | |
| 45 | |
| 46 // 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. |
| 47 virtual scoped_refptr<Sequence> GetWork( | 44 virtual scoped_refptr<Sequence> GetWork( |
| 48 SchedulerWorkerThread* worker_thread) = 0; | 45 SchedulerWorkerThread* worker_thread) = 0; |
| 49 | 46 |
| 50 // Called when |sequence| isn't empty after the SchedulerWorkerThread pops a | 47 // Called when |sequence| isn't empty after the SchedulerWorkerThread pops a |
| 51 // Task from it. |sequence| is the last Sequence returned by GetWork(). | 48 // Task from it. |sequence| is the last Sequence returned by GetWork(). |
| 52 virtual void EnqueueSequence(scoped_refptr<Sequence> sequence) = 0; | 49 virtual void EnqueueSequence(scoped_refptr<Sequence> sequence) = 0; |
| 53 }; | 50 }; |
| 54 | 51 |
| 55 // Creates a SchedulerWorkerThread with priority |thread_priority| that runs | 52 // Creates a SchedulerWorkerThread with priority |thread_priority| that runs |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // True once JoinForTesting() has been called. | 97 // True once JoinForTesting() has been called. |
| 101 bool should_exit_for_testing_ = false; | 98 bool should_exit_for_testing_ = false; |
| 102 | 99 |
| 103 DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerThread); | 100 DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerThread); |
| 104 }; | 101 }; |
| 105 | 102 |
| 106 } // namespace internal | 103 } // namespace internal |
| 107 } // namespace base | 104 } // namespace base |
| 108 | 105 |
| 109 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_THREAD_H_ | 106 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_THREAD_H_ |
| OLD | NEW |