Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc

Issue 2420303002: Remove usage of FOR_EACH_OBSERVER macro in platform/scheduler (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "platform/scheduler/base/task_queue_impl.h" 5 #include "platform/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 "platform/scheduler/base/task_queue_manager.h" 8 #include "platform/scheduler/base/task_queue_manager.h"
9 #include "platform/scheduler/base/task_queue_manager_delegate.h" 9 #include "platform/scheduler/base/task_queue_manager_delegate.h"
10 #include "platform/scheduler/base/time_domain.h" 10 #include "platform/scheduler/base/time_domain.h"
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 void TaskQueueImpl::RemoveTaskObserver( 500 void TaskQueueImpl::RemoveTaskObserver(
501 base::MessageLoop::TaskObserver* task_observer) { 501 base::MessageLoop::TaskObserver* task_observer) {
502 main_thread_only().task_observers.RemoveObserver(task_observer); 502 main_thread_only().task_observers.RemoveObserver(task_observer);
503 } 503 }
504 504
505 void TaskQueueImpl::NotifyWillProcessTask( 505 void TaskQueueImpl::NotifyWillProcessTask(
506 const base::PendingTask& pending_task) { 506 const base::PendingTask& pending_task) {
507 DCHECK(should_notify_observers_); 507 DCHECK(should_notify_observers_);
508 if (main_thread_only().blame_context) 508 if (main_thread_only().blame_context)
509 main_thread_only().blame_context->Enter(); 509 main_thread_only().blame_context->Enter();
510 FOR_EACH_OBSERVER(base::MessageLoop::TaskObserver, 510 for (auto& observer : main_thread_only().task_observers)
511 main_thread_only().task_observers, 511 observer.WillProcessTask(pending_task);
512 WillProcessTask(pending_task));
513 } 512 }
514 513
515 void TaskQueueImpl::NotifyDidProcessTask( 514 void TaskQueueImpl::NotifyDidProcessTask(
516 const base::PendingTask& pending_task) { 515 const base::PendingTask& pending_task) {
517 DCHECK(should_notify_observers_); 516 DCHECK(should_notify_observers_);
518 FOR_EACH_OBSERVER(base::MessageLoop::TaskObserver, 517 for (auto& observer : main_thread_only().task_observers)
519 main_thread_only().task_observers, 518 observer.DidProcessTask(pending_task);
520 DidProcessTask(pending_task));
521 if (main_thread_only().blame_context) 519 if (main_thread_only().blame_context)
522 main_thread_only().blame_context->Leave(); 520 main_thread_only().blame_context->Leave();
523 } 521 }
524 522
525 void TaskQueueImpl::SetTimeDomain(TimeDomain* time_domain) { 523 void TaskQueueImpl::SetTimeDomain(TimeDomain* time_domain) {
526 { 524 {
527 base::AutoLock lock(any_thread_lock_); 525 base::AutoLock lock(any_thread_lock_);
528 DCHECK(time_domain); 526 DCHECK(time_domain);
529 // NOTE this is similar to checking |any_thread().task_queue_manager| but 527 // NOTE this is similar to checking |any_thread().task_queue_manager| but
530 // the TaskQueueSelectorTests constructs TaskQueueImpl directly with a null 528 // the TaskQueueSelectorTests constructs TaskQueueImpl directly with a null
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 state->SetBoolean("is_cancelled", task.task.IsCancelled()); 694 state->SetBoolean("is_cancelled", task.task.IsCancelled());
697 state->SetDouble( 695 state->SetDouble(
698 "delayed_run_time", 696 "delayed_run_time",
699 (task.delayed_run_time - base::TimeTicks()).InMicroseconds() / 1000.0L); 697 (task.delayed_run_time - base::TimeTicks()).InMicroseconds() / 1000.0L);
700 state->EndDictionary(); 698 state->EndDictionary();
701 } 699 }
702 700
703 } // namespace internal 701 } // namespace internal
704 } // namespace scheduler 702 } // namespace scheduler
705 } // namespace blink 703 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698