| 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/raster/tile_task_worker_pool.h" | 5 #include "cc/raster/tile_task_worker_pool.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "cc/raster/gpu_rasterizer.h" | 21 #include "cc/raster/gpu_rasterizer.h" |
| 22 #include "cc/raster/gpu_tile_task_worker_pool.h" | 22 #include "cc/raster/gpu_tile_task_worker_pool.h" |
| 23 #include "cc/raster/one_copy_tile_task_worker_pool.h" | 23 #include "cc/raster/one_copy_tile_task_worker_pool.h" |
| 24 #include "cc/raster/raster_buffer.h" | 24 #include "cc/raster/raster_buffer.h" |
| 25 #include "cc/raster/synchronous_task_graph_runner.h" | 25 #include "cc/raster/synchronous_task_graph_runner.h" |
| 26 #include "cc/raster/tile_task_runner.h" | 26 #include "cc/raster/tile_task_runner.h" |
| 27 #include "cc/raster/zero_copy_tile_task_worker_pool.h" | 27 #include "cc/raster/zero_copy_tile_task_worker_pool.h" |
| 28 #include "cc/resources/resource_pool.h" | 28 #include "cc/resources/resource_pool.h" |
| 29 #include "cc/resources/resource_provider.h" | 29 #include "cc/resources/resource_provider.h" |
| 30 #include "cc/resources/scoped_resource.h" | 30 #include "cc/resources/scoped_resource.h" |
| 31 #include "cc/test/fake_display_list_raster_source.h" | |
| 32 #include "cc/test/fake_output_surface.h" | 31 #include "cc/test/fake_output_surface.h" |
| 33 #include "cc/test/fake_output_surface_client.h" | 32 #include "cc/test/fake_output_surface_client.h" |
| 33 #include "cc/test/fake_raster_source.h" |
| 34 #include "cc/test/fake_resource_provider.h" | 34 #include "cc/test/fake_resource_provider.h" |
| 35 #include "cc/test/test_gpu_memory_buffer_manager.h" | 35 #include "cc/test/test_gpu_memory_buffer_manager.h" |
| 36 #include "cc/test/test_shared_bitmap_manager.h" | 36 #include "cc/test/test_shared_bitmap_manager.h" |
| 37 #include "cc/test/test_web_graphics_context_3d.h" | 37 #include "cc/test/test_web_graphics_context_3d.h" |
| 38 #include "gpu/GLES2/gl2extchromium.h" | 38 #include "gpu/GLES2/gl2extchromium.h" |
| 39 #include "testing/gtest/include/gtest/gtest.h" | 39 #include "testing/gtest/include/gtest/gtest.h" |
| 40 | 40 |
| 41 namespace cc { | 41 namespace cc { |
| 42 namespace { | 42 namespace { |
| 43 | 43 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 54 class TestRasterTaskImpl : public RasterTask { | 54 class TestRasterTaskImpl : public RasterTask { |
| 55 public: | 55 public: |
| 56 typedef base::Callback<void(bool was_canceled)> Reply; | 56 typedef base::Callback<void(bool was_canceled)> Reply; |
| 57 | 57 |
| 58 TestRasterTaskImpl(const Resource* resource, | 58 TestRasterTaskImpl(const Resource* resource, |
| 59 const Reply& reply, | 59 const Reply& reply, |
| 60 ImageDecodeTask::Vector* dependencies) | 60 ImageDecodeTask::Vector* dependencies) |
| 61 : RasterTask(dependencies), | 61 : RasterTask(dependencies), |
| 62 resource_(resource), | 62 resource_(resource), |
| 63 reply_(reply), | 63 reply_(reply), |
| 64 raster_source_( | 64 raster_source_(FakeRasterSource::CreateFilled(gfx::Size(1, 1))) {} |
| 65 FakeDisplayListRasterSource::CreateFilled(gfx::Size(1, 1))) {} | |
| 66 | 65 |
| 67 // Overridden from Task: | 66 // Overridden from Task: |
| 68 void RunOnWorkerThread() override { | 67 void RunOnWorkerThread() override { |
| 69 uint64_t new_content_id = 0; | 68 uint64_t new_content_id = 0; |
| 70 raster_buffer_->Playback(raster_source_.get(), gfx::Rect(1, 1), | 69 raster_buffer_->Playback(raster_source_.get(), gfx::Rect(1, 1), |
| 71 gfx::Rect(1, 1), new_content_id, 1.f, true); | 70 gfx::Rect(1, 1), new_content_id, 1.f, true); |
| 72 } | 71 } |
| 73 | 72 |
| 74 // Overridden from TileTask: | 73 // Overridden from TileTask: |
| 75 void ScheduleOnOriginThread(TileTaskClient* client) override { | 74 void ScheduleOnOriginThread(TileTaskClient* client) override { |
| 76 // The raster buffer has no tile ids associated with it for partial update, | 75 // The raster buffer has no tile ids associated with it for partial update, |
| 77 // so doesn't need to provide a valid dirty rect. | 76 // so doesn't need to provide a valid dirty rect. |
| 78 raster_buffer_ = client->AcquireBufferForRaster(resource_, 0, 0); | 77 raster_buffer_ = client->AcquireBufferForRaster(resource_, 0, 0); |
| 79 } | 78 } |
| 80 void CompleteOnOriginThread(TileTaskClient* client) override { | 79 void CompleteOnOriginThread(TileTaskClient* client) override { |
| 81 client->ReleaseBufferForRaster(std::move(raster_buffer_)); | 80 client->ReleaseBufferForRaster(std::move(raster_buffer_)); |
| 82 reply_.Run(!HasFinishedRunning()); | 81 reply_.Run(!HasFinishedRunning()); |
| 83 } | 82 } |
| 84 | 83 |
| 85 protected: | 84 protected: |
| 86 ~TestRasterTaskImpl() override {} | 85 ~TestRasterTaskImpl() override {} |
| 87 | 86 |
| 88 private: | 87 private: |
| 89 const Resource* resource_; | 88 const Resource* resource_; |
| 90 const Reply reply_; | 89 const Reply reply_; |
| 91 scoped_ptr<RasterBuffer> raster_buffer_; | 90 scoped_ptr<RasterBuffer> raster_buffer_; |
| 92 scoped_refptr<DisplayListRasterSource> raster_source_; | 91 scoped_refptr<RasterSource> raster_source_; |
| 93 | 92 |
| 94 DISALLOW_COPY_AND_ASSIGN(TestRasterTaskImpl); | 93 DISALLOW_COPY_AND_ASSIGN(TestRasterTaskImpl); |
| 95 }; | 94 }; |
| 96 | 95 |
| 97 class BlockingTestRasterTaskImpl : public TestRasterTaskImpl { | 96 class BlockingTestRasterTaskImpl : public TestRasterTaskImpl { |
| 98 public: | 97 public: |
| 99 BlockingTestRasterTaskImpl(const Resource* resource, | 98 BlockingTestRasterTaskImpl(const Resource* resource, |
| 100 const Reply& reply, | 99 const Reply& reply, |
| 101 base::Lock* lock, | 100 base::Lock* lock, |
| 102 ImageDecodeTask::Vector* dependencies) | 101 ImageDecodeTask::Vector* dependencies) |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 | 369 |
| 371 INSTANTIATE_TEST_CASE_P(TileTaskWorkerPoolTests, | 370 INSTANTIATE_TEST_CASE_P(TileTaskWorkerPoolTests, |
| 372 TileTaskWorkerPoolTest, | 371 TileTaskWorkerPoolTest, |
| 373 ::testing::Values(TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, | 372 ::testing::Values(TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, |
| 374 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, | 373 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, |
| 375 TILE_TASK_WORKER_POOL_TYPE_GPU, | 374 TILE_TASK_WORKER_POOL_TYPE_GPU, |
| 376 TILE_TASK_WORKER_POOL_TYPE_BITMAP)); | 375 TILE_TASK_WORKER_POOL_TYPE_BITMAP)); |
| 377 | 376 |
| 378 } // namespace | 377 } // namespace |
| 379 } // namespace cc | 378 } // namespace cc |
| OLD | NEW |