| 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 <limits> | 7 #include <limits> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/cancelable_callback.h" | 10 #include "base/cancelable_callback.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 RasterWorkerPool::GetTaskGraphRunner(), | 157 RasterWorkerPool::GetTaskGraphRunner(), |
| 158 context_provider_.get(), | 158 context_provider_.get(), |
| 159 resource_provider_.get(), | 159 resource_provider_.get(), |
| 160 staging_resource_pool_.get()); | 160 staging_resource_pool_.get()); |
| 161 break; | 161 break; |
| 162 case RASTER_WORKER_POOL_TYPE_GPU: | 162 case RASTER_WORKER_POOL_TYPE_GPU: |
| 163 Create3dOutputSurfaceAndResourceProvider(); | 163 Create3dOutputSurfaceAndResourceProvider(); |
| 164 raster_worker_pool_ = | 164 raster_worker_pool_ = |
| 165 GpuRasterWorkerPool::Create(base::MessageLoopProxy::current().get(), | 165 GpuRasterWorkerPool::Create(base::MessageLoopProxy::current().get(), |
| 166 context_provider_.get(), | 166 context_provider_.get(), |
| 167 resource_provider_.get()); | 167 resource_provider_.get(), |
| 168 false); |
| 168 break; | 169 break; |
| 169 case RASTER_WORKER_POOL_TYPE_BITMAP: | 170 case RASTER_WORKER_POOL_TYPE_BITMAP: |
| 170 CreateSoftwareOutputSurfaceAndResourceProvider(); | 171 CreateSoftwareOutputSurfaceAndResourceProvider(); |
| 171 raster_worker_pool_ = BitmapRasterWorkerPool::Create( | 172 raster_worker_pool_ = BitmapRasterWorkerPool::Create( |
| 172 base::MessageLoopProxy::current().get(), | 173 base::MessageLoopProxy::current().get(), |
| 173 RasterWorkerPool::GetTaskGraphRunner(), | 174 RasterWorkerPool::GetTaskGraphRunner(), |
| 174 resource_provider_.get()); | 175 resource_provider_.get()); |
| 175 break; | 176 break; |
| 176 } | 177 } |
| 177 | 178 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 output_surface_ = FakeOutputSurface::Create3d(context_provider_).Pass(); | 273 output_surface_ = FakeOutputSurface::Create3d(context_provider_).Pass(); |
| 273 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 274 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
| 274 TestWebGraphicsContext3D* context3d = context_provider_->TestContext3d(); | 275 TestWebGraphicsContext3D* context3d = context_provider_->TestContext3d(); |
| 275 context3d->set_support_sync_query(true); | 276 context3d->set_support_sync_query(true); |
| 276 resource_provider_ = ResourceProvider::Create(output_surface_.get(), | 277 resource_provider_ = ResourceProvider::Create(output_surface_.get(), |
| 277 NULL, | 278 NULL, |
| 278 &gpu_memory_buffer_manager_, | 279 &gpu_memory_buffer_manager_, |
| 279 NULL, | 280 NULL, |
| 280 0, | 281 0, |
| 281 false, | 282 false, |
| 282 1, | 283 1).Pass(); |
| 283 false).Pass(); | |
| 284 } | 284 } |
| 285 | 285 |
| 286 void CreateSoftwareOutputSurfaceAndResourceProvider() { | 286 void CreateSoftwareOutputSurfaceAndResourceProvider() { |
| 287 output_surface_ = FakeOutputSurface::CreateSoftware( | 287 output_surface_ = FakeOutputSurface::CreateSoftware( |
| 288 make_scoped_ptr(new SoftwareOutputDevice)); | 288 make_scoped_ptr(new SoftwareOutputDevice)); |
| 289 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 289 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
| 290 resource_provider_ = ResourceProvider::Create(output_surface_.get(), | 290 resource_provider_ = ResourceProvider::Create(output_surface_.get(), |
| 291 &shared_bitmap_manager_, | 291 &shared_bitmap_manager_, |
| 292 NULL, | 292 NULL, |
| 293 NULL, | 293 NULL, |
| 294 0, | 294 0, |
| 295 false, | 295 false, |
| 296 1, | 296 1).Pass(); |
| 297 false).Pass(); | |
| 298 } | 297 } |
| 299 | 298 |
| 300 void OnTaskCompleted(scoped_ptr<ScopedResource> resource, | 299 void OnTaskCompleted(scoped_ptr<ScopedResource> resource, |
| 301 unsigned id, | 300 unsigned id, |
| 302 const PicturePileImpl::Analysis& analysis, | 301 const PicturePileImpl::Analysis& analysis, |
| 303 bool was_canceled) { | 302 bool was_canceled) { |
| 304 RasterTaskResult result; | 303 RasterTaskResult result; |
| 305 result.id = id; | 304 result.id = id; |
| 306 result.canceled = was_canceled; | 305 result.canceled = was_canceled; |
| 307 completed_tasks_.push_back(result); | 306 completed_tasks_.push_back(result); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 INSTANTIATE_TEST_CASE_P(RasterWorkerPoolTests, | 402 INSTANTIATE_TEST_CASE_P(RasterWorkerPoolTests, |
| 404 RasterWorkerPoolTest, | 403 RasterWorkerPoolTest, |
| 405 ::testing::Values(RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER, | 404 ::testing::Values(RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER, |
| 406 RASTER_WORKER_POOL_TYPE_ZERO_COPY, | 405 RASTER_WORKER_POOL_TYPE_ZERO_COPY, |
| 407 RASTER_WORKER_POOL_TYPE_ONE_COPY, | 406 RASTER_WORKER_POOL_TYPE_ONE_COPY, |
| 408 RASTER_WORKER_POOL_TYPE_GPU, | 407 RASTER_WORKER_POOL_TYPE_GPU, |
| 409 RASTER_WORKER_POOL_TYPE_BITMAP)); | 408 RASTER_WORKER_POOL_TYPE_BITMAP)); |
| 410 | 409 |
| 411 } // namespace | 410 } // namespace |
| 412 } // namespace cc | 411 } // namespace cc |
| OLD | NEW |