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

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

Issue 1100763002: Inject CanAddURLToHistory into TopSitesImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prefs
Patch Set: Fix error introduced during rebase Created 5 years, 7 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/scheduler_helper.h" 5 #include "components/scheduler/child/scheduler_helper.h"
6 6
7 #include "base/trace_event/trace_event.h" 7 #include "base/trace_event/trace_event.h"
8 #include "base/trace_event/trace_event_argument.h" 8 #include "base/trace_event/trace_event_argument.h"
9 #include "components/scheduler/child/nestable_single_thread_task_runner.h" 9 #include "components/scheduler/child/nestable_single_thread_task_runner.h"
10 #include "components/scheduler/child/prioritizing_task_queue_selector.h"
11 #include "components/scheduler/child/time_source.h" 10 #include "components/scheduler/child/time_source.h"
12 11
13 namespace scheduler { 12 namespace scheduler {
14 13
15 SchedulerHelper::SchedulerHelper( 14 SchedulerHelper::SchedulerHelper(
16 scoped_refptr<NestableSingleThreadTaskRunner> main_task_runner, 15 scoped_refptr<NestableSingleThreadTaskRunner> main_task_runner,
17 SchedulerHelperDelegate* scheduler_helper_delegate, 16 SchedulerHelperDelegate* scheduler_helper_delegate,
18 const char* tracing_category, 17 const char* tracing_category,
19 const char* disabled_by_default_tracing_category, 18 const char* disabled_by_default_tracing_category,
20 const char* idle_period_tracing_name, 19 const char* idle_period_tracing_name,
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 328
330 base::TimeTicks SchedulerHelper::Now() const { 329 base::TimeTicks SchedulerHelper::Now() const {
331 return time_source_->Now(); 330 return time_source_->Now();
332 } 331 }
333 332
334 SchedulerHelper::IdlePeriodState SchedulerHelper::SchedulerIdlePeriodState() 333 SchedulerHelper::IdlePeriodState SchedulerHelper::SchedulerIdlePeriodState()
335 const { 334 const {
336 return idle_period_state_; 335 return idle_period_state_;
337 } 336 }
338 337
339 PrioritizingTaskQueueSelector* SchedulerHelper::SchedulerTaskQueueSelector()
340 const {
341 return task_queue_selector_.get();
342 }
343
344 scoped_refptr<base::SingleThreadTaskRunner> SchedulerHelper::TaskRunnerForQueue( 338 scoped_refptr<base::SingleThreadTaskRunner> SchedulerHelper::TaskRunnerForQueue(
345 size_t queue_index) const { 339 size_t queue_index) const {
346 CheckOnValidThread(); 340 CheckOnValidThread();
347 return task_queue_manager_->TaskRunnerForQueue(queue_index); 341 return task_queue_manager_->TaskRunnerForQueue(queue_index);
348 } 342 }
349 343
350 void SchedulerHelper::SetQueueName(size_t queue_index, const char* name) { 344 void SchedulerHelper::SetQueueName(size_t queue_index, const char* name) {
351 CheckOnValidThread(); 345 CheckOnValidThread();
352 task_queue_manager_->SetQueueName(queue_index, name); 346 task_queue_manager_->SetQueueName(queue_index, name);
353 } 347 }
354 348
355 bool SchedulerHelper::IsQueueEmpty(size_t queue_index) const { 349 bool SchedulerHelper::IsQueueEmpty(size_t queue_index) const {
356 CheckOnValidThread(); 350 CheckOnValidThread();
357 return task_queue_manager_->IsQueueEmpty(queue_index); 351 return task_queue_manager_->IsQueueEmpty(queue_index);
358 } 352 }
359 353
354 void SchedulerHelper::SetQueuePriority(
355 size_t queue_index,
356 PrioritizingTaskQueueSelector::QueuePriority priority) {
357 CheckOnValidThread();
358 return task_queue_selector_->SetQueuePriority(queue_index, priority);
359 }
360
361 void SchedulerHelper::EnableQueue(
362 size_t queue_index,
363 PrioritizingTaskQueueSelector::QueuePriority priority) {
364 CheckOnValidThread();
365 task_queue_selector_->EnableQueue(queue_index, priority);
366 }
367
368 void SchedulerHelper::DisableQueue(size_t queue_index) {
369 CheckOnValidThread();
370 task_queue_selector_->DisableQueue(queue_index);
371 }
372
373 bool SchedulerHelper::IsQueueEnabled(size_t queue_index) const {
374 CheckOnValidThread();
375 return task_queue_selector_->IsQueueEnabled(queue_index);
376 }
377
360 // static 378 // static
361 const char* SchedulerHelper::TaskQueueIdToString(QueueId queue_id) { 379 const char* SchedulerHelper::TaskQueueIdToString(QueueId queue_id) {
362 switch (queue_id) { 380 switch (queue_id) {
363 case DEFAULT_TASK_QUEUE: 381 case DEFAULT_TASK_QUEUE:
364 return "default_tq"; 382 return "default_tq";
365 case IDLE_TASK_QUEUE: 383 case IDLE_TASK_QUEUE:
366 return "idle_tq"; 384 return "idle_tq";
367 case CONTROL_TASK_QUEUE: 385 case CONTROL_TASK_QUEUE:
368 return "control_tq"; 386 return "control_tq";
369 case CONTROL_TASK_AFTER_WAKEUP_QUEUE: 387 case CONTROL_TASK_AFTER_WAKEUP_QUEUE:
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 } 420 }
403 421
404 void SchedulerHelper::RemoveTaskObserver( 422 void SchedulerHelper::RemoveTaskObserver(
405 base::MessageLoop::TaskObserver* task_observer) { 423 base::MessageLoop::TaskObserver* task_observer) {
406 CheckOnValidThread(); 424 CheckOnValidThread();
407 if (task_queue_manager_) 425 if (task_queue_manager_)
408 task_queue_manager_->RemoveTaskObserver(task_observer); 426 task_queue_manager_->RemoveTaskObserver(task_observer);
409 } 427 }
410 428
411 } // namespace scheduler 429 } // namespace scheduler
OLDNEW
« no previous file with comments | « components/scheduler/child/scheduler_helper.h ('k') | components/scheduler/renderer/renderer_scheduler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698