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/task_tracker.h" | 5 #include "base/task_scheduler/task_tracker.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
381 } | 381 } |
382 } | 382 } |
383 } | 383 } |
384 | 384 |
385 #if DCHECK_IS_ON() | 385 #if DCHECK_IS_ON() |
386 bool TaskTracker::IsPostingBlockShutdownTaskAfterShutdownAllowed() { | 386 bool TaskTracker::IsPostingBlockShutdownTaskAfterShutdownAllowed() { |
387 return false; | 387 return false; |
388 } | 388 } |
389 #endif | 389 #endif |
390 | 390 |
391 int TaskTracker::GetNumPendingUndelayedTasksForTesting() const { | |
392 return subtle::Acquire_Load(&num_pending_undelayed_tasks_); | |
gab
2017/05/23 15:26:13
Reason to Acquire_Load?
fdoray
2017/05/25 19:17:33
I would have liked to Acquire_NoBarrier, but this
gab
2017/05/25 19:29:29
As mentioned offline there is NoBarrier_Load
fdoray
2017/05/25 20:06:44
Done.
| |
393 } | |
394 | |
391 bool TaskTracker::BeforePostTask(TaskShutdownBehavior shutdown_behavior) { | 395 bool TaskTracker::BeforePostTask(TaskShutdownBehavior shutdown_behavior) { |
392 if (shutdown_behavior == TaskShutdownBehavior::BLOCK_SHUTDOWN) { | 396 if (shutdown_behavior == TaskShutdownBehavior::BLOCK_SHUTDOWN) { |
393 // BLOCK_SHUTDOWN tasks block shutdown between the moment they are posted | 397 // BLOCK_SHUTDOWN tasks block shutdown between the moment they are posted |
394 // and the moment they complete their execution. | 398 // and the moment they complete their execution. |
395 const bool shutdown_started = state_->IncrementNumTasksBlockingShutdown(); | 399 const bool shutdown_started = state_->IncrementNumTasksBlockingShutdown(); |
396 | 400 |
397 if (shutdown_started) { | 401 if (shutdown_started) { |
398 AutoSchedulerLock auto_lock(shutdown_lock_); | 402 AutoSchedulerLock auto_lock(shutdown_lock_); |
399 | 403 |
400 // A BLOCK_SHUTDOWN task posted after shutdown has completed is an | 404 // A BLOCK_SHUTDOWN task posted after shutdown has completed is an |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
512 task_latency_histograms_[static_cast<int>(task->traits.priority())] | 516 task_latency_histograms_[static_cast<int>(task->traits.priority())] |
513 [task->traits.may_block() || | 517 [task->traits.may_block() || |
514 task->traits.with_base_sync_primitives() | 518 task->traits.with_base_sync_primitives() |
515 ? 1 | 519 ? 1 |
516 : 0] | 520 : 0] |
517 ->Add(task_latency.InMicroseconds()); | 521 ->Add(task_latency.InMicroseconds()); |
518 } | 522 } |
519 | 523 |
520 } // namespace internal | 524 } // namespace internal |
521 } // namespace base | 525 } // namespace base |
OLD | NEW |