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

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

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 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
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/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/trace_event/blame_context.h" 10 #include "base/trace_event/blame_context.h"
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 286
287 TraceQueueSize(false); 287 TraceQueueSize(false);
288 } 288 }
289 289
290 void TaskQueueImpl::PushOntoDelayedIncomingQueueLocked(Task pending_task) { 290 void TaskQueueImpl::PushOntoDelayedIncomingQueueLocked(Task pending_task) {
291 any_thread().task_queue_manager->DidQueueTask(pending_task); 291 any_thread().task_queue_manager->DidQueueTask(pending_task);
292 292
293 int thread_hop_task_sequence_number = 293 int thread_hop_task_sequence_number =
294 any_thread().task_queue_manager->GetNextSequenceNumber(); 294 any_thread().task_queue_manager->GetNextSequenceNumber();
295 PushOntoImmediateIncomingQueueLocked( 295 PushOntoImmediateIncomingQueueLocked(
296 FROM_HERE, base::Bind(&TaskQueueImpl::ScheduleDelayedWorkTask, this, 296 FROM_HERE,
297 base::Passed(&pending_task)), 297 base::Bind(&TaskQueueImpl::ScheduleDelayedWorkTask, this,
298 base::Passed(&pending_task)),
298 base::TimeTicks(), thread_hop_task_sequence_number, false); 299 base::TimeTicks(), thread_hop_task_sequence_number, false);
299 } 300 }
300 301
301 void TaskQueueImpl::ScheduleDelayedWorkTask(Task pending_task) { 302 void TaskQueueImpl::ScheduleDelayedWorkTask(Task pending_task) {
302 DCHECK(main_thread_checker_.CalledOnValidThread()); 303 DCHECK(main_thread_checker_.CalledOnValidThread());
303 base::TimeTicks delayed_run_time = pending_task.delayed_run_time; 304 base::TimeTicks delayed_run_time = pending_task.delayed_run_time;
304 base::TimeTicks time_domain_now = main_thread_only().time_domain->Now(); 305 base::TimeTicks time_domain_now = main_thread_only().time_domain->Now();
305 if (delayed_run_time <= time_domain_now) { 306 if (delayed_run_time <= time_domain_now) {
306 // If |delayed_run_time| is in the past then push it onto the work queue 307 // If |delayed_run_time| is in the past then push it onto the work queue
307 // immediately. To ensure the right task ordering we need to temporarily 308 // immediately. To ensure the right task ordering we need to temporarily
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 TaskQueueImpl::QueuePriority TaskQueueImpl::GetQueuePriority() const { 479 TaskQueueImpl::QueuePriority TaskQueueImpl::GetQueuePriority() const {
479 size_t set_index = immediate_work_queue()->work_queue_set_index(); 480 size_t set_index = immediate_work_queue()->work_queue_set_index();
480 DCHECK_EQ(set_index, delayed_work_queue()->work_queue_set_index()); 481 DCHECK_EQ(set_index, delayed_work_queue()->work_queue_set_index());
481 return static_cast<TaskQueue::QueuePriority>(set_index); 482 return static_cast<TaskQueue::QueuePriority>(set_index);
482 } 483 }
483 484
484 void TaskQueueImpl::AsValueInto(base::trace_event::TracedValue* state) const { 485 void TaskQueueImpl::AsValueInto(base::trace_event::TracedValue* state) const {
485 base::AutoLock lock(any_thread_lock_); 486 base::AutoLock lock(any_thread_lock_);
486 state->BeginDictionary(); 487 state->BeginDictionary();
487 state->SetString("name", GetName()); 488 state->SetString("name", GetName());
488 state->SetString( 489 state->SetString("task_queue_id",
489 "task_queue_id", 490 base::StringPrintf("%" PRIx64,
490 base::StringPrintf("%" PRIx64, static_cast<uint64_t>( 491 static_cast<uint64_t>(
491 reinterpret_cast<uintptr_t>(this)))); 492 reinterpret_cast<uintptr_t>(this))));
492 state->SetBoolean("enabled", IsQueueEnabled()); 493 state->SetBoolean("enabled", IsQueueEnabled());
493 state->SetString("time_domain_name", 494 state->SetString("time_domain_name",
494 main_thread_only().time_domain->GetName()); 495 main_thread_only().time_domain->GetName());
495 bool verbose_tracing_enabled = false; 496 bool verbose_tracing_enabled = false;
496 TRACE_EVENT_CATEGORY_GROUP_ENABLED( 497 TRACE_EVENT_CATEGORY_GROUP_ENABLED(
497 disabled_by_default_verbose_tracing_category_, &verbose_tracing_enabled); 498 disabled_by_default_verbose_tracing_category_, &verbose_tracing_enabled);
498 state->SetInteger("immediate_incoming_queue_size", 499 state->SetInteger("immediate_incoming_queue_size",
499 any_thread().immediate_incoming_queue.size()); 500 any_thread().immediate_incoming_queue.size());
500 state->SetInteger("delayed_incoming_queue_size", 501 state->SetInteger("delayed_incoming_queue_size",
501 main_thread_only().delayed_incoming_queue.size()); 502 main_thread_only().delayed_incoming_queue.size());
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 854
854 void TaskQueueImpl::PushImmediateIncomingTaskForTest( 855 void TaskQueueImpl::PushImmediateIncomingTaskForTest(
855 TaskQueueImpl::Task&& task) { 856 TaskQueueImpl::Task&& task) {
856 base::AutoLock lock(any_thread_lock_); 857 base::AutoLock lock(any_thread_lock_);
857 any_thread().immediate_incoming_queue.push_back(std::move(task)); 858 any_thread().immediate_incoming_queue.push_back(std::move(task));
858 } 859 }
859 860
860 } // namespace internal 861 } // namespace internal
861 } // namespace scheduler 862 } // namespace scheduler
862 } // namespace blink 863 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698