| 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 THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_ | 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_ |
| 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_ | 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 bool should_report_when_execution_blocked() const { | 171 bool should_report_when_execution_blocked() const { |
| 172 return should_report_when_execution_blocked_; | 172 return should_report_when_execution_blocked_; |
| 173 } | 173 } |
| 174 | 174 |
| 175 // Enqueues any delayed tasks which should be run now on the | 175 // Enqueues any delayed tasks which should be run now on the |
| 176 // |delayed_work_queue|. It also schedules the next wake up with the | 176 // |delayed_work_queue|. It also schedules the next wake up with the |
| 177 // TimeDomain. Must be called from the main thread. | 177 // TimeDomain. Must be called from the main thread. |
| 178 void WakeUpForDelayedWork(LazyNow* lazy_now); | 178 void WakeUpForDelayedWork(LazyNow* lazy_now); |
| 179 | 179 |
| 180 base::TimeTicks time_domain_wakeup() const { |
| 181 return main_thread_only().time_domain_wakeup; |
| 182 } |
| 183 |
| 184 void set_time_domain_wakeup(base::TimeTicks time_domain_wakeup) { |
| 185 main_thread_only().time_domain_wakeup = time_domain_wakeup; |
| 186 } |
| 187 |
| 180 private: | 188 private: |
| 181 friend class WorkQueue; | 189 friend class WorkQueue; |
| 182 friend class WorkQueueTest; | 190 friend class WorkQueueTest; |
| 183 | 191 |
| 184 enum class TaskType { | 192 enum class TaskType { |
| 185 NORMAL, | 193 NORMAL, |
| 186 NON_NESTABLE, | 194 NON_NESTABLE, |
| 187 }; | 195 }; |
| 188 | 196 |
| 189 struct AnyThread { | 197 struct AnyThread { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 211 TimeDomain* time_domain; | 219 TimeDomain* time_domain; |
| 212 | 220 |
| 213 std::unique_ptr<WorkQueue> delayed_work_queue; | 221 std::unique_ptr<WorkQueue> delayed_work_queue; |
| 214 std::unique_ptr<WorkQueue> immediate_work_queue; | 222 std::unique_ptr<WorkQueue> immediate_work_queue; |
| 215 std::priority_queue<Task> delayed_incoming_queue; | 223 std::priority_queue<Task> delayed_incoming_queue; |
| 216 base::ObserverList<base::MessageLoop::TaskObserver> task_observers; | 224 base::ObserverList<base::MessageLoop::TaskObserver> task_observers; |
| 217 size_t set_index; | 225 size_t set_index; |
| 218 bool is_enabled; | 226 bool is_enabled; |
| 219 base::trace_event::BlameContext* blame_context; // Not owned. | 227 base::trace_event::BlameContext* blame_context; // Not owned. |
| 220 EnqueueOrder current_fence; | 228 EnqueueOrder current_fence; |
| 229 base::TimeTicks time_domain_wakeup; |
| 221 }; | 230 }; |
| 222 | 231 |
| 223 ~TaskQueueImpl() override; | 232 ~TaskQueueImpl() override; |
| 224 | 233 |
| 225 bool PostImmediateTaskImpl(const tracked_objects::Location& from_here, | 234 bool PostImmediateTaskImpl(const tracked_objects::Location& from_here, |
| 226 const base::Closure& task, | 235 const base::Closure& task, |
| 227 TaskType task_type); | 236 TaskType task_type); |
| 228 bool PostDelayedTaskImpl(const tracked_objects::Location& from_here, | 237 bool PostDelayedTaskImpl(const tracked_objects::Location& from_here, |
| 229 const base::Closure& task, | 238 const base::Closure& task, |
| 230 base::TimeDelta delay, | 239 base::TimeDelta delay, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 const bool should_report_when_execution_blocked_; | 306 const bool should_report_when_execution_blocked_; |
| 298 | 307 |
| 299 DISALLOW_COPY_AND_ASSIGN(TaskQueueImpl); | 308 DISALLOW_COPY_AND_ASSIGN(TaskQueueImpl); |
| 300 }; | 309 }; |
| 301 | 310 |
| 302 } // namespace internal | 311 } // namespace internal |
| 303 } // namespace scheduler | 312 } // namespace scheduler |
| 304 } // namespace blink | 313 } // namespace blink |
| 305 | 314 |
| 306 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_ | 315 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_ |
| OLD | NEW |