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

Side by Side Diff: base/task_scheduler/priority_queue.h

Issue 2721553003: Remove SingleThreadTaskRunner Support from SchedulerWorkerPoolImpl (Closed)
Patch Set: Rebase to 08266b3 Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 BASE_TASK_SCHEDULER_PRIORITY_QUEUE_H_ 5 #ifndef BASE_TASK_SCHEDULER_PRIORITY_QUEUE_H_
6 #define BASE_TASK_SCHEDULER_PRIORITY_QUEUE_H_ 6 #define BASE_TASK_SCHEDULER_PRIORITY_QUEUE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <queue> 9 #include <queue>
10 #include <vector> 10 #include <vector>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // Holds the lock of |outer_queue_| for the lifetime of this Transaction. 63 // Holds the lock of |outer_queue_| for the lifetime of this Transaction.
64 AutoSchedulerLock auto_lock_; 64 AutoSchedulerLock auto_lock_;
65 65
66 PriorityQueue* const outer_queue_; 66 PriorityQueue* const outer_queue_;
67 67
68 DISALLOW_COPY_AND_ASSIGN(Transaction); 68 DISALLOW_COPY_AND_ASSIGN(Transaction);
69 }; 69 };
70 70
71 PriorityQueue(); 71 PriorityQueue();
72 72
73 // |predecessor_priority_queue| is a PriorityQueue for which a thread is
74 // allowed to have an active Transaction when it creates a Transaction for
75 // this PriorityQueue.
76 PriorityQueue(const PriorityQueue* predecessor_priority_queue);
77
78 ~PriorityQueue(); 73 ~PriorityQueue();
79 74
80 // Begins a Transaction. This method cannot be called on a thread which has an 75 // Begins a Transaction. This method cannot be called on a thread which has an
81 // active Transaction unless the last Transaction created on the thread was 76 // active Transaction unless the last Transaction created on the thread was
82 // for the allowed predecessor specified in the constructor of this 77 // for the allowed predecessor specified in the constructor of this
83 // PriorityQueue. 78 // PriorityQueue.
84 std::unique_ptr<Transaction> BeginTransaction(); 79 std::unique_ptr<Transaction> BeginTransaction();
85 80
86 const SchedulerLock* container_lock() const { return &container_lock_; } 81 const SchedulerLock* container_lock() const { return &container_lock_; }
87 82
88 private: 83 private:
89 // A class combining a Sequence and the SequenceSortKey that determines its 84 // A class combining a Sequence and the SequenceSortKey that determines its
90 // position in a PriorityQueue. 85 // position in a PriorityQueue.
91 class SequenceAndSortKey; 86 class SequenceAndSortKey;
92 87
93 using ContainerType = std::priority_queue<SequenceAndSortKey>; 88 using ContainerType = std::priority_queue<SequenceAndSortKey>;
94 89
95 // Synchronizes access to |container_|. 90 // Synchronizes access to |container_|.
96 SchedulerLock container_lock_; 91 SchedulerLock container_lock_;
97 92
98 ContainerType container_; 93 ContainerType container_;
99 94
100 DISALLOW_COPY_AND_ASSIGN(PriorityQueue); 95 DISALLOW_COPY_AND_ASSIGN(PriorityQueue);
101 }; 96 };
102 97
103 } // namespace internal 98 } // namespace internal
104 } // namespace base 99 } // namespace base
105 100
106 #endif // BASE_TASK_SCHEDULER_PRIORITY_QUEUE_H_ 101 #endif // BASE_TASK_SCHEDULER_PRIORITY_QUEUE_H_
OLDNEW
« no previous file with comments | « no previous file | base/task_scheduler/priority_queue.cc » ('j') | base/task_scheduler/scheduler_worker_pool_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698