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 TRACE_EVENT_WITH_MEMORY_TAG2( |
danakj
2015/07/15 18:03:23
Why don't you include WillProcessTask here?
| |
695 "TaskQueueManager::RunTask", pending_task); | 695 "toplevel", |
danakj
2015/07/16 01:01:42
Then does it make sense to add these other "toplev
| |
696 "TaskQueueManager::ProcessTaskFromWorkQueue", | |
697 pending_task.posted_from.function_name(), // Name for memory tracking. | |
698 "src_file", | |
699 pending_task.posted_from.file_name(), | |
700 "src_func", | |
701 pending_task.posted_from.function_name()); | |
702 | |
703 task_annotator_.RunTask("TaskQueueManager::PostTask", pending_task); | |
696 | 704 |
697 // Detect if the TaskQueueManager just got deleted. If this happens we must | 705 // Detect if the TaskQueueManager just got deleted. If this happens we must |
698 // not access any member variables after this point. | 706 // not access any member variables after this point. |
699 if (protect->HasOneRef()) | 707 if (protect->HasOneRef()) |
700 return true; | 708 return true; |
701 | 709 |
702 pending_task.task.Reset(); | 710 pending_task.task.Reset(); |
703 *previous_task = pending_task; | 711 *previous_task = pending_task; |
704 } | 712 } |
705 return false; | 713 return false; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
810 return nullptr; | 818 return nullptr; |
811 } | 819 } |
812 } | 820 } |
813 | 821 |
814 void TaskQueueManager::OnTaskQueueEnabled() { | 822 void TaskQueueManager::OnTaskQueueEnabled() { |
815 DCHECK(main_thread_checker_.CalledOnValidThread()); | 823 DCHECK(main_thread_checker_.CalledOnValidThread()); |
816 MaybePostDoWorkOnMainRunner(); | 824 MaybePostDoWorkOnMainRunner(); |
817 } | 825 } |
818 | 826 |
819 } // namespace scheduler | 827 } // namespace scheduler |
OLD | NEW |