OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_IMPL_H_ |
6 #define CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_IMPL_H_ | 6 #define CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_IMPL_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/pending_task.h" | 10 #include "base/pending_task.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 Task TakeTaskFromWorkQueue(); | 91 Task TakeTaskFromWorkQueue(); |
92 | 92 |
93 std::queue<Task>& work_queue() { return work_queue_; } | 93 std::queue<Task>& work_queue() { return work_queue_; } |
94 | 94 |
95 WakeupPolicy wakeup_policy() const { | 95 WakeupPolicy wakeup_policy() const { |
96 DCHECK(main_thread_checker_.CalledOnValidThread()); | 96 DCHECK(main_thread_checker_.CalledOnValidThread()); |
97 return wakeup_policy_; | 97 return wakeup_policy_; |
98 } | 98 } |
99 | 99 |
100 const char* GetName() const override; | 100 const char* GetName() const override; |
| 101 void SetOrigin(const std::string& origin) override; |
| 102 const std::string& GetOrigin() override; |
101 | 103 |
102 void AsValueInto(base::trace_event::TracedValue* state) const; | 104 void AsValueInto(base::trace_event::TracedValue* state) const; |
103 | 105 |
104 size_t get_task_queue_set_index() const { return set_index_; } | 106 size_t get_task_queue_set_index() const { return set_index_; } |
105 | 107 |
106 void set_task_queue_set_index(size_t set_index) { set_index_ = set_index; } | 108 void set_task_queue_set_index(size_t set_index) { set_index_ = set_index; } |
107 | 109 |
108 // If the work queue isn't empty, |enqueue_order| gets set to the enqueue | 110 // If the work queue isn't empty, |enqueue_order| gets set to the enqueue |
109 // order of the front task and the function returns true. Otherwise the | 111 // order of the front task and the function returns true. Otherwise the |
110 // function returns false. | 112 // function returns false. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 186 |
185 // This lock protects all members in the contigious block below. | 187 // This lock protects all members in the contigious block below. |
186 // TODO(alexclarke): Group all the members protected by the lock into a struct | 188 // TODO(alexclarke): Group all the members protected by the lock into a struct |
187 mutable base::Lock lock_; | 189 mutable base::Lock lock_; |
188 base::PlatformThreadId thread_id_; | 190 base::PlatformThreadId thread_id_; |
189 TaskQueueManager* task_queue_manager_; | 191 TaskQueueManager* task_queue_manager_; |
190 std::queue<Task> incoming_queue_; | 192 std::queue<Task> incoming_queue_; |
191 PumpPolicy pump_policy_; | 193 PumpPolicy pump_policy_; |
192 std::priority_queue<Task> delayed_task_queue_; | 194 std::priority_queue<Task> delayed_task_queue_; |
193 | 195 |
| 196 std::string origin_; |
194 const char* name_; | 197 const char* name_; |
195 const char* disabled_by_default_tracing_category_; | 198 const char* disabled_by_default_tracing_category_; |
196 const char* disabled_by_default_verbose_tracing_category_; | 199 const char* disabled_by_default_verbose_tracing_category_; |
197 | 200 |
198 base::ThreadChecker main_thread_checker_; | 201 base::ThreadChecker main_thread_checker_; |
199 std::queue<Task> work_queue_; | 202 std::queue<Task> work_queue_; |
200 base::ObserverList<base::MessageLoop::TaskObserver> task_observers_; | 203 base::ObserverList<base::MessageLoop::TaskObserver> task_observers_; |
201 WakeupPolicy wakeup_policy_; | 204 WakeupPolicy wakeup_policy_; |
202 size_t set_index_; | 205 size_t set_index_; |
203 bool should_monitor_quiescence_; | 206 bool should_monitor_quiescence_; |
204 bool should_notify_observers_; | 207 bool should_notify_observers_; |
205 | 208 |
206 DISALLOW_COPY_AND_ASSIGN(TaskQueueImpl); | 209 DISALLOW_COPY_AND_ASSIGN(TaskQueueImpl); |
207 }; | 210 }; |
208 | 211 |
209 } // namespace internal | 212 } // namespace internal |
210 } // namespace scheduler | 213 } // namespace scheduler |
211 | 214 |
212 #endif // CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_IMPL_H_ | 215 #endif // CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_IMPL_H_ |
OLD | NEW |