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

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

Issue 1901223003: base: Remove a copy of and copy ctor from SequenceAndSortKey. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 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 14 matching lines...) Expand all
25 public: 25 public:
26 // An immutable struct combining a Sequence and the sort key that determines 26 // An immutable struct combining a Sequence and the sort key that determines
27 // its position in a PriorityQueue. 27 // its position in a PriorityQueue.
28 struct BASE_EXPORT SequenceAndSortKey { 28 struct BASE_EXPORT SequenceAndSortKey {
29 // Constructs a null SequenceAndSortKey. 29 // Constructs a null SequenceAndSortKey.
30 SequenceAndSortKey(); 30 SequenceAndSortKey();
31 31
32 // Constructs a SequenceAndSortKey with the given |sequence| and |sort_key|. 32 // Constructs a SequenceAndSortKey with the given |sequence| and |sort_key|.
33 SequenceAndSortKey(scoped_refptr<Sequence> sequence, 33 SequenceAndSortKey(scoped_refptr<Sequence> sequence,
34 const SequenceSortKey& sort_key); 34 const SequenceSortKey& sort_key);
35
36 SequenceAndSortKey(const SequenceAndSortKey& other);
danakj 2016/04/19 20:11:54 DISALLOW_COPY_AND_ASSIGN then?
vmpstr 2016/04/19 20:14:17 Done. I didn't do this initially, because it's unc
37
38 ~SequenceAndSortKey(); 35 ~SequenceAndSortKey();
39 36
40 // Returns true if this is a null SequenceAndSortKey. 37 // Returns true if this is a null SequenceAndSortKey.
41 bool is_null() const { return !sequence; } 38 bool is_null() const { return !sequence; }
42 39
43 const scoped_refptr<Sequence> sequence; 40 const scoped_refptr<Sequence> sequence;
44 const SequenceSortKey sort_key; 41 const SequenceSortKey sort_key;
fdoray 2016/04/19 20:14:13 Add: private: DISALLOW_COPY_AND_ASSIGN(SequenceA
45 }; 42 };
46 43
47 // A Transaction can perform multiple operations atomically on a 44 // A Transaction can perform multiple operations atomically on a
48 // PriorityQueue. While a Transaction is alive, it is guaranteed that nothing 45 // PriorityQueue. While a Transaction is alive, it is guaranteed that nothing
49 // else will access the PriorityQueue. 46 // else will access the PriorityQueue.
50 // 47 //
51 // A WorkerThread needs to be able to Peek sequences from both its 48 // A WorkerThread needs to be able to Peek sequences from both its
52 // PriorityQueues (single-threaded and shared) and then Pop the sequence with 49 // PriorityQueues (single-threaded and shared) and then Pop the sequence with
53 // the highest priority. If the Peek and the Pop are done through the same 50 // the highest priority. If the Peek and the Pop are done through the same
54 // Transaction, it is guaranteed that the PriorityQueue hasn't changed between 51 // Transaction, it is guaranteed that the PriorityQueue hasn't changed between
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // empty. 117 // empty.
121 const SequenceAndSortKey empty_sequence_and_sort_key_; 118 const SequenceAndSortKey empty_sequence_and_sort_key_;
122 119
123 DISALLOW_COPY_AND_ASSIGN(PriorityQueue); 120 DISALLOW_COPY_AND_ASSIGN(PriorityQueue);
124 }; 121 };
125 122
126 } // namespace internal 123 } // namespace internal
127 } // namespace base 124 } // namespace base
128 125
129 #endif // BASE_TASK_SCHEDULER_PRIORITY_QUEUE_H_ 126 #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_thread_pool.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698