OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/scheduler/base/task_queue_impl.h" | 5 #include "components/scheduler/base/task_queue_impl.h" |
6 | 6 |
7 #include "components/scheduler/base/task_queue_manager.h" | 7 #include "components/scheduler/base/task_queue_manager.h" |
8 #include "components/scheduler/base/task_queue_manager_delegate.h" | 8 #include "components/scheduler/base/task_queue_manager_delegate.h" |
9 #include "components/scheduler/base/time_domain.h" | 9 #include "components/scheduler/base/time_domain.h" |
10 #include "components/scheduler/base/work_queue.h" | 10 #include "components/scheduler/base/work_queue.h" |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 DCHECK(main_thread_checker_.CalledOnValidThread()); | 610 DCHECK(main_thread_checker_.CalledOnValidThread()); |
611 if (time_domain == main_thread_only().time_domain) | 611 if (time_domain == main_thread_only().time_domain) |
612 return; | 612 return; |
613 | 613 |
614 if (time_domain) | 614 if (time_domain) |
615 main_thread_only().time_domain->MigrateQueue(this, time_domain); | 615 main_thread_only().time_domain->MigrateQueue(this, time_domain); |
616 main_thread_only().time_domain = time_domain; | 616 main_thread_only().time_domain = time_domain; |
617 any_thread().time_domain = time_domain; | 617 any_thread().time_domain = time_domain; |
618 } | 618 } |
619 | 619 |
| 620 TimeDomain* TaskQueueImpl::GetTimeDomain() const { |
| 621 if (base::PlatformThread::CurrentId() == thread_id_) |
| 622 return main_thread_only().time_domain; |
| 623 |
| 624 base::AutoLock lock(any_thread_lock_); |
| 625 return any_thread().time_domain; |
| 626 } |
| 627 |
620 // static | 628 // static |
621 void TaskQueueImpl::QueueAsValueInto(const std::queue<Task>& queue, | 629 void TaskQueueImpl::QueueAsValueInto(const std::queue<Task>& queue, |
622 base::trace_event::TracedValue* state) { | 630 base::trace_event::TracedValue* state) { |
623 std::queue<Task> queue_copy(queue); | 631 std::queue<Task> queue_copy(queue); |
624 while (!queue_copy.empty()) { | 632 while (!queue_copy.empty()) { |
625 TaskAsValueInto(queue_copy.front(), state); | 633 TaskAsValueInto(queue_copy.front(), state); |
626 queue_copy.pop(); | 634 queue_copy.pop(); |
627 } | 635 } |
628 } | 636 } |
629 | 637 |
(...skipping 22 matching lines...) Expand all Loading... |
652 state->SetBoolean("nestable", task.nestable); | 660 state->SetBoolean("nestable", task.nestable); |
653 state->SetBoolean("is_high_res", task.is_high_res); | 661 state->SetBoolean("is_high_res", task.is_high_res); |
654 state->SetDouble( | 662 state->SetDouble( |
655 "delayed_run_time", | 663 "delayed_run_time", |
656 (task.delayed_run_time - base::TimeTicks()).InMicroseconds() / 1000.0L); | 664 (task.delayed_run_time - base::TimeTicks()).InMicroseconds() / 1000.0L); |
657 state->EndDictionary(); | 665 state->EndDictionary(); |
658 } | 666 } |
659 | 667 |
660 } // namespace internal | 668 } // namespace internal |
661 } // namespace scheduler | 669 } // namespace scheduler |
OLD | NEW |