OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_THREADING_SEQUENCED_WORKER_POOL_H_ | 5 #ifndef BASE_THREADING_SEQUENCED_WORKER_POOL_H_ |
6 #define BASE_THREADING_SEQUENCED_WORKER_POOL_H_ | 6 #define BASE_THREADING_SEQUENCED_WORKER_POOL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 BLOCK_SHUTDOWN, | 86 BLOCK_SHUTDOWN, |
87 }; | 87 }; |
88 | 88 |
89 // Opaque identifier that defines sequencing of tasks posted to the worker | 89 // Opaque identifier that defines sequencing of tasks posted to the worker |
90 // pool. See NewSequenceToken(). | 90 // pool. See NewSequenceToken(). |
91 class SequenceToken { | 91 class SequenceToken { |
92 public: | 92 public: |
93 explicit SequenceToken() : id_(0) {} | 93 explicit SequenceToken() : id_(0) {} |
94 ~SequenceToken() {} | 94 ~SequenceToken() {} |
95 | 95 |
| 96 // Returns true if this is a null sequence token. The null sequence token |
| 97 // has not been initialized. |
| 98 bool is_null() const { return id_ == 0; } |
| 99 |
96 bool Equals(const SequenceToken& other) const { | 100 bool Equals(const SequenceToken& other) const { |
97 return id_ == other.id_; | 101 return id_ == other.id_; |
98 } | 102 } |
99 | 103 |
100 private: | 104 private: |
101 friend class SequencedWorkerPool; | 105 friend class SequencedWorkerPool; |
102 | 106 |
103 SequenceToken(int id) : id_(id) {} | 107 SequenceToken(int id) : id_(id) {} |
104 | 108 |
105 int id_; | 109 int id_; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 friend class Worker; | 201 friend class Worker; |
198 | 202 |
199 scoped_refptr<Inner> inner_; | 203 scoped_refptr<Inner> inner_; |
200 | 204 |
201 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPool); | 205 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPool); |
202 }; | 206 }; |
203 | 207 |
204 } // namespace base | 208 } // namespace base |
205 | 209 |
206 #endif // BASE_THREADING_SEQUENCED_WORKER_POOL_H_ | 210 #endif // BASE_THREADING_SEQUENCED_WORKER_POOL_H_ |
OLD | NEW |