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

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

Issue 2419793002: [Reland] Optimize blink scheduler with an intrusive heap (Closed)
Patch Set: Fix bug in MoveHoleDown Created 4 years, 2 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 TaskQueueImpl::Task TakeTaskFromWorkQueue(); 75 TaskQueueImpl::Task TakeTaskFromWorkQueue();
76 76
77 const char* name() const { return name_; } 77 const char* name() const { return name_; }
78 78
79 TaskQueueImpl* task_queue() const { return task_queue_; } 79 TaskQueueImpl* task_queue() const { return task_queue_; }
80 80
81 WorkQueueSets* work_queue_sets() const { return work_queue_sets_; } 81 WorkQueueSets* work_queue_sets() const { return work_queue_sets_; }
82 82
83 size_t work_queue_set_index() const { return work_queue_set_index_; } 83 size_t work_queue_set_index() const { return work_queue_set_index_; }
84 84
85 size_t heap_index() const { return heap_index_; }
86
87 void set_heap_index(size_t heap_index) { heap_index_ = heap_index; }
88
85 // Test support function. This should not be used in production code. 89 // Test support function. This should not be used in production code.
86 void PopTaskForTest(); 90 void PopTaskForTest();
87 91
88 // Returns true if the front task in this queue has an older enqueue order 92 // Returns true if the front task in this queue has an older enqueue order
89 // than the front task of |other_queue|. Both queue are assumed to be 93 // than the front task of |other_queue|. Both queue are assumed to be
90 // non-empty. This method ignores any fences. 94 // non-empty. This method ignores any fences.
91 bool ShouldRunBefore(const WorkQueue* other_queue) const; 95 bool ShouldRunBefore(const WorkQueue* other_queue) const;
92 96
93 // Submit a fence. When TakeTaskFromWorkQueue encounters a task whose 97 // Submit a fence. When TakeTaskFromWorkQueue encounters a task whose
94 // enqueue_order is >= |fence| then the WorkQueue will start pretending to be. 98 // enqueue_order is >= |fence| then the WorkQueue will start pretending to be.
(...skipping 10 matching lines...) Expand all
105 // Returns true if any tasks are blocked by the fence. Returns true if the 109 // Returns true if any tasks are blocked by the fence. Returns true if the
106 // queue is empty and fence has been set (i.e. future tasks would be blocked). 110 // queue is empty and fence has been set (i.e. future tasks would be blocked).
107 // Otherwise returns false. 111 // Otherwise returns false.
108 bool BlockedByFence() const; 112 bool BlockedByFence() const;
109 113
110 private: 114 private:
111 std::queue<TaskQueueImpl::Task> work_queue_; 115 std::queue<TaskQueueImpl::Task> work_queue_;
112 WorkQueueSets* work_queue_sets_; // NOT OWNED. 116 WorkQueueSets* work_queue_sets_; // NOT OWNED.
113 TaskQueueImpl* task_queue_; // NOT OWNED. 117 TaskQueueImpl* task_queue_; // NOT OWNED.
114 size_t work_queue_set_index_; 118 size_t work_queue_set_index_;
119 size_t heap_index_;
115 const char* name_; 120 const char* name_;
116 EnqueueOrder fence_; 121 EnqueueOrder fence_;
117 122
118 DISALLOW_COPY_AND_ASSIGN(WorkQueue); 123 DISALLOW_COPY_AND_ASSIGN(WorkQueue);
119 }; 124 };
120 125
121 } // namespace internal 126 } // namespace internal
122 } // namespace scheduler 127 } // namespace scheduler
123 } // namespace blink 128 } // namespace blink
124 129
125 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_WORK_QUEUE_H_ 130 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_WORK_QUEUE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698