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/raster_worker_pool.h" | 5 #include "cc/resources/raster_worker_pool.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "cc/resources/image_raster_worker_pool.h" | 9 #include "cc/resources/image_raster_worker_pool.h" |
10 #include "cc/resources/picture_pile.h" | 10 #include "cc/resources/picture_pile.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 picture_pile->set_num_raster_threads(1); | 155 picture_pile->set_num_raster_threads(1); |
156 scoped_refptr<PicturePileImpl> picture_pile_impl( | 156 scoped_refptr<PicturePileImpl> picture_pile_impl( |
157 PicturePileImpl::CreateFromOther(picture_pile.get(), false)); | 157 PicturePileImpl::CreateFromOther(picture_pile.get(), false)); |
158 | 158 |
159 scoped_ptr<ScopedResource> resource( | 159 scoped_ptr<ScopedResource> resource( |
160 ScopedResource::create(resource_provider())); | 160 ScopedResource::create(resource_provider())); |
161 resource->Allocate(size, GL_RGBA, ResourceProvider::TextureUsageAny); | 161 resource->Allocate(size, GL_RGBA, ResourceProvider::TextureUsageAny); |
162 const Resource* const_resource = resource.get(); | 162 const Resource* const_resource = resource.get(); |
163 | 163 |
164 RasterWorkerPool::Task::Set empty; | 164 RasterWorkerPool::Task::Set empty; |
165 tasks_.push_back( | 165 tasks_.push_back(RasterWorkerPool::RasterTask( |
166 RasterWorkerPool::RasterTask( | 166 picture_pile_impl.get(), |
167 picture_pile_impl, | 167 const_resource, |
168 const_resource, | 168 base::Bind(&BasicRasterWorkerPoolTest::RunRasterTask, |
169 base::Bind(&BasicRasterWorkerPoolTest::RunRasterTask, | 169 base::Unretained(this)), |
170 base::Unretained(this)), | 170 base::Bind(&BasicRasterWorkerPoolTest::OnTaskCompleted, |
171 base::Bind(&BasicRasterWorkerPoolTest::OnTaskCompleted, | 171 base::Unretained(this), |
172 base::Unretained(this), | 172 base::Passed(&resource), |
173 base::Passed(&resource), | 173 id), |
174 id), | 174 &empty)); |
175 &empty)); | |
176 } | 175 } |
177 | 176 |
178 void ScheduleTasks() { | 177 void ScheduleTasks() { |
179 RasterWorkerPool::RasterTask::Queue tasks; | 178 RasterWorkerPool::RasterTask::Queue tasks; |
180 | 179 |
181 for (std::vector<RasterWorkerPool::RasterTask>::iterator it = | 180 for (std::vector<RasterWorkerPool::RasterTask>::iterator it = |
182 tasks_.begin(); | 181 tasks_.begin(); |
183 it != tasks_.end(); ++it) | 182 it != tasks_.end(); ++it) |
184 tasks.Append(*it); | 183 tasks.Append(*it); |
185 | 184 |
(...skipping 13 matching lines...) Expand all Loading... |
199 | 198 |
200 std::vector<RasterWorkerPool::RasterTask> tasks_; | 199 std::vector<RasterWorkerPool::RasterTask> tasks_; |
201 std::vector<unsigned> on_task_completed_ids_; | 200 std::vector<unsigned> on_task_completed_ids_; |
202 }; | 201 }; |
203 | 202 |
204 PIXEL_BUFFER_AND_IMAGE_TEST_F(BasicRasterWorkerPoolTest); | 203 PIXEL_BUFFER_AND_IMAGE_TEST_F(BasicRasterWorkerPoolTest); |
205 | 204 |
206 } // namespace | 205 } // namespace |
207 | 206 |
208 } // namespace cc | 207 } // namespace cc |
OLD | NEW |