| 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" |
| 11 #include "cc/resources/direct_raster_worker_pool.h" | 11 #include "cc/resources/gpu_raster_worker_pool.h" |
| 12 #include "cc/resources/image_copy_raster_worker_pool.h" | 12 #include "cc/resources/image_copy_raster_worker_pool.h" |
| 13 #include "cc/resources/image_raster_worker_pool.h" | 13 #include "cc/resources/image_raster_worker_pool.h" |
| 14 #include "cc/resources/picture_pile.h" | 14 #include "cc/resources/picture_pile.h" |
| 15 #include "cc/resources/picture_pile_impl.h" | 15 #include "cc/resources/picture_pile_impl.h" |
| 16 #include "cc/resources/pixel_buffer_raster_worker_pool.h" | 16 #include "cc/resources/pixel_buffer_raster_worker_pool.h" |
| 17 #include "cc/resources/rasterizer.h" | 17 #include "cc/resources/rasterizer.h" |
| 18 #include "cc/resources/resource_pool.h" | 18 #include "cc/resources/resource_pool.h" |
| 19 #include "cc/resources/resource_provider.h" | 19 #include "cc/resources/resource_provider.h" |
| 20 #include "cc/resources/scoped_resource.h" | 20 #include "cc/resources/scoped_resource.h" |
| 21 #include "cc/test/fake_output_surface.h" | 21 #include "cc/test/fake_output_surface.h" |
| 22 #include "cc/test/fake_output_surface_client.h" | 22 #include "cc/test/fake_output_surface_client.h" |
| 23 #include "cc/test/test_shared_bitmap_manager.h" | 23 #include "cc/test/test_shared_bitmap_manager.h" |
| 24 #include "cc/test/test_web_graphics_context_3d.h" | 24 #include "cc/test/test_web_graphics_context_3d.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 26 |
| 27 namespace cc { | 27 namespace cc { |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 enum RasterWorkerPoolType { | 30 enum RasterWorkerPoolType { |
| 31 RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER, | 31 RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER, |
| 32 RASTER_WORKER_POOL_TYPE_IMAGE, | 32 RASTER_WORKER_POOL_TYPE_IMAGE, |
| 33 RASTER_WORKER_POOL_TYPE_IMAGE_COPY, | 33 RASTER_WORKER_POOL_TYPE_IMAGE_COPY, |
| 34 RASTER_WORKER_POOL_TYPE_DIRECT | 34 RASTER_WORKER_POOL_TYPE_GPU |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 class TestRasterTaskImpl : public RasterTask { | 37 class TestRasterTaskImpl : public RasterTask { |
| 38 public: | 38 public: |
| 39 typedef base::Callback< | 39 typedef base::Callback< |
| 40 void(const PicturePileImpl::Analysis& analysis, bool was_canceled)> Reply; | 40 void(const PicturePileImpl::Analysis& analysis, bool was_canceled)> Reply; |
| 41 | 41 |
| 42 TestRasterTaskImpl(const Resource* resource, | 42 TestRasterTaskImpl(const Resource* resource, |
| 43 const Reply& reply, | 43 const Reply& reply, |
| 44 ImageDecodeTask::Vector* dependencies) | 44 ImageDecodeTask::Vector* dependencies) |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 RasterWorkerPool::GetTaskGraphRunner(), | 133 RasterWorkerPool::GetTaskGraphRunner(), |
| 134 resource_provider_.get()); | 134 resource_provider_.get()); |
| 135 break; | 135 break; |
| 136 case RASTER_WORKER_POOL_TYPE_IMAGE_COPY: | 136 case RASTER_WORKER_POOL_TYPE_IMAGE_COPY: |
| 137 raster_worker_pool_ = ImageCopyRasterWorkerPool::Create( | 137 raster_worker_pool_ = ImageCopyRasterWorkerPool::Create( |
| 138 base::MessageLoopProxy::current().get(), | 138 base::MessageLoopProxy::current().get(), |
| 139 RasterWorkerPool::GetTaskGraphRunner(), | 139 RasterWorkerPool::GetTaskGraphRunner(), |
| 140 resource_provider_.get(), | 140 resource_provider_.get(), |
| 141 staging_resource_pool_.get()); | 141 staging_resource_pool_.get()); |
| 142 break; | 142 break; |
| 143 case RASTER_WORKER_POOL_TYPE_DIRECT: | 143 case RASTER_WORKER_POOL_TYPE_GPU: |
| 144 raster_worker_pool_ = DirectRasterWorkerPool::Create( | 144 raster_worker_pool_ = |
| 145 base::MessageLoopProxy::current().get(), | 145 GpuRasterWorkerPool::Create(base::MessageLoopProxy::current().get(), |
| 146 resource_provider_.get(), | 146 resource_provider_.get(), |
| 147 context_provider_.get()); | 147 context_provider_.get()); |
| 148 break; | 148 break; |
| 149 } | 149 } |
| 150 | 150 |
| 151 DCHECK(raster_worker_pool_); | 151 DCHECK(raster_worker_pool_); |
| 152 raster_worker_pool_->AsRasterizer()->SetClient(this); | 152 raster_worker_pool_->AsRasterizer()->SetClient(this); |
| 153 } | 153 } |
| 154 virtual ~RasterWorkerPoolTest() { | 154 virtual ~RasterWorkerPoolTest() { |
| 155 staging_resource_pool_.reset(); | 155 staging_resource_pool_.reset(); |
| 156 resource_provider_.reset(); | 156 resource_provider_.reset(); |
| 157 } | 157 } |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 lock.Release(); | 320 lock.Release(); |
| 321 | 321 |
| 322 RunMessageLoopUntilAllTasksHaveCompleted(); | 322 RunMessageLoopUntilAllTasksHaveCompleted(); |
| 323 } | 323 } |
| 324 | 324 |
| 325 INSTANTIATE_TEST_CASE_P(RasterWorkerPoolTests, | 325 INSTANTIATE_TEST_CASE_P(RasterWorkerPoolTests, |
| 326 RasterWorkerPoolTest, | 326 RasterWorkerPoolTest, |
| 327 ::testing::Values(RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER, | 327 ::testing::Values(RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER, |
| 328 RASTER_WORKER_POOL_TYPE_IMAGE, | 328 RASTER_WORKER_POOL_TYPE_IMAGE, |
| 329 RASTER_WORKER_POOL_TYPE_IMAGE_COPY, | 329 RASTER_WORKER_POOL_TYPE_IMAGE_COPY, |
| 330 RASTER_WORKER_POOL_TYPE_DIRECT)); | 330 RASTER_WORKER_POOL_TYPE_GPU)); |
| 331 | 331 |
| 332 } // namespace | 332 } // namespace |
| 333 } // namespace cc | 333 } // namespace cc |
| OLD | NEW |