OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "base/threading/sequenced_worker_pool.h" | 5 #include "base/threading/sequenced_worker_pool.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 while (unblock_counter_ == 0) | 47 while (unblock_counter_ == 0) |
48 cond_var_.Wait(); | 48 cond_var_.Wait(); |
49 unblock_counter_--; | 49 unblock_counter_--; |
50 } | 50 } |
51 cond_var_.Signal(); | 51 cond_var_.Signal(); |
52 } | 52 } |
53 | 53 |
54 void Unblock(size_t count) { | 54 void Unblock(size_t count) { |
55 { | 55 { |
56 base::AutoLock lock(lock_); | 56 base::AutoLock lock(lock_); |
57 DCHECK(unblock_counter_ == 0); | 57 DCHECK_EQ(unblock_counter_, 0u); |
58 unblock_counter_ = count; | 58 unblock_counter_ = count; |
59 } | 59 } |
60 cond_var_.Signal(); | 60 cond_var_.Signal(); |
61 } | 61 } |
62 | 62 |
63 private: | 63 private: |
64 base::Lock lock_; | 64 base::Lock lock_; |
65 base::ConditionVariable cond_var_; | 65 base::ConditionVariable cond_var_; |
66 | 66 |
67 size_t unblock_counter_; | 67 size_t unblock_counter_; |
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 SequencedWorkerPoolSequencedTaskRunner, TaskRunnerTest, | 955 SequencedWorkerPoolSequencedTaskRunner, TaskRunnerTest, |
956 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); | 956 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); |
957 | 957 |
958 INSTANTIATE_TYPED_TEST_CASE_P( | 958 INSTANTIATE_TYPED_TEST_CASE_P( |
959 SequencedWorkerPoolSequencedTaskRunner, SequencedTaskRunnerTest, | 959 SequencedWorkerPoolSequencedTaskRunner, SequencedTaskRunnerTest, |
960 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); | 960 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); |
961 | 961 |
962 } // namespace | 962 } // namespace |
963 | 963 |
964 } // namespace base | 964 } // namespace base |
OLD | NEW |