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

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

Issue 2590593002: Revert of [Reland] Scheduler refactoring to virtually eliminate redundant DoWorks (Closed)
Patch Set: Created 3 years, 12 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 THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_WORK_QUEUE_H_ 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_WORK_QUEUE_H_
6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_WORK_QUEUE_H_ 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_WORK_QUEUE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 13 matching lines...) Expand all
24 // now. It interfaces deeply with WorkQueueSets which keeps track of which queue 24 // now. It interfaces deeply with WorkQueueSets which keeps track of which queue
25 // (with a given priority) contains the oldest task. 25 // (with a given priority) contains the oldest task.
26 // 26 //
27 // If a fence is inserted, WorkQueue behaves normally up until 27 // If a fence is inserted, WorkQueue behaves normally up until
28 // TakeTaskFromWorkQueue reaches or exceeds the fence. At that point it the 28 // TakeTaskFromWorkQueue reaches or exceeds the fence. At that point it the
29 // API subset used by WorkQueueSets pretends the WorkQueue is empty until the 29 // API subset used by WorkQueueSets pretends the WorkQueue is empty until the
30 // fence is removed. This functionality is a primitive intended for use by 30 // fence is removed. This functionality is a primitive intended for use by
31 // throttling mechanisms. 31 // throttling mechanisms.
32 class BLINK_PLATFORM_EXPORT WorkQueue { 32 class BLINK_PLATFORM_EXPORT WorkQueue {
33 public: 33 public:
34 enum class QueueType { DELAYED, IMMEDIATE }; 34 WorkQueue(TaskQueueImpl* task_queue, const char* name);
35
36 WorkQueue(TaskQueueImpl* task_queue, const char* name, QueueType queue_type);
37 ~WorkQueue(); 35 ~WorkQueue();
38 36
39 // Associates this work queue with the given work queue sets. This must be 37 // Associates this work queue with the given work queue sets. This must be
40 // called before any tasks can be inserted into this work queue. 38 // called before any tasks can be inserted into this work queue.
41 void AssignToWorkQueueSets(WorkQueueSets* work_queue_sets); 39 void AssignToWorkQueueSets(WorkQueueSets* work_queue_sets);
42 40
43 // Assigns the current set index. 41 // Assigns the current set index.
44 void AssignSetIndex(size_t work_queue_set_index); 42 void AssignSetIndex(size_t work_queue_set_index);
45 43
46 void AsValueInto(base::trace_event::TracedValue* state) const; 44 void AsValueInto(base::trace_event::TracedValue* state) const;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 bool BlockedByFence() const; 113 bool BlockedByFence() const;
116 114
117 private: 115 private:
118 std::queue<TaskQueueImpl::Task> work_queue_; 116 std::queue<TaskQueueImpl::Task> work_queue_;
119 WorkQueueSets* work_queue_sets_; // NOT OWNED. 117 WorkQueueSets* work_queue_sets_; // NOT OWNED.
120 TaskQueueImpl* task_queue_; // NOT OWNED. 118 TaskQueueImpl* task_queue_; // NOT OWNED.
121 size_t work_queue_set_index_; 119 size_t work_queue_set_index_;
122 HeapHandle heap_handle_; 120 HeapHandle heap_handle_;
123 const char* name_; 121 const char* name_;
124 EnqueueOrder fence_; 122 EnqueueOrder fence_;
125 QueueType queue_type_;
126 123
127 DISALLOW_COPY_AND_ASSIGN(WorkQueue); 124 DISALLOW_COPY_AND_ASSIGN(WorkQueue);
128 }; 125 };
129 126
130 } // namespace internal 127 } // namespace internal
131 } // namespace scheduler 128 } // namespace scheduler
132 } // namespace blink 129 } // namespace blink
133 130
134 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_WORK_QUEUE_H_ 131 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_WORK_QUEUE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698