| 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 "base/trace_event/blame_context.h" | 7 #include "base/trace_event/blame_context.h" |
| 8 #include "components/scheduler/base/task_queue_manager.h" | 8 #include "components/scheduler/base/task_queue_manager.h" |
| 9 #include "components/scheduler/base/task_queue_manager_delegate.h" | 9 #include "components/scheduler/base/task_queue_manager_delegate.h" |
| 10 #include "components/scheduler/base/time_domain.h" | 10 #include "components/scheduler/base/time_domain.h" |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 TimeDomain* TaskQueueImpl::GetTimeDomain() const { | 654 TimeDomain* TaskQueueImpl::GetTimeDomain() const { |
| 655 if (base::PlatformThread::CurrentId() == thread_id_) | 655 if (base::PlatformThread::CurrentId() == thread_id_) |
| 656 return main_thread_only().time_domain; | 656 return main_thread_only().time_domain; |
| 657 | 657 |
| 658 base::AutoLock lock(any_thread_lock_); | 658 base::AutoLock lock(any_thread_lock_); |
| 659 return any_thread().time_domain; | 659 return any_thread().time_domain; |
| 660 } | 660 } |
| 661 | 661 |
| 662 void TaskQueueImpl::SetBlameContext( | 662 void TaskQueueImpl::SetBlameContext( |
| 663 base::trace_event::BlameContext* blame_context) { | 663 base::trace_event::BlameContext* blame_context) { |
| 664 main_thread_only().blame_context = blame_context; | 664 main_thread_only().blame_context = |
| 665 blame_context ? blame_context->weak_ptr() : nullptr; |
| 665 } | 666 } |
| 666 | 667 |
| 667 // static | 668 // static |
| 668 void TaskQueueImpl::QueueAsValueInto(const std::queue<Task>& queue, | 669 void TaskQueueImpl::QueueAsValueInto(const std::queue<Task>& queue, |
| 669 base::trace_event::TracedValue* state) { | 670 base::trace_event::TracedValue* state) { |
| 670 std::queue<Task> queue_copy(queue); | 671 std::queue<Task> queue_copy(queue); |
| 671 while (!queue_copy.empty()) { | 672 while (!queue_copy.empty()) { |
| 672 TaskAsValueInto(queue_copy.front(), state); | 673 TaskAsValueInto(queue_copy.front(), state); |
| 673 queue_copy.pop(); | 674 queue_copy.pop(); |
| 674 } | 675 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 699 state->SetBoolean("nestable", task.nestable); | 700 state->SetBoolean("nestable", task.nestable); |
| 700 state->SetBoolean("is_high_res", task.is_high_res); | 701 state->SetBoolean("is_high_res", task.is_high_res); |
| 701 state->SetDouble( | 702 state->SetDouble( |
| 702 "delayed_run_time", | 703 "delayed_run_time", |
| 703 (task.delayed_run_time - base::TimeTicks()).InMicroseconds() / 1000.0L); | 704 (task.delayed_run_time - base::TimeTicks()).InMicroseconds() / 1000.0L); |
| 704 state->EndDictionary(); | 705 state->EndDictionary(); |
| 705 } | 706 } |
| 706 | 707 |
| 707 } // namespace internal | 708 } // namespace internal |
| 708 } // namespace scheduler | 709 } // namespace scheduler |
| OLD | NEW |