| 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> |
| 11 #include <limits> | 11 #include <limits> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/cancelable_callback.h" | 14 #include "base/cancelable_callback.h" |
| 15 #include "base/location.h" | 15 #include "base/location.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
| 18 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
| 19 #include "base/thread_task_runner_handle.h" | 19 #include "base/thread_task_runner_handle.h" |
| 20 #include "cc/base/unique_notifier.h" | 20 #include "cc/base/unique_notifier.h" |
| 21 #include "cc/raster/bitmap_tile_task_worker_pool.h" | 21 #include "cc/raster/bitmap_tile_task_worker_pool.h" |
| 22 #include "cc/raster/gpu_rasterizer.h" | 22 #include "cc/raster/gpu_rasterizer.h" |
| 23 #include "cc/raster/gpu_tile_task_worker_pool.h" | 23 #include "cc/raster/gpu_tile_task_worker_pool.h" |
| 24 #include "cc/raster/one_copy_tile_task_worker_pool.h" | 24 #include "cc/raster/one_copy_tile_task_worker_pool.h" |
| 25 #include "cc/raster/raster_buffer.h" | |
| 26 #include "cc/raster/synchronous_task_graph_runner.h" | 25 #include "cc/raster/synchronous_task_graph_runner.h" |
| 27 #include "cc/raster/tile_task_runner.h" | 26 #include "cc/raster/tile_task_runner.h" |
| 28 #include "cc/raster/zero_copy_tile_task_worker_pool.h" | 27 #include "cc/raster/zero_copy_tile_task_worker_pool.h" |
| 29 #include "cc/resources/resource_pool.h" | 28 #include "cc/resources/resource_pool.h" |
| 30 #include "cc/resources/resource_provider.h" | 29 #include "cc/resources/resource_provider.h" |
| 31 #include "cc/resources/scoped_resource.h" | 30 #include "cc/resources/scoped_resource.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" |
| 34 #include "cc/test/fake_raster_source.h" | 33 #include "cc/test/fake_raster_source.h" |
| 35 #include "cc/test/fake_resource_provider.h" | 34 #include "cc/test/fake_resource_provider.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 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, | 70 gfx::Rect(1, 1), new_content_id, 1.f, |
| 72 RasterSource::PlaybackSettings()); | 71 RasterSource::PlaybackSettings()); |
| 73 } | 72 } |
| 74 | 73 |
| 75 // Overridden from TileTask: | 74 // Overridden from TileTask: |
| 76 void ScheduleOnOriginThread(TileTaskClient* client) override { | 75 void ScheduleOnOriginThread(RasterBufferProvider* provider) override { |
| 77 // The raster buffer has no tile ids associated with it for partial update, | 76 // The raster buffer has no tile ids associated with it for partial update, |
| 78 // so doesn't need to provide a valid dirty rect. | 77 // so doesn't need to provide a valid dirty rect. |
| 79 raster_buffer_ = client->AcquireBufferForRaster(resource_, 0, 0); | 78 raster_buffer_ = provider->AcquireBufferForRaster(resource_, 0, 0); |
| 80 } | 79 } |
| 81 void CompleteOnOriginThread(TileTaskClient* client) override { | 80 void CompleteOnOriginThread(RasterBufferProvider* provider) override { |
| 82 client->ReleaseBufferForRaster(std::move(raster_buffer_)); | 81 provider->ReleaseBufferForRaster(std::move(raster_buffer_)); |
| 83 reply_.Run(!HasFinishedRunning()); | 82 reply_.Run(!HasFinishedRunning()); |
| 84 } | 83 } |
| 85 | 84 |
| 86 protected: | 85 protected: |
| 87 ~TestRasterTaskImpl() override {} | 86 ~TestRasterTaskImpl() override {} |
| 88 | 87 |
| 89 private: | 88 private: |
| 90 const Resource* resource_; | 89 const Resource* resource_; |
| 91 const Reply reply_; | 90 const Reply reply_; |
| 92 std::unique_ptr<RasterBuffer> raster_buffer_; | 91 std::unique_ptr<RasterBuffer> raster_buffer_; |
| (...skipping 277 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 |