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

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h

Issue 2640763003: Optimize away updatable_queue_set_ (Closed)
Patch Set: Fix lock issue plus rename OnPushQueue Created 3 years, 11 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 | third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.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 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 base::MessageLoop::TaskObserver* task_observer) override; 133 base::MessageLoop::TaskObserver* task_observer) override;
134 void SetTimeDomain(TimeDomain* time_domain) override; 134 void SetTimeDomain(TimeDomain* time_domain) override;
135 TimeDomain* GetTimeDomain() const override; 135 TimeDomain* GetTimeDomain() const override;
136 void SetBlameContext(base::trace_event::BlameContext* blame_context) override; 136 void SetBlameContext(base::trace_event::BlameContext* blame_context) override;
137 void InsertFence(InsertFencePosition position) override; 137 void InsertFence(InsertFencePosition position) override;
138 void RemoveFence() override; 138 void RemoveFence() override;
139 bool BlockedByFence() const override; 139 bool BlockedByFence() const override;
140 const char* GetName() const override; 140 const char* GetName() const override;
141 QueueType GetQueueType() const override; 141 QueueType GetQueueType() const override;
142 142
143 // 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.
144 // unless requested. 144 void ReloadImmediateWorkQueueIfEmpty();
145 bool MaybeUpdateImmediateWorkQueues();
146 145
147 void AsValueInto(base::trace_event::TracedValue* state) const; 146 void AsValueInto(base::trace_event::TracedValue* state) const;
148 147
149 bool GetQuiescenceMonitored() const { return should_monitor_quiescence_; } 148 bool GetQuiescenceMonitored() const { return should_monitor_quiescence_; }
150 bool GetShouldNotifyObservers() const { return should_notify_observers_; } 149 bool GetShouldNotifyObservers() const { return should_notify_observers_; }
151 150
152 void NotifyWillProcessTask(const base::PendingTask& pending_task); 151 void NotifyWillProcessTask(const base::PendingTask& pending_task);
153 void NotifyDidProcessTask(const base::PendingTask& pending_task); 152 void NotifyDidProcessTask(const base::PendingTask& pending_task);
154 153
155 WorkQueue* delayed_work_queue() { 154 WorkQueue* delayed_work_queue() {
(...skipping 30 matching lines...) Expand all
186 main_thread_only().scheduled_time_domain_wakeup = 185 main_thread_only().scheduled_time_domain_wakeup =
187 scheduled_time_domain_wakeup; 186 scheduled_time_domain_wakeup;
188 } 187 }
189 188
190 HeapHandle heap_handle() const { return main_thread_only().heap_handle; } 189 HeapHandle heap_handle() const { return main_thread_only().heap_handle; }
191 190
192 void set_heap_handle(HeapHandle heap_handle) { 191 void set_heap_handle(HeapHandle heap_handle) {
193 main_thread_only().heap_handle = heap_handle; 192 main_thread_only().heap_handle = heap_handle;
194 } 193 }
195 194
195 void PushImmediateIncomingTaskForTest(TaskQueueImpl::Task&& task);
196 EnqueueOrder GetFenceForTest() const; 196 EnqueueOrder GetFenceForTest() const;
197 197
198 class QueueEnabledVoterImpl : public QueueEnabledVoter { 198 class QueueEnabledVoterImpl : public QueueEnabledVoter {
199 public: 199 public:
200 explicit QueueEnabledVoterImpl(TaskQueueImpl* task_queue); 200 explicit QueueEnabledVoterImpl(TaskQueueImpl* task_queue);
201 ~QueueEnabledVoterImpl() override; 201 ~QueueEnabledVoterImpl() override;
202 202
203 // QueueEnabledVoter implementation. 203 // QueueEnabledVoter implementation.
204 void SetQueueEnabled(bool enabled) override; 204 void SetQueueEnabled(bool enabled) override;
205 205
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // Push the task onto the |immediate_incoming_queue| and for auto pumped 287 // Push the task onto the |immediate_incoming_queue| and for auto pumped
288 // queues it calls MaybePostDoWorkOnMainRunner if the Incoming queue was 288 // queues it calls MaybePostDoWorkOnMainRunner if the Incoming queue was
289 // empty. 289 // empty.
290 void PushOntoImmediateIncomingQueueLocked( 290 void PushOntoImmediateIncomingQueueLocked(
291 const tracked_objects::Location& posted_from, 291 const tracked_objects::Location& posted_from,
292 const base::Closure& task, 292 const base::Closure& task,
293 base::TimeTicks desired_run_time, 293 base::TimeTicks desired_run_time,
294 EnqueueOrder sequence_number, 294 EnqueueOrder sequence_number,
295 bool nestable); 295 bool nestable);
296 296
297 // Extracts all the tasks from the immediate incoming queue and clears it.
298 // Can be called from any thread.
299 WTF::Deque<TaskQueueImpl::Task> TakeImmediateIncomingQueue();
300
297 // As BlockedByFence but safe to be called while locked. 301 // As BlockedByFence but safe to be called while locked.
298 bool BlockedByFenceLocked() const; 302 bool BlockedByFenceLocked() const;
299 303
300 void TraceQueueSize(bool is_locked) const; 304 void TraceQueueSize(bool is_locked) const;
301 static void QueueAsValueInto(const WTF::Deque<Task>& queue, 305 static void QueueAsValueInto(const WTF::Deque<Task>& queue,
302 base::trace_event::TracedValue* state); 306 base::trace_event::TracedValue* state);
303 static void QueueAsValueInto(const std::priority_queue<Task>& queue, 307 static void QueueAsValueInto(const std::priority_queue<Task>& queue,
304 base::trace_event::TracedValue* state); 308 base::trace_event::TracedValue* state);
305 static void TaskAsValueInto(const Task& task, 309 static void TaskAsValueInto(const Task& task,
306 base::trace_event::TracedValue* state); 310 base::trace_event::TracedValue* state);
307 311
308 void RemoveQueueEnabledVoter(const QueueEnabledVoterImpl* voter); 312 void RemoveQueueEnabledVoter(const QueueEnabledVoterImpl* voter);
309 void OnQueueEnabledVoteChanged(bool enabled); 313 void OnQueueEnabledVoteChanged(bool enabled);
310 void EnableOrDisableWithSelector(bool enable); 314 void EnableOrDisableWithSelector(bool enable);
311 315
312 const base::PlatformThreadId thread_id_; 316 const base::PlatformThreadId thread_id_;
313 317
314 mutable base::Lock any_thread_lock_; 318 mutable base::Lock any_thread_lock_;
315 AnyThread any_thread_; 319 AnyThread any_thread_;
316 struct AnyThread& any_thread() { 320 struct AnyThread& any_thread() {
317 any_thread_lock_.AssertAcquired(); 321 any_thread_lock_.AssertAcquired();
318 return any_thread_; 322 return any_thread_;
319 } 323 }
320 const struct AnyThread& any_thread() const { 324 const struct AnyThread& any_thread() const {
321 any_thread_lock_.AssertAcquired(); 325 any_thread_lock_.AssertAcquired();
322 return any_thread_; 326 return any_thread_;
323 } 327 }
324 328
325 const QueueType type_; 329 const QueueType type_;
326 const char* name_; 330 const char* const name_;
327 const char* disabled_by_default_tracing_category_; 331 const char* const disabled_by_default_tracing_category_;
328 const char* disabled_by_default_verbose_tracing_category_; 332 const char* const disabled_by_default_verbose_tracing_category_;
329 333
330 base::ThreadChecker main_thread_checker_; 334 base::ThreadChecker main_thread_checker_;
331 MainThreadOnly main_thread_only_; 335 MainThreadOnly main_thread_only_;
332 MainThreadOnly& main_thread_only() { 336 MainThreadOnly& main_thread_only() {
333 DCHECK(main_thread_checker_.CalledOnValidThread()); 337 DCHECK(main_thread_checker_.CalledOnValidThread());
334 return main_thread_only_; 338 return main_thread_only_;
335 } 339 }
336 const MainThreadOnly& main_thread_only() const { 340 const MainThreadOnly& main_thread_only() const {
337 DCHECK(main_thread_checker_.CalledOnValidThread()); 341 DCHECK(main_thread_checker_.CalledOnValidThread());
338 return main_thread_only_; 342 return main_thread_only_;
339 } 343 }
340 344
341 const bool should_monitor_quiescence_; 345 const bool should_monitor_quiescence_;
342 const bool should_notify_observers_; 346 const bool should_notify_observers_;
343 const bool should_report_when_execution_blocked_; 347 const bool should_report_when_execution_blocked_;
344 348
345 DISALLOW_COPY_AND_ASSIGN(TaskQueueImpl); 349 DISALLOW_COPY_AND_ASSIGN(TaskQueueImpl);
346 }; 350 };
347 351
348 } // namespace internal 352 } // namespace internal
349 } // namespace scheduler 353 } // namespace scheduler
350 } // namespace blink 354 } // namespace blink
351 355
352 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_ 356 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TASK_QUEUE_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698