| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 base::MessageLoop::TaskObserver* task_observer) override; | 132 base::MessageLoop::TaskObserver* task_observer) override; |
| 133 void SetTimeDomain(TimeDomain* time_domain) override; | 133 void SetTimeDomain(TimeDomain* time_domain) override; |
| 134 TimeDomain* GetTimeDomain() const override; | 134 TimeDomain* GetTimeDomain() const override; |
| 135 void SetBlameContext(base::trace_event::BlameContext* blame_context) override; | 135 void SetBlameContext(base::trace_event::BlameContext* blame_context) override; |
| 136 void InsertFence(InsertFencePosition position) override; | 136 void InsertFence(InsertFencePosition position) override; |
| 137 void RemoveFence() override; | 137 void RemoveFence() override; |
| 138 bool BlockedByFence() const override; | 138 bool BlockedByFence() const override; |
| 139 const char* GetName() const override; | 139 const char* GetName() const override; |
| 140 QueueType GetQueueType() const override; | 140 QueueType GetQueueType() const override; |
| 141 | 141 |
| 142 // As BlockedByFence but only safe to be called while |any_thread_| is locked. | 142 // If this returns false then future updates for this queue are not needed |
| 143 // Must only be called from the thread this task queue was created on. | 143 // unless requested. |
| 144 bool BlockedByFenceLocked() const; | 144 bool MaybeUpdateImmediateWorkQueues(); |
| 145 | |
| 146 // Must only be called from the thread this task queue was created on. | |
| 147 void OnImmediateWorkQueueHasBecomeEmpty( | |
| 148 std::queue<TaskQueueImpl::Task>* work_queue); | |
| 149 | |
| 150 // Must only be called from the thread this task queue was created on. | |
| 151 void ReloadImmediateWorkQueueIfEmpty(); | |
| 152 | 145 |
| 153 void AsValueInto(base::trace_event::TracedValue* state) const; | 146 void AsValueInto(base::trace_event::TracedValue* state) const; |
| 154 | 147 |
| 155 bool GetQuiescenceMonitored() const { return should_monitor_quiescence_; } | 148 bool GetQuiescenceMonitored() const { return should_monitor_quiescence_; } |
| 156 bool GetShouldNotifyObservers() const { return should_notify_observers_; } | 149 bool GetShouldNotifyObservers() const { return should_notify_observers_; } |
| 157 | 150 |
| 158 void NotifyWillProcessTask(const base::PendingTask& pending_task); | 151 void NotifyWillProcessTask(const base::PendingTask& pending_task); |
| 159 void NotifyDidProcessTask(const base::PendingTask& pending_task); | 152 void NotifyDidProcessTask(const base::PendingTask& pending_task); |
| 160 | 153 |
| 161 WorkQueue* delayed_work_queue() { | 154 WorkQueue* delayed_work_queue() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 172 | 165 |
| 173 const WorkQueue* immediate_work_queue() const { | 166 const WorkQueue* immediate_work_queue() const { |
| 174 return main_thread_only().immediate_work_queue.get(); | 167 return main_thread_only().immediate_work_queue.get(); |
| 175 } | 168 } |
| 176 | 169 |
| 177 bool should_report_when_execution_blocked() const { | 170 bool should_report_when_execution_blocked() const { |
| 178 return should_report_when_execution_blocked_; | 171 return should_report_when_execution_blocked_; |
| 179 } | 172 } |
| 180 | 173 |
| 181 // Enqueues any delayed tasks which should be run now on the | 174 // Enqueues any delayed tasks which should be run now on the |
| 182 // |delayed_work_queue|. Returns the deadline if a subsequent wakeup is | 175 // |delayed_work_queue|. It also schedules the next wake up with the |
| 183 // required. Must be called from the main thread. | 176 // TimeDomain. Must be called from the main thread. |
| 184 base::Optional<base::TimeTicks> WakeUpForDelayedWork(LazyNow* lazy_now); | 177 void WakeUpForDelayedWork(LazyNow* lazy_now); |
| 185 | 178 |
| 186 base::TimeTicks scheduled_time_domain_wakeup() const { | 179 base::TimeTicks scheduled_time_domain_wakeup() const { |
| 187 return main_thread_only().scheduled_time_domain_wakeup; | 180 return main_thread_only().scheduled_time_domain_wakeup; |
| 188 } | 181 } |
| 189 | 182 |
| 190 void set_scheduled_time_domain_wakeup( | 183 void set_scheduled_time_domain_wakeup( |
| 191 base::TimeTicks scheduled_time_domain_wakeup) { | 184 base::TimeTicks scheduled_time_domain_wakeup) { |
| 192 main_thread_only().scheduled_time_domain_wakeup = | 185 main_thread_only().scheduled_time_domain_wakeup = |
| 193 scheduled_time_domain_wakeup; | 186 scheduled_time_domain_wakeup; |
| 194 } | 187 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 // Push the task onto the |immediate_incoming_queue| and for auto pumped | 283 // Push the task onto the |immediate_incoming_queue| and for auto pumped |
| 291 // queues it calls MaybePostDoWorkOnMainRunner if the Incoming queue was | 284 // queues it calls MaybePostDoWorkOnMainRunner if the Incoming queue was |
| 292 // empty. | 285 // empty. |
| 293 void PushOntoImmediateIncomingQueueLocked( | 286 void PushOntoImmediateIncomingQueueLocked( |
| 294 const tracked_objects::Location& posted_from, | 287 const tracked_objects::Location& posted_from, |
| 295 const base::Closure& task, | 288 const base::Closure& task, |
| 296 base::TimeTicks desired_run_time, | 289 base::TimeTicks desired_run_time, |
| 297 EnqueueOrder sequence_number, | 290 EnqueueOrder sequence_number, |
| 298 bool nestable); | 291 bool nestable); |
| 299 | 292 |
| 293 // As BlockedByFence but safe to be called while locked. |
| 294 bool BlockedByFenceLocked() const; |
| 295 |
| 300 void TraceQueueSize(bool is_locked) const; | 296 void TraceQueueSize(bool is_locked) const; |
| 301 static void QueueAsValueInto(const std::queue<Task>& queue, | 297 static void QueueAsValueInto(const std::queue<Task>& queue, |
| 302 base::trace_event::TracedValue* state); | 298 base::trace_event::TracedValue* state); |
| 303 static void QueueAsValueInto(const std::priority_queue<Task>& queue, | 299 static void QueueAsValueInto(const std::priority_queue<Task>& queue, |
| 304 base::trace_event::TracedValue* state); | 300 base::trace_event::TracedValue* state); |
| 305 static void TaskAsValueInto(const Task& task, | 301 static void TaskAsValueInto(const Task& task, |
| 306 base::trace_event::TracedValue* state); | 302 base::trace_event::TracedValue* state); |
| 307 | 303 |
| 308 void RemoveQueueEnabledVoter(const QueueEnabledVoterImpl* voter); | 304 void RemoveQueueEnabledVoter(const QueueEnabledVoterImpl* voter); |
| 309 void OnQueueEnabledVoteChanged(bool enabled); | 305 void OnQueueEnabledVoteChanged(bool enabled); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 const bool should_report_when_execution_blocked_; | 339 const bool should_report_when_execution_blocked_; |
| 344 | 340 |
| 345 DISALLOW_COPY_AND_ASSIGN(TaskQueueImpl); | 341 DISALLOW_COPY_AND_ASSIGN(TaskQueueImpl); |
| 346 }; | 342 }; |
| 347 | 343 |
| 348 } // namespace internal | 344 } // namespace internal |
| 349 } // namespace scheduler | 345 } // namespace scheduler |
| 350 } // namespace blink | 346 } // namespace blink |
| 351 | 347 |
| 352 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_ | 348 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_ |
| OLD | NEW |