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