| 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 CONTENT_RENDERER_SCHEDULER_BASE_WORK_QUEUE_H_ | 5 #ifndef CONTENT_RENDERER_SCHEDULER_BASE_WORK_QUEUE_H_ |
| 6 #define CONTENT_RENDERER_SCHEDULER_BASE_WORK_QUEUE_H_ | 6 #define CONTENT_RENDERER_SCHEDULER_BASE_WORK_QUEUE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| 11 | 11 |
| 12 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
| 13 #include "base/trace_event/trace_event_argument.h" | 13 #include "base/trace_event/trace_event_argument.h" |
| 14 #include "components/scheduler/base/enqueue_order.h" | 14 #include "components/scheduler/base/enqueue_order.h" |
| 15 #include "components/scheduler/base/task_queue_impl.h" | 15 #include "components/scheduler/base/task_queue_impl.h" |
| 16 #include "components/scheduler/scheduler_export.h" | 16 #include "components/scheduler/scheduler_export.h" |
| 17 | 17 |
| 18 namespace scheduler { | 18 namespace scheduler { |
| 19 namespace internal { | 19 namespace internal { |
| 20 class WorkQueueSets; | 20 class WorkQueueSets; |
| 21 | 21 |
| 22 class SCHEDULER_EXPORT WorkQueue { | 22 class SCHEDULER_EXPORT WorkQueue { |
| 23 public: | 23 public: |
| 24 WorkQueue(TaskQueueImpl* task_queue, const char* name); | 24 WorkQueue(TaskQueueImpl* task_queue, const char* name); |
| 25 ~WorkQueue(); | 25 ~WorkQueue(); |
| 26 | 26 |
| 27 // Associates this work queue with the given work queue sets. This must be | 27 // Associates this work queue with the given work queue sets. This must be |
| 28 // called before any tasks can be inserted into this work queue. | 28 // called before any tasks can be inserted into this work queue. |
| 29 void AssignToWorkQueueSets(WorkQueueSets* work_queue_sets, | 29 void AssignToWorkQueueSets(WorkQueueSets* work_queue_sets); |
| 30 size_t work_queue_set_index); | 30 |
| 31 // Assigns the current set index. |
| 32 void AssignSetIndex(size_t work_queue_set_index); |
| 31 | 33 |
| 32 void AsValueInto(base::trace_event::TracedValue* state) const; | 34 void AsValueInto(base::trace_event::TracedValue* state) const; |
| 33 | 35 |
| 34 // Clears the |work_queue_|. | 36 // Clears the |work_queue_|. |
| 35 void Clear(); | 37 void Clear(); |
| 36 | 38 |
| 37 // returns true if the |work_queue_| is empty. | 39 // returns true if the |work_queue_| is empty. |
| 38 bool Empty() const { return work_queue_.empty(); } | 40 bool Empty() const { return work_queue_.empty(); } |
| 39 | 41 |
| 40 // If the |work_queue_| isn't empty, |enqueue_order| gets set to the enqueue | 42 // If the |work_queue_| isn't empty, |enqueue_order| gets set to the enqueue |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 WorkQueueSets* work_queue_sets_; // NOT OWNED. | 87 WorkQueueSets* work_queue_sets_; // NOT OWNED. |
| 86 TaskQueueImpl* task_queue_; // NOT OWNED. | 88 TaskQueueImpl* task_queue_; // NOT OWNED. |
| 87 size_t work_queue_set_index_; | 89 size_t work_queue_set_index_; |
| 88 const char* name_; | 90 const char* name_; |
| 89 }; | 91 }; |
| 90 | 92 |
| 91 } // namespace internal | 93 } // namespace internal |
| 92 } // namespace scheduler | 94 } // namespace scheduler |
| 93 | 95 |
| 94 #endif // CONTENT_RENDERER_SCHEDULER_BASE_WORK_QUEUE_H_ | 96 #endif // CONTENT_RENDERER_SCHEDULER_BASE_WORK_QUEUE_H_ |
| OLD | NEW |