OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "cc/resources/image_raster_worker_pool.h" | 5 #include "cc/resources/image_raster_worker_pool.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/debug/trace_event_argument.h" |
8 #include "cc/debug/traced_value.h" | 9 #include "cc/debug/traced_value.h" |
9 #include "cc/resources/resource.h" | 10 #include "cc/resources/resource.h" |
10 | 11 |
11 namespace cc { | 12 namespace cc { |
12 | 13 |
13 // static | 14 // static |
14 scoped_ptr<RasterWorkerPool> ImageRasterWorkerPool::Create( | 15 scoped_ptr<RasterWorkerPool> ImageRasterWorkerPool::Create( |
15 base::SequencedTaskRunner* task_runner, | 16 base::SequencedTaskRunner* task_runner, |
16 TaskGraphRunner* task_graph_runner, | 17 TaskGraphRunner* task_graph_runner, |
17 ResourceProvider* resource_provider) { | 18 ResourceProvider* resource_provider) { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 queue->items.size()); | 112 queue->items.size()); |
112 | 113 |
113 ScheduleTasksOnOriginThread(this, &graph_); | 114 ScheduleTasksOnOriginThread(this, &graph_); |
114 task_graph_runner_->ScheduleTasks(namespace_token_, &graph_); | 115 task_graph_runner_->ScheduleTasks(namespace_token_, &graph_); |
115 | 116 |
116 raster_finished_task_ = new_raster_finished_task; | 117 raster_finished_task_ = new_raster_finished_task; |
117 raster_required_for_activation_finished_task_ = | 118 raster_required_for_activation_finished_task_ = |
118 new_raster_required_for_activation_finished_task; | 119 new_raster_required_for_activation_finished_task; |
119 | 120 |
120 TRACE_EVENT_ASYNC_STEP_INTO1( | 121 TRACE_EVENT_ASYNC_STEP_INTO1( |
121 "cc", | 122 "cc", "ScheduledTasks", this, "rasterizing", "state", StateAsValue()); |
122 "ScheduledTasks", | |
123 this, | |
124 "rasterizing", | |
125 "state", | |
126 TracedValue::FromValue(StateAsValue().release())); | |
127 } | 123 } |
128 | 124 |
129 void ImageRasterWorkerPool::CheckForCompletedTasks() { | 125 void ImageRasterWorkerPool::CheckForCompletedTasks() { |
130 TRACE_EVENT0("cc", "ImageRasterWorkerPool::CheckForCompletedTasks"); | 126 TRACE_EVENT0("cc", "ImageRasterWorkerPool::CheckForCompletedTasks"); |
131 | 127 |
132 task_graph_runner_->CollectCompletedTasks(namespace_token_, | 128 task_graph_runner_->CollectCompletedTasks(namespace_token_, |
133 &completed_tasks_); | 129 &completed_tasks_); |
134 for (Task::Vector::const_iterator it = completed_tasks_.begin(); | 130 for (Task::Vector::const_iterator it = completed_tasks_.begin(); |
135 it != completed_tasks_.end(); | 131 it != completed_tasks_.end(); |
136 ++it) { | 132 ++it) { |
(...skipping 30 matching lines...) Expand all Loading... |
167 client_->DidFinishRunningTasks(); | 163 client_->DidFinishRunningTasks(); |
168 } | 164 } |
169 | 165 |
170 void ImageRasterWorkerPool::OnRasterRequiredForActivationFinished() { | 166 void ImageRasterWorkerPool::OnRasterRequiredForActivationFinished() { |
171 TRACE_EVENT0("cc", | 167 TRACE_EVENT0("cc", |
172 "ImageRasterWorkerPool::OnRasterRequiredForActivationFinished"); | 168 "ImageRasterWorkerPool::OnRasterRequiredForActivationFinished"); |
173 | 169 |
174 DCHECK(raster_tasks_required_for_activation_pending_); | 170 DCHECK(raster_tasks_required_for_activation_pending_); |
175 raster_tasks_required_for_activation_pending_ = false; | 171 raster_tasks_required_for_activation_pending_ = false; |
176 TRACE_EVENT_ASYNC_STEP_INTO1( | 172 TRACE_EVENT_ASYNC_STEP_INTO1( |
177 "cc", | 173 "cc", "ScheduledTasks", this, "rasterizing", "state", StateAsValue()); |
178 "ScheduledTasks", | |
179 this, | |
180 "rasterizing", | |
181 "state", | |
182 TracedValue::FromValue(StateAsValue().release())); | |
183 client_->DidFinishRunningTasksRequiredForActivation(); | 174 client_->DidFinishRunningTasksRequiredForActivation(); |
184 } | 175 } |
185 | 176 |
186 scoped_ptr<base::Value> ImageRasterWorkerPool::StateAsValue() const { | 177 scoped_refptr<base::debug::ConvertableToTraceFormat> |
187 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue); | 178 ImageRasterWorkerPool::StateAsValue() const { |
| 179 scoped_refptr<base::debug::TracedValue> state = |
| 180 new base::debug::TracedValue(); |
188 | 181 |
189 state->SetBoolean("tasks_required_for_activation_pending", | 182 state->SetBoolean("tasks_required_for_activation_pending", |
190 raster_tasks_required_for_activation_pending_); | 183 raster_tasks_required_for_activation_pending_); |
191 return state.PassAs<base::Value>(); | 184 return state; |
192 } | 185 } |
193 | 186 |
194 } // namespace cc | 187 } // namespace cc |
OLD | NEW |