| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/cancelable_callback.h" | 11 #include "base/cancelable_callback.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
| 14 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
| 15 #include "cc/base/unique_notifier.h" | 15 #include "cc/base/unique_notifier.h" |
| 16 #include "cc/raster/bitmap_tile_task_worker_pool.h" | 16 #include "cc/raster/bitmap_tile_task_worker_pool.h" |
| 17 #include "cc/raster/gpu_rasterizer.h" | 17 #include "cc/raster/gpu_rasterizer.h" |
| 18 #include "cc/raster/gpu_tile_task_worker_pool.h" | 18 #include "cc/raster/gpu_tile_task_worker_pool.h" |
| 19 #include "cc/raster/one_copy_tile_task_worker_pool.h" | 19 #include "cc/raster/one_copy_tile_task_worker_pool.h" |
| 20 #include "cc/raster/raster_buffer.h" | 20 #include "cc/raster/raster_buffer.h" |
| 21 #include "cc/raster/synchronous_task_graph_runner.h" | 21 #include "cc/raster/synchronous_task_graph_runner.h" |
| 22 #include "cc/raster/task_category.h" |
| 22 #include "cc/raster/tile_task_runner.h" | 23 #include "cc/raster/tile_task_runner.h" |
| 23 #include "cc/raster/zero_copy_tile_task_worker_pool.h" | 24 #include "cc/raster/zero_copy_tile_task_worker_pool.h" |
| 24 #include "cc/resources/resource_pool.h" | 25 #include "cc/resources/resource_pool.h" |
| 25 #include "cc/resources/resource_provider.h" | 26 #include "cc/resources/resource_provider.h" |
| 26 #include "cc/resources/scoped_resource.h" | 27 #include "cc/resources/scoped_resource.h" |
| 27 #include "cc/test/fake_display_list_raster_source.h" | 28 #include "cc/test/fake_display_list_raster_source.h" |
| 28 #include "cc/test/fake_output_surface.h" | 29 #include "cc/test/fake_output_surface.h" |
| 29 #include "cc/test/fake_output_surface_client.h" | 30 #include "cc/test/fake_output_surface_client.h" |
| 30 #include "cc/test/fake_resource_provider.h" | 31 #include "cc/test/fake_resource_provider.h" |
| 31 #include "cc/test/test_gpu_memory_buffer_manager.h" | 32 #include "cc/test/test_gpu_memory_buffer_manager.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 tile_task_worker_pool_->AsTileTaskRunner()->CheckForCompletedTasks(); | 188 tile_task_worker_pool_->AsTileTaskRunner()->CheckForCompletedTasks(); |
| 188 } | 189 } |
| 189 | 190 |
| 190 void ScheduleTasks() { | 191 void ScheduleTasks() { |
| 191 graph_.Reset(); | 192 graph_.Reset(); |
| 192 | 193 |
| 193 size_t priority = 0; | 194 size_t priority = 0; |
| 194 | 195 |
| 195 for (RasterTaskVector::const_iterator it = tasks_.begin(); | 196 for (RasterTaskVector::const_iterator it = tasks_.begin(); |
| 196 it != tasks_.end(); ++it) { | 197 it != tasks_.end(); ++it) { |
| 197 graph_.nodes.emplace_back(it->get(), priority++, 0 /* dependencies */); | 198 graph_.nodes.emplace_back(it->get(), TASK_CATEGORY_HIGH_PRIORITY, |
| 199 priority++, 0 /* dependencies */); |
| 198 } | 200 } |
| 199 | 201 |
| 200 tile_task_worker_pool_->AsTileTaskRunner()->ScheduleTasks(&graph_); | 202 tile_task_worker_pool_->AsTileTaskRunner()->ScheduleTasks(&graph_); |
| 201 } | 203 } |
| 202 | 204 |
| 203 void AppendTask(unsigned id, const gfx::Size& size) { | 205 void AppendTask(unsigned id, const gfx::Size& size) { |
| 204 scoped_ptr<ScopedResource> resource( | 206 scoped_ptr<ScopedResource> resource( |
| 205 ScopedResource::Create(resource_provider_.get())); | 207 ScopedResource::Create(resource_provider_.get())); |
| 206 resource->Allocate(size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 208 resource->Allocate(size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
| 207 RGBA_8888); | 209 RGBA_8888); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 | 370 |
| 369 INSTANTIATE_TEST_CASE_P(TileTaskWorkerPoolTests, | 371 INSTANTIATE_TEST_CASE_P(TileTaskWorkerPoolTests, |
| 370 TileTaskWorkerPoolTest, | 372 TileTaskWorkerPoolTest, |
| 371 ::testing::Values(TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, | 373 ::testing::Values(TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, |
| 372 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, | 374 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, |
| 373 TILE_TASK_WORKER_POOL_TYPE_GPU, | 375 TILE_TASK_WORKER_POOL_TYPE_GPU, |
| 374 TILE_TASK_WORKER_POOL_TYPE_BITMAP)); | 376 TILE_TASK_WORKER_POOL_TYPE_BITMAP)); |
| 375 | 377 |
| 376 } // namespace | 378 } // namespace |
| 377 } // namespace cc | 379 } // namespace cc |
| OLD | NEW |