[ServiceWorker] Implement WebServiceWorkerContextClient::openWindow().
[chromium-blink-merge.git] / content / renderer / scheduler / task_queue_selector.h
blobefe9bcf91819e731a2e1fbe3f5a794d7746a8808
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_SELECTOR_H_
6 #define CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_SELECTOR_H_
8 #include <vector>
10 #include "base/basictypes.h"
12 namespace base {
13 class TaskQueue;
14 namespace trace_event {
15 class TracedValue;
16 } // namespace trace_event
18 // TODO(ssid): remove these aliases after the tracing clients are moved to the
19 // new trace_event namespace. See crbug.com/451032. ETA: March 2015
20 namespace debug {
21 using ::base::trace_event::TracedValue;
22 } // namespace debug
23 } // namespace base
25 namespace content {
27 class TaskQueueSelector {
28 public:
29 virtual ~TaskQueueSelector() {}
31 // Called once to register the work queues to be selected from. This function
32 // is called on the main thread.
33 virtual void RegisterWorkQueues(
34 const std::vector<const base::TaskQueue*>& work_queues) = 0;
36 // Called to choose the work queue from which the next task should be taken
37 // and run. Return true if |out_queue| indicates the queue to service or
38 // false to avoid running any task.
40 // This function is called on the main thread.
41 virtual bool SelectWorkQueueToService(size_t* out_queue_index) = 0;
43 // Serialize the selector state for tracing.
44 virtual void AsValueInto(base::debug::TracedValue* state) const = 0;
47 } // namespace content
49 #endif // CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_SELECTOR_H_