| OLD | NEW |
| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // method ignores any fences. | 59 // method ignores any fences. |
| 60 const TaskQueueImpl::Task* GetBackTask() const; | 60 const TaskQueueImpl::Task* GetBackTask() const; |
| 61 | 61 |
| 62 // Pushes the task onto the |work_queue_| and a fence hasn't been reached it | 62 // Pushes the task onto the |work_queue_| and a fence hasn't been reached it |
| 63 // informs the WorkQueueSets if the head changed. | 63 // informs the WorkQueueSets if the head changed. |
| 64 void Push(TaskQueueImpl::Task task); | 64 void Push(TaskQueueImpl::Task task); |
| 65 | 65 |
| 66 // Swap the |work_queue_| with |incoming_queue| and if a fence hasn't been | 66 // Swap the |work_queue_| with |incoming_queue| and if a fence hasn't been |
| 67 // reached it informs the WorkQueueSets if the head changed. Assumes | 67 // reached it informs the WorkQueueSets if the head changed. Assumes |
| 68 // |task_queue_->any_thread_lock_| is locked. | 68 // |task_queue_->any_thread_lock_| is locked. |
| 69 void SwapLocked(std::queue<TaskQueueImpl::Task>& incoming_queue); | 69 void SwapLocked(WTF::Deque<TaskQueueImpl::Task>& incoming_queue); |
| 70 | 70 |
| 71 size_t Size() const { return work_queue_.size(); } | 71 size_t Size() const { return work_queue_.size(); } |
| 72 | 72 |
| 73 // Pulls a task off the |work_queue_| and informs the WorkQueueSets. If the | 73 // Pulls a task off the |work_queue_| and informs the WorkQueueSets. If the |
| 74 // task removed had an enqueue order >= the current fence then WorkQueue | 74 // task removed had an enqueue order >= the current fence then WorkQueue |
| 75 // pretends to be empty as far as the WorkQueueSets is concrned. | 75 // pretends to be empty as far as the WorkQueueSets is concrned. |
| 76 TaskQueueImpl::Task TakeTaskFromWorkQueue(); | 76 TaskQueueImpl::Task TakeTaskFromWorkQueue(); |
| 77 | 77 |
| 78 const char* name() const { return name_; } | 78 const char* name() const { return name_; } |
| 79 | 79 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 106 // empty, then the real value is reported to WorkQueueSets. Returns true if | 106 // empty, then the real value is reported to WorkQueueSets. Returns true if |
| 107 // any tasks where unblocked. | 107 // any tasks where unblocked. |
| 108 bool RemoveFence(); | 108 bool RemoveFence(); |
| 109 | 109 |
| 110 // Returns true if any tasks are blocked by the fence. Returns true if the | 110 // Returns true if any tasks are blocked by the fence. Returns true if the |
| 111 // queue is empty and fence has been set (i.e. future tasks would be blocked). | 111 // queue is empty and fence has been set (i.e. future tasks would be blocked). |
| 112 // Otherwise returns false. | 112 // Otherwise returns false. |
| 113 bool BlockedByFence() const; | 113 bool BlockedByFence() const; |
| 114 | 114 |
| 115 private: | 115 private: |
| 116 std::queue<TaskQueueImpl::Task> work_queue_; | 116 WTF::Deque<TaskQueueImpl::Task> work_queue_; |
| 117 WorkQueueSets* work_queue_sets_; // NOT OWNED. | 117 WorkQueueSets* work_queue_sets_; // NOT OWNED. |
| 118 TaskQueueImpl* task_queue_; // NOT OWNED. | 118 TaskQueueImpl* task_queue_; // NOT OWNED. |
| 119 size_t work_queue_set_index_; | 119 size_t work_queue_set_index_; |
| 120 HeapHandle heap_handle_; | 120 HeapHandle heap_handle_; |
| 121 const char* name_; | 121 const char* name_; |
| 122 EnqueueOrder fence_; | 122 EnqueueOrder fence_; |
| 123 | 123 |
| 124 DISALLOW_COPY_AND_ASSIGN(WorkQueue); | 124 DISALLOW_COPY_AND_ASSIGN(WorkQueue); |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 } // namespace internal | 127 } // namespace internal |
| 128 } // namespace scheduler | 128 } // namespace scheduler |
| 129 } // namespace blink | 129 } // namespace blink |
| 130 | 130 |
| 131 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_WORK_QUEUE_H_ | 131 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_WORK_QUEUE_H_ |
| OLD | NEW |