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

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

Issue 2546423002: [Try # 3] Scheduler refactoring to virtually eliminate redundant DoWorks (Closed)
Patch Set: Few tweaks Created 4 years 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 WorkQueue(TaskQueueImpl* task_queue, const char* name); 34 enum class QueueType { DELAYED, IMMEDIATE };
35
36 WorkQueue(TaskQueueImpl* task_queue, const char* name, QueueType queue_type);
35 ~WorkQueue(); 37 ~WorkQueue();
36 38
37 // Associates this work queue with the given work queue sets. This must be 39 // Associates this work queue with the given work queue sets. This must be
38 // called before any tasks can be inserted into this work queue. 40 // called before any tasks can be inserted into this work queue.
39 void AssignToWorkQueueSets(WorkQueueSets* work_queue_sets); 41 void AssignToWorkQueueSets(WorkQueueSets* work_queue_sets);
40 42
41 // Assigns the current set index. 43 // Assigns the current set index.
42 void AssignSetIndex(size_t work_queue_set_index); 44 void AssignSetIndex(size_t work_queue_set_index);
43 45
44 void AsValueInto(base::trace_event::TracedValue* state) const; 46 void AsValueInto(base::trace_event::TracedValue* state) const;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 bool BlockedByFence() const; 115 bool BlockedByFence() const;
114 116
115 private: 117 private:
116 std::queue<TaskQueueImpl::Task> work_queue_; 118 std::queue<TaskQueueImpl::Task> work_queue_;
117 WorkQueueSets* work_queue_sets_; // NOT OWNED. 119 WorkQueueSets* work_queue_sets_; // NOT OWNED.
118 TaskQueueImpl* task_queue_; // NOT OWNED. 120 TaskQueueImpl* task_queue_; // NOT OWNED.
119 size_t work_queue_set_index_; 121 size_t work_queue_set_index_;
120 HeapHandle heap_handle_; 122 HeapHandle heap_handle_;
121 const char* name_; 123 const char* name_;
122 EnqueueOrder fence_; 124 EnqueueOrder fence_;
125 QueueType queue_type_;
123 126
124 DISALLOW_COPY_AND_ASSIGN(WorkQueue); 127 DISALLOW_COPY_AND_ASSIGN(WorkQueue);
125 }; 128 };
126 129
127 } // namespace internal 130 } // namespace internal
128 } // namespace scheduler 131 } // namespace scheduler
129 } // namespace blink 132 } // namespace blink
130 133
131 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_WORK_QUEUE_H_ 134 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_WORK_QUEUE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698