| 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/tile_task_worker_pool.h" | 5 #include "cc/resources/tile_task_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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 break; | 140 break; |
| 141 case TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY: | 141 case TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY: |
| 142 Create3dOutputSurfaceAndResourceProvider(); | 142 Create3dOutputSurfaceAndResourceProvider(); |
| 143 tile_task_worker_pool_ = ZeroCopyTileTaskWorkerPool::Create( | 143 tile_task_worker_pool_ = ZeroCopyTileTaskWorkerPool::Create( |
| 144 base::MessageLoopProxy::current().get(), | 144 base::MessageLoopProxy::current().get(), |
| 145 TileTaskWorkerPool::GetTaskGraphRunner(), resource_provider_.get()); | 145 TileTaskWorkerPool::GetTaskGraphRunner(), resource_provider_.get()); |
| 146 break; | 146 break; |
| 147 case TILE_TASK_WORKER_POOL_TYPE_ONE_COPY: | 147 case TILE_TASK_WORKER_POOL_TYPE_ONE_COPY: |
| 148 Create3dOutputSurfaceAndResourceProvider(); | 148 Create3dOutputSurfaceAndResourceProvider(); |
| 149 staging_resource_pool_ = ResourcePool::Create(resource_provider_.get(), | 149 staging_resource_pool_ = ResourcePool::Create(resource_provider_.get(), |
| 150 GL_TEXTURE_2D, RGBA_8888); | 150 resource_provider_.get(), |
| 151 GL_TEXTURE_2D, false); |
| 151 tile_task_worker_pool_ = OneCopyTileTaskWorkerPool::Create( | 152 tile_task_worker_pool_ = OneCopyTileTaskWorkerPool::Create( |
| 152 base::MessageLoopProxy::current().get(), | 153 base::MessageLoopProxy::current().get(), |
| 153 TileTaskWorkerPool::GetTaskGraphRunner(), context_provider_.get(), | 154 TileTaskWorkerPool::GetTaskGraphRunner(), context_provider_.get(), |
| 154 resource_provider_.get(), staging_resource_pool_.get()); | 155 resource_provider_.get(), staging_resource_pool_.get()); |
| 155 break; | 156 break; |
| 156 case TILE_TASK_WORKER_POOL_TYPE_GPU: | 157 case TILE_TASK_WORKER_POOL_TYPE_GPU: |
| 157 Create3dOutputSurfaceAndResourceProvider(); | 158 Create3dOutputSurfaceAndResourceProvider(); |
| 158 tile_task_worker_pool_ = GpuTileTaskWorkerPool::Create( | 159 tile_task_worker_pool_ = GpuTileTaskWorkerPool::Create( |
| 159 base::MessageLoopProxy::current().get(), context_provider_.get(), | 160 base::MessageLoopProxy::current().get(), context_provider_.get(), |
| 160 resource_provider_.get(), false); | 161 resource_provider_.get(), false); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 | 255 |
| 255 private: | 256 private: |
| 256 void Create3dOutputSurfaceAndResourceProvider() { | 257 void Create3dOutputSurfaceAndResourceProvider() { |
| 257 output_surface_ = FakeOutputSurface::Create3d(context_provider_).Pass(); | 258 output_surface_ = FakeOutputSurface::Create3d(context_provider_).Pass(); |
| 258 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 259 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
| 259 TestWebGraphicsContext3D* context3d = context_provider_->TestContext3d(); | 260 TestWebGraphicsContext3D* context3d = context_provider_->TestContext3d(); |
| 260 context3d->set_support_sync_query(true); | 261 context3d->set_support_sync_query(true); |
| 261 resource_provider_ = ResourceProvider::Create(output_surface_.get(), NULL, | 262 resource_provider_ = ResourceProvider::Create(output_surface_.get(), NULL, |
| 262 &gpu_memory_buffer_manager_, | 263 &gpu_memory_buffer_manager_, |
| 263 NULL, 0, false, 1).Pass(); | 264 NULL, 0, false, 1).Pass(); |
| 265 false, |
| 264 } | 266 } |
| 265 | 267 |
| 266 void CreateSoftwareOutputSurfaceAndResourceProvider() { | 268 void CreateSoftwareOutputSurfaceAndResourceProvider() { |
| 267 output_surface_ = FakeOutputSurface::CreateSoftware( | 269 output_surface_ = FakeOutputSurface::CreateSoftware( |
| 268 make_scoped_ptr(new SoftwareOutputDevice)); | 270 make_scoped_ptr(new SoftwareOutputDevice)); |
| 269 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 271 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
| 270 resource_provider_ = | 272 resource_provider_ = |
| 271 ResourceProvider::Create(output_surface_.get(), &shared_bitmap_manager_, | 273 ResourceProvider::Create(output_surface_.get(), &shared_bitmap_manager_, |
| 272 NULL, NULL, 0, false, 1).Pass(); | 274 NULL, NULL, 0, false, 1).Pass(); |
| 275 false, |
| 273 } | 276 } |
| 274 | 277 |
| 275 void OnTaskCompleted(scoped_ptr<ScopedResource> resource, | 278 void OnTaskCompleted(scoped_ptr<ScopedResource> resource, |
| 276 unsigned id, | 279 unsigned id, |
| 277 const RasterSource::SolidColorAnalysis& analysis, | 280 const RasterSource::SolidColorAnalysis& analysis, |
| 278 bool was_canceled) { | 281 bool was_canceled) { |
| 279 RasterTaskResult result; | 282 RasterTaskResult result; |
| 280 result.id = id; | 283 result.id = id; |
| 281 result.canceled = was_canceled; | 284 result.canceled = was_canceled; |
| 282 completed_tasks_.push_back(result); | 285 completed_tasks_.push_back(result); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 TileTaskWorkerPoolTests, | 382 TileTaskWorkerPoolTests, |
| 380 TileTaskWorkerPoolTest, | 383 TileTaskWorkerPoolTest, |
| 381 ::testing::Values(TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER, | 384 ::testing::Values(TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER, |
| 382 TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, | 385 TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, |
| 383 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, | 386 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, |
| 384 TILE_TASK_WORKER_POOL_TYPE_GPU, | 387 TILE_TASK_WORKER_POOL_TYPE_GPU, |
| 385 TILE_TASK_WORKER_POOL_TYPE_BITMAP)); | 388 TILE_TASK_WORKER_POOL_TYPE_BITMAP)); |
| 386 | 389 |
| 387 } // namespace | 390 } // namespace |
| 388 } // namespace cc | 391 } // namespace cc |
| OLD | NEW |