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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
334 main_task_runner_->PostNonNestableTask(pending_task.posted_from, | 334 main_task_runner_->PostNonNestableTask(pending_task.posted_from, |
335 pending_task.task); | 335 pending_task.task); |
336 } else { | 336 } else { |
337 TRACE_TASK_EXECUTION("TaskQueueManager::ProcessTaskFromWorkQueue", | 337 TRACE_TASK_EXECUTION("TaskQueueManager::ProcessTaskFromWorkQueue", |
338 pending_task); | 338 pending_task); |
339 if (queue->GetShouldNotifyObservers()) { | 339 if (queue->GetShouldNotifyObservers()) { |
340 FOR_EACH_OBSERVER(base::MessageLoop::TaskObserver, task_observers_, | 340 FOR_EACH_OBSERVER(base::MessageLoop::TaskObserver, task_observers_, |
341 WillProcessTask(pending_task)); | 341 WillProcessTask(pending_task)); |
342 queue->NotifyWillProcessTask(pending_task); | 342 queue->NotifyWillProcessTask(pending_task); |
343 } | 343 } |
344 TRACE_EVENT1(disabled_by_default_tracing_category_, | 344 TRACE_EVENT2(disabled_by_default_tracing_category_, |
345 "Run Task From Queue", "queue", queue->GetName()); | 345 "Run Task From Queue", "queue", queue->GetName(), |
Sami
2015/09/10 12:51:57
Since you're touching this, could you change this
alex clarke (OOO till 29th)
2015/09/10 14:35:58
I'm not sure what happened there, I thought we had
| |
346 "origin", queue->GetOrigin()); | |
346 task_annotator_.RunTask("TaskQueueManager::PostTask", pending_task); | 347 task_annotator_.RunTask("TaskQueueManager::PostTask", pending_task); |
347 | 348 |
348 // Detect if the TaskQueueManager just got deleted. If this happens we must | 349 // Detect if the TaskQueueManager just got deleted. If this happens we must |
349 // not access any member variables after this point. | 350 // not access any member variables after this point. |
350 if (protect->HasOneRef()) | 351 if (protect->HasOneRef()) |
351 return true; | 352 return true; |
352 | 353 |
353 if (queue->GetShouldNotifyObservers()) { | 354 if (queue->GetShouldNotifyObservers()) { |
354 FOR_EACH_OBSERVER(base::MessageLoop::TaskObserver, task_observers_, | 355 FOR_EACH_OBSERVER(base::MessageLoop::TaskObserver, task_observers_, |
355 DidProcessTask(pending_task)); | 356 DidProcessTask(pending_task)); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
437 } | 438 } |
438 | 439 |
439 void TaskQueueManager::OnTaskQueueEnabled(internal::TaskQueueImpl* queue) { | 440 void TaskQueueManager::OnTaskQueueEnabled(internal::TaskQueueImpl* queue) { |
440 DCHECK(main_thread_checker_.CalledOnValidThread()); | 441 DCHECK(main_thread_checker_.CalledOnValidThread()); |
441 // Only schedule DoWork if there's something to do. | 442 // Only schedule DoWork if there's something to do. |
442 if (!queue->work_queue().empty()) | 443 if (!queue->work_queue().empty()) |
443 MaybePostDoWorkOnMainRunner(); | 444 MaybePostDoWorkOnMainRunner(); |
444 } | 445 } |
445 | 446 |
446 } // namespace scheduler | 447 } // namespace scheduler |
OLD | NEW |