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

Side by Side Diff: components/scheduler/child/task_queue_impl.cc

Issue 1314903007: Implement WebFrameScheduler and WebPageScheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Responding to feedback Created 5 years, 3 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 "components/scheduler/child/task_queue_impl.h" 5 #include "components/scheduler/child/task_queue_impl.h"
6 6
7 #include "components/scheduler/child/task_queue_manager.h" 7 #include "components/scheduler/child/task_queue_manager.h"
8 8
9 namespace scheduler { 9 namespace scheduler {
10 namespace internal { 10 namespace internal {
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 329
330 void TaskQueueImpl::PumpQueue() { 330 void TaskQueueImpl::PumpQueue() {
331 base::AutoLock lock(lock_); 331 base::AutoLock lock(lock_);
332 PumpQueueLocked(); 332 PumpQueueLocked();
333 } 333 }
334 334
335 const char* TaskQueueImpl::GetName() const { 335 const char* TaskQueueImpl::GetName() const {
336 return name_; 336 return name_;
337 } 337 }
338 338
339 void TaskQueueImpl::SetOrigin(const std::string& origin) {
340 DCHECK(main_thread_checker_.CalledOnValidThread());
341 origin_ = origin;
342 }
343
344 const std::string& TaskQueueImpl::GetOrigin() {
345 DCHECK(main_thread_checker_.CalledOnValidThread());
346 return origin_;
347 }
348
339 bool TaskQueueImpl::GetWorkQueueFrontTaskEnqueueOrder( 349 bool TaskQueueImpl::GetWorkQueueFrontTaskEnqueueOrder(
340 int* enqueue_order) const { 350 int* enqueue_order) const {
341 if (work_queue_.empty()) 351 if (work_queue_.empty())
342 return false; 352 return false;
343 *enqueue_order = work_queue_.front().enqueue_order(); 353 *enqueue_order = work_queue_.front().enqueue_order();
344 return true; 354 return true;
345 } 355 }
346 356
347 void TaskQueueImpl::PushTaskOntoWorkQueueForTest(const Task& task) { 357 void TaskQueueImpl::PushTaskOntoWorkQueueForTest(const Task& task) {
348 work_queue_.push(task); 358 work_queue_.push(task);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 default: 416 default:
407 NOTREACHED(); 417 NOTREACHED();
408 return nullptr; 418 return nullptr;
409 } 419 }
410 } 420 }
411 421
412 void TaskQueueImpl::AsValueInto(base::trace_event::TracedValue* state) const { 422 void TaskQueueImpl::AsValueInto(base::trace_event::TracedValue* state) const {
413 base::AutoLock lock(lock_); 423 base::AutoLock lock(lock_);
414 state->BeginDictionary(); 424 state->BeginDictionary();
415 state->SetString("name", GetName()); 425 state->SetString("name", GetName());
426 state->SetString("origin", origin_);
416 state->SetString("pump_policy", PumpPolicyToString(pump_policy_)); 427 state->SetString("pump_policy", PumpPolicyToString(pump_policy_));
417 state->SetString("wakeup_policy", WakeupPolicyToString(wakeup_policy_)); 428 state->SetString("wakeup_policy", WakeupPolicyToString(wakeup_policy_));
418 bool verbose_tracing_enabled = false; 429 bool verbose_tracing_enabled = false;
419 TRACE_EVENT_CATEGORY_GROUP_ENABLED( 430 TRACE_EVENT_CATEGORY_GROUP_ENABLED(
420 disabled_by_default_verbose_tracing_category_, &verbose_tracing_enabled); 431 disabled_by_default_verbose_tracing_category_, &verbose_tracing_enabled);
421 state->SetInteger("incoming_queue_size", incoming_queue_.size()); 432 state->SetInteger("incoming_queue_size", incoming_queue_.size());
422 state->SetInteger("work_queue_size", work_queue_.size()); 433 state->SetInteger("work_queue_size", work_queue_.size());
423 state->SetInteger("delayed_task_queue_size", delayed_task_queue_.size()); 434 state->SetInteger("delayed_task_queue_size", delayed_task_queue_.size());
424 if (verbose_tracing_enabled) { 435 if (verbose_tracing_enabled) {
425 state->BeginArray("incoming_queue"); 436 state->BeginArray("incoming_queue");
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 state->SetBoolean("nestable", task.nestable); 506 state->SetBoolean("nestable", task.nestable);
496 state->SetBoolean("is_high_res", task.is_high_res); 507 state->SetBoolean("is_high_res", task.is_high_res);
497 state->SetDouble( 508 state->SetDouble(
498 "delayed_run_time", 509 "delayed_run_time",
499 (task.delayed_run_time - base::TimeTicks()).InMicroseconds() / 1000.0L); 510 (task.delayed_run_time - base::TimeTicks()).InMicroseconds() / 1000.0L);
500 state->EndDictionary(); 511 state->EndDictionary();
501 } 512 }
502 513
503 } // namespace internal 514 } // namespace internal
504 } // namespace scheduler 515 } // namespace scheduler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698