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

Side by Side Diff: components/scheduler/base/work_queue.h

Issue 1886453003: Make PendingTask move-only and pass it by value on retaining params (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mac test fix Created 4 years, 5 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
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 CONTENT_RENDERER_SCHEDULER_BASE_WORK_QUEUE_H_ 5 #ifndef CONTENT_RENDERER_SCHEDULER_BASE_WORK_QUEUE_H_
6 #define CONTENT_RENDERER_SCHEDULER_BASE_WORK_QUEUE_H_ 6 #define CONTENT_RENDERER_SCHEDULER_BASE_WORK_QUEUE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // If the |work_queue_| isn't empty, |enqueue_order| gets set to the enqueue 42 // If the |work_queue_| isn't empty, |enqueue_order| gets set to the enqueue
43 // order of the front task and the function returns true. Otherwise the 43 // order of the front task and the function returns true. Otherwise the
44 // function returns false. 44 // function returns false.
45 bool GetFrontTaskEnqueueOrder(EnqueueOrder* enqueue_order) const; 45 bool GetFrontTaskEnqueueOrder(EnqueueOrder* enqueue_order) const;
46 46
47 // Returns the first task in this queue or null if the queue is empty. 47 // Returns the first task in this queue or null if the queue is empty.
48 const TaskQueueImpl::Task* GetFrontTask() const; 48 const TaskQueueImpl::Task* GetFrontTask() const;
49 49
50 // Pushes the task onto the |work_queue_| and informs the WorkQueueSets if 50 // Pushes the task onto the |work_queue_| and informs the WorkQueueSets if
51 // the head changed. 51 // the head changed.
52 void Push(const TaskQueueImpl::Task& task); 52 void Push(TaskQueueImpl::Task task);
53 53
54 // Pushes the task onto the |work_queue_|, sets the |enqueue_order| and 54 // Pushes the task onto the |work_queue_|, sets the |enqueue_order| and
55 // informs the WorkQueueSets if the head changed. 55 // informs the WorkQueueSets if the head changed.
56 void PushAndSetEnqueueOrder(const TaskQueueImpl::Task& task, 56 void PushAndSetEnqueueOrder(TaskQueueImpl::Task task,
57 EnqueueOrder enqueue_order); 57 EnqueueOrder enqueue_order);
58 58
59 // Swap the |work_queue_| with |incoming_queue| and informs the 59 // Swap the |work_queue_| with |incoming_queue| and informs the
60 // WorkQueueSets if the head changed. Assumes |task_queue_->any_thread_lock_| 60 // WorkQueueSets if the head changed. Assumes |task_queue_->any_thread_lock_|
61 // is locked. 61 // is locked.
62 void SwapLocked(std::queue<TaskQueueImpl::Task>& incoming_queue); 62 void SwapLocked(std::queue<TaskQueueImpl::Task>& incoming_queue);
63 63
64 size_t Size() const { return work_queue_.size(); } 64 size_t Size() const { return work_queue_.size(); }
65 65
66 // Pulls a task off the |work_queue_| and informs the WorkQueueSets. 66 // Pulls a task off the |work_queue_| and informs the WorkQueueSets.
(...skipping 14 matching lines...) Expand all
81 // than the front task of |other_queue|. Both queue are assumed to be 81 // than the front task of |other_queue|. Both queue are assumed to be
82 // non-empty. 82 // non-empty.
83 bool ShouldRunBefore(const WorkQueue* other_queue) const; 83 bool ShouldRunBefore(const WorkQueue* other_queue) const;
84 84
85 private: 85 private:
86 std::queue<TaskQueueImpl::Task> work_queue_; 86 std::queue<TaskQueueImpl::Task> work_queue_;
87 WorkQueueSets* work_queue_sets_; // NOT OWNED. 87 WorkQueueSets* work_queue_sets_; // NOT OWNED.
88 TaskQueueImpl* task_queue_; // NOT OWNED. 88 TaskQueueImpl* task_queue_; // NOT OWNED.
89 size_t work_queue_set_index_; 89 size_t work_queue_set_index_;
90 const char* name_; 90 const char* name_;
91
92 DISALLOW_COPY_AND_ASSIGN(WorkQueue);
91 }; 93 };
92 94
93 } // namespace internal 95 } // namespace internal
94 } // namespace scheduler 96 } // namespace scheduler
95 97
96 #endif // CONTENT_RENDERER_SCHEDULER_BASE_WORK_QUEUE_H_ 98 #endif // CONTENT_RENDERER_SCHEDULER_BASE_WORK_QUEUE_H_
OLDNEW
« no previous file with comments | « components/scheduler/base/task_queue_manager.cc ('k') | components/scheduler/base/work_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698