OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/child/task_queue_manager.h" | 5 #include "components/scheduler/child/task_queue_manager.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 } else { | 684 } else { |
685 // Suppress "will" task observer notifications for the first and "did" | 685 // Suppress "will" task observer notifications for the first and "did" |
686 // notifications for the last task in the batch to avoid duplicate | 686 // notifications for the last task in the batch to avoid duplicate |
687 // notifications. | 687 // notifications. |
688 if (has_previous_task) { | 688 if (has_previous_task) { |
689 FOR_EACH_OBSERVER(base::MessageLoop::TaskObserver, task_observers_, | 689 FOR_EACH_OBSERVER(base::MessageLoop::TaskObserver, task_observers_, |
690 DidProcessTask(*previous_task)); | 690 DidProcessTask(*previous_task)); |
691 FOR_EACH_OBSERVER(base::MessageLoop::TaskObserver, task_observers_, | 691 FOR_EACH_OBSERVER(base::MessageLoop::TaskObserver, task_observers_, |
692 WillProcessTask(pending_task)); | 692 WillProcessTask(pending_task)); |
693 } | 693 } |
694 task_annotator_.RunTask("TaskQueueManager::PostTask", | 694 |
695 "TaskQueueManager::RunTask", pending_task); | 695 TRACE_TASK_EXECUTION("TaskQueueManager::ProcessTaskFromWorkQueue", |
| 696 pending_task); |
| 697 task_annotator_.RunTask("TaskQueueManager::PostTask", pending_task); |
696 | 698 |
697 // Detect if the TaskQueueManager just got deleted. If this happens we must | 699 // Detect if the TaskQueueManager just got deleted. If this happens we must |
698 // not access any member variables after this point. | 700 // not access any member variables after this point. |
699 if (protect->HasOneRef()) | 701 if (protect->HasOneRef()) |
700 return true; | 702 return true; |
701 | 703 |
702 pending_task.task.Reset(); | 704 pending_task.task.Reset(); |
703 *previous_task = pending_task; | 705 *previous_task = pending_task; |
704 } | 706 } |
705 return false; | 707 return false; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 return nullptr; | 812 return nullptr; |
811 } | 813 } |
812 } | 814 } |
813 | 815 |
814 void TaskQueueManager::OnTaskQueueEnabled() { | 816 void TaskQueueManager::OnTaskQueueEnabled() { |
815 DCHECK(main_thread_checker_.CalledOnValidThread()); | 817 DCHECK(main_thread_checker_.CalledOnValidThread()); |
816 MaybePostDoWorkOnMainRunner(); | 818 MaybePostDoWorkOnMainRunner(); |
817 } | 819 } |
818 | 820 |
819 } // namespace scheduler | 821 } // namespace scheduler |
OLD | NEW |