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

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

Issue 2786083005: scheduler: Maintain a constant enqueue order for every task (Closed)
Patch Set: WASM workaround no longer needed Created 3 years, 8 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 // Test support function. This should not be used in production code. 92 // Test support function. This should not be used in production code.
93 void PopTaskForTest(); 93 void PopTaskForTest();
94 94
95 // Returns true if the front task in this queue has an older enqueue order 95 // Returns true if the front task in this queue has an older enqueue order
96 // than the front task of |other_queue|. Both queue are assumed to be 96 // than the front task of |other_queue|. Both queue are assumed to be
97 // non-empty. This method ignores any fences. 97 // non-empty. This method ignores any fences.
98 bool ShouldRunBefore(const WorkQueue* other_queue) const; 98 bool ShouldRunBefore(const WorkQueue* other_queue) const;
99 99
100 // Submit a fence. When TakeTaskFromWorkQueue encounters a task whose 100 // Submit a fence. When TakeTaskFromWorkQueue encounters a task whose
101 // enqueue_order is >= |fence| then the WorkQueue will start pretending to be. 101 // sequence number is >= |fence| then the WorkQueue will start pretending to
102 // empty. 102 // be. empty.
103 // Inserting a fence may supersede a previous one and unblock some tasks. 103 // Inserting a fence may supersede a previous one and unblock some tasks.
104 // Returns true if any tasks where unblocked, returns false otherwise. 104 // Returns true if any tasks where unblocked, returns false otherwise.
105 bool InsertFence(EnqueueOrder fence); 105 bool InsertFence(SequenceNumber fence);
106 106
107 // Removes any fences that where added and if WorkQueue was pretending to be 107 // Removes any fences that where added and if WorkQueue was pretending to be
108 // empty, then the real value is reported to WorkQueueSets. Returns true if 108 // empty, then the real value is reported to WorkQueueSets. Returns true if
109 // any tasks where unblocked. 109 // any tasks where unblocked.
110 bool RemoveFence(); 110 bool RemoveFence();
111 111
112 // Returns true if any tasks are blocked by the fence. Returns true if the 112 // Returns true if any tasks are blocked by the fence. Returns true if the
113 // queue is empty and fence has been set (i.e. future tasks would be blocked). 113 // queue is empty and fence has been set (i.e. future tasks would be blocked).
114 // Otherwise returns false. 114 // Otherwise returns false.
115 bool BlockedByFence() const; 115 bool BlockedByFence() const;
116 116
117 private: 117 private:
118 WTF::Deque<TaskQueueImpl::Task> work_queue_; 118 WTF::Deque<TaskQueueImpl::Task> work_queue_;
119 WorkQueueSets* work_queue_sets_; // NOT OWNED. 119 WorkQueueSets* work_queue_sets_; // NOT OWNED.
120 TaskQueueImpl* const task_queue_; // NOT OWNED. 120 TaskQueueImpl* const task_queue_; // NOT OWNED.
121 size_t work_queue_set_index_; 121 size_t work_queue_set_index_;
122 HeapHandle heap_handle_; 122 HeapHandle heap_handle_;
123 const char* const name_; 123 const char* const name_;
124 EnqueueOrder fence_; 124 SequenceNumber fence_;
125 const QueueType queue_type_; 125 const QueueType queue_type_;
126 126
127 DISALLOW_COPY_AND_ASSIGN(WorkQueue); 127 DISALLOW_COPY_AND_ASSIGN(WorkQueue);
128 }; 128 };
129 129
130 } // namespace internal 130 } // namespace internal
131 } // namespace scheduler 131 } // namespace scheduler
132 } // namespace blink 132 } // namespace blink
133 133
134 #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