OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_ | 5 #ifndef CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_ |
6 #define CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_ | 6 #define CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_ |
7 | 7 |
8 #include "base/atomic_sequence_num.h" | 8 #include "base/atomic_sequence_num.h" |
9 #include "base/debug/task_annotator.h" | 9 #include "base/debug/task_annotator.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/pending_task.h" | 12 #include "base/pending_task.h" |
13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
15 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 namespace trace_event { | 19 namespace trace_event { |
20 class ConvertableToTraceFormat; | 20 class ConvertableToTraceFormat; |
21 class TracedValue; | 21 class TracedValue; |
22 } | 22 } |
23 | |
24 // TODO(ssid): remove these aliases after the tracing clients are moved to the | |
25 // new trace_event namespace. See crbug.com/451032. ETA: March 2015 | |
26 namespace debug { | |
27 using ::base::trace_event::ConvertableToTraceFormat; | |
28 using ::base::trace_event::TracedValue; | |
29 } | 23 } |
30 } // namespace base | |
31 | 24 |
32 namespace cc { | 25 namespace cc { |
33 class TestNowSource; | 26 class TestNowSource; |
34 } | 27 } |
35 | 28 |
36 namespace content { | 29 namespace content { |
37 namespace internal { | 30 namespace internal { |
38 class TaskQueue; | 31 class TaskQueue; |
39 } | 32 } |
40 class TaskQueueSelector; | 33 class TaskQueueSelector; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 bool PostDelayedTask(const tracked_objects::Location& from_here, | 127 bool PostDelayedTask(const tracked_objects::Location& from_here, |
135 const base::Closure& task, | 128 const base::Closure& task, |
136 base::TimeDelta delay); | 129 base::TimeDelta delay); |
137 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, | 130 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, |
138 const base::Closure& task, | 131 const base::Closure& task, |
139 base::TimeDelta delay); | 132 base::TimeDelta delay); |
140 internal::TaskQueue* Queue(size_t queue_index) const; | 133 internal::TaskQueue* Queue(size_t queue_index) const; |
141 | 134 |
142 base::TimeTicks Now() const; | 135 base::TimeTicks Now() const; |
143 | 136 |
144 scoped_refptr<base::debug::ConvertableToTraceFormat> | 137 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
145 AsValueWithSelectorResult(bool should_run, size_t selected_queue) const; | 138 AsValueWithSelectorResult(bool should_run, size_t selected_queue) const; |
146 | 139 |
147 std::vector<scoped_refptr<internal::TaskQueue>> queues_; | 140 std::vector<scoped_refptr<internal::TaskQueue>> queues_; |
148 base::AtomicSequenceNumber task_sequence_num_; | 141 base::AtomicSequenceNumber task_sequence_num_; |
149 base::debug::TaskAnnotator task_annotator_; | 142 base::debug::TaskAnnotator task_annotator_; |
150 | 143 |
151 base::ThreadChecker main_thread_checker_; | 144 base::ThreadChecker main_thread_checker_; |
152 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 145 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
153 TaskQueueSelector* selector_; | 146 TaskQueueSelector* selector_; |
154 | 147 |
155 base::WeakPtr<TaskQueueManager> task_queue_manager_weak_ptr_; | 148 base::WeakPtr<TaskQueueManager> task_queue_manager_weak_ptr_; |
156 | 149 |
157 // The pending_dowork_count_ is only tracked on the main thread since that's | 150 // The pending_dowork_count_ is only tracked on the main thread since that's |
158 // where re-entrant problems happen. | 151 // where re-entrant problems happen. |
159 int pending_dowork_count_; | 152 int pending_dowork_count_; |
160 | 153 |
161 int work_batch_size_; | 154 int work_batch_size_; |
162 | 155 |
163 scoped_refptr<cc::TestNowSource> time_source_; | 156 scoped_refptr<cc::TestNowSource> time_source_; |
164 | 157 |
165 base::WeakPtrFactory<TaskQueueManager> weak_factory_; | 158 base::WeakPtrFactory<TaskQueueManager> weak_factory_; |
166 | 159 |
167 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager); | 160 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager); |
168 }; | 161 }; |
169 | 162 |
170 } // namespace content | 163 } // namespace content |
171 | 164 |
172 #endif // CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_ | 165 #endif // CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_ |
OLD | NEW |