| OLD | NEW |
| 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 #include "base/task_scheduler/scheduler_worker_pool_impl.h" | 5 #include "base/task_scheduler/scheduler_worker_pool_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <unordered_set> | 10 #include <unordered_set> |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 } | 345 } |
| 346 | 346 |
| 347 // Verifies that the current thread allows I/O if |io_restriction| is ALLOWED | 347 // Verifies that the current thread allows I/O if |io_restriction| is ALLOWED |
| 348 // and disallows it otherwise. Signals |event| before returning. | 348 // and disallows it otherwise. Signals |event| before returning. |
| 349 void ExpectIORestriction(IORestriction io_restriction, WaitableEvent* event) { | 349 void ExpectIORestriction(IORestriction io_restriction, WaitableEvent* event) { |
| 350 DCHECK(event); | 350 DCHECK(event); |
| 351 | 351 |
| 352 if (io_restriction == IORestriction::ALLOWED) { | 352 if (io_restriction == IORestriction::ALLOWED) { |
| 353 ThreadRestrictions::AssertIOAllowed(); | 353 ThreadRestrictions::AssertIOAllowed(); |
| 354 } else { | 354 } else { |
| 355 EXPECT_DCHECK_DEATH({ ThreadRestrictions::AssertIOAllowed(); }, ""); | 355 EXPECT_DCHECK_DEATH({ ThreadRestrictions::AssertIOAllowed(); }); |
| 356 } | 356 } |
| 357 | 357 |
| 358 event->Signal(); | 358 event->Signal(); |
| 359 } | 359 } |
| 360 | 360 |
| 361 class TaskSchedulerWorkerPoolImplIORestrictionTest | 361 class TaskSchedulerWorkerPoolImplIORestrictionTest |
| 362 : public testing::TestWithParam<IORestriction> { | 362 : public testing::TestWithParam<IORestriction> { |
| 363 public: | 363 public: |
| 364 TaskSchedulerWorkerPoolImplIORestrictionTest() = default; | 364 TaskSchedulerWorkerPoolImplIORestrictionTest() = default; |
| 365 | 365 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 count_waiter->Wait(); | 548 count_waiter->Wait(); |
| 549 | 549 |
| 550 EXPECT_GT(subtle::NoBarrier_Load(&zero_tls_values_), 0); | 550 EXPECT_GT(subtle::NoBarrier_Load(&zero_tls_values_), 0); |
| 551 | 551 |
| 552 // Release tasks waiting on |waiter_|. | 552 // Release tasks waiting on |waiter_|. |
| 553 waiter_.Signal(); | 553 waiter_.Signal(); |
| 554 } | 554 } |
| 555 | 555 |
| 556 } // namespace internal | 556 } // namespace internal |
| 557 } // namespace base | 557 } // namespace base |
| OLD | NEW |