OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CC_RASTER_ONE_COPY_TILE_TASK_WORKER_POOL_H_ | 5 #ifndef CC_RASTER_ONE_COPY_TILE_TASK_WORKER_POOL_H_ |
6 #define CC_RASTER_ONE_COPY_TILE_TASK_WORKER_POOL_H_ | 6 #define CC_RASTER_ONE_COPY_TILE_TASK_WORKER_POOL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "cc/output/context_provider.h" | 11 #include "cc/output/context_provider.h" |
12 #include "cc/raster/tile_task_runner.h" | 12 #include "cc/raster/tile_task_runner.h" |
13 #include "cc/raster/tile_task_worker_pool.h" | 13 #include "cc/raster/tile_task_worker_pool.h" |
14 #include "cc/resources/resource_provider.h" | 14 #include "cc/resources/resource_provider.h" |
15 | 15 |
16 namespace cc { | 16 namespace cc { |
17 struct StagingBuffer; | 17 struct StagingBuffer; |
18 class StagingBufferPool; | 18 class StagingBufferPool; |
19 class ResourcePool; | 19 class ResourcePool; |
20 | 20 |
21 class CC_EXPORT OneCopyTileTaskWorkerPool : public TileTaskWorkerPool, | 21 class CC_EXPORT OneCopyTileTaskWorkerPool : public TileTaskWorkerPool, |
22 public TileTaskRunner, | 22 public TileTaskRunner, |
23 public TileTaskClient { | 23 public TileTaskClient { |
24 public: | 24 public: |
25 ~OneCopyTileTaskWorkerPool() override; | 25 ~OneCopyTileTaskWorkerPool() override; |
26 | 26 |
27 static scoped_ptr<TileTaskWorkerPool> Create( | 27 static std::unique_ptr<TileTaskWorkerPool> Create( |
28 base::SequencedTaskRunner* task_runner, | 28 base::SequencedTaskRunner* task_runner, |
29 TaskGraphRunner* task_graph_runner, | 29 TaskGraphRunner* task_graph_runner, |
30 ContextProvider* context_provider, | 30 ContextProvider* context_provider, |
31 ResourceProvider* resource_provider, | 31 ResourceProvider* resource_provider, |
32 int max_copy_texture_chromium_size, | 32 int max_copy_texture_chromium_size, |
33 bool use_partial_raster, | 33 bool use_partial_raster, |
34 int max_staging_buffer_usage_in_bytes, | 34 int max_staging_buffer_usage_in_bytes, |
35 ResourceFormat preferred_tile_format); | 35 ResourceFormat preferred_tile_format); |
36 | 36 |
37 // Overridden from TileTaskWorkerPool: | 37 // Overridden from TileTaskWorkerPool: |
38 TileTaskRunner* AsTileTaskRunner() override; | 38 TileTaskRunner* AsTileTaskRunner() override; |
39 | 39 |
40 // Overridden from TileTaskRunner: | 40 // Overridden from TileTaskRunner: |
41 void Shutdown() override; | 41 void Shutdown() override; |
42 void ScheduleTasks(TaskGraph* graph) override; | 42 void ScheduleTasks(TaskGraph* graph) override; |
43 void CheckForCompletedTasks() override; | 43 void CheckForCompletedTasks() override; |
44 ResourceFormat GetResourceFormat(bool must_support_alpha) const override; | 44 ResourceFormat GetResourceFormat(bool must_support_alpha) const override; |
45 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override; | 45 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override; |
46 | 46 |
47 // Overridden from TileTaskClient: | 47 // Overridden from TileTaskClient: |
48 scoped_ptr<RasterBuffer> AcquireBufferForRaster( | 48 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( |
49 const Resource* resource, | 49 const Resource* resource, |
50 uint64_t resource_content_id, | 50 uint64_t resource_content_id, |
51 uint64_t previous_content_id) override; | 51 uint64_t previous_content_id) override; |
52 void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override; | 52 void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override; |
53 | 53 |
54 // Playback raster source and copy result into |resource|. | 54 // Playback raster source and copy result into |resource|. |
55 void PlaybackAndCopyOnWorkerThread( | 55 void PlaybackAndCopyOnWorkerThread( |
56 const Resource* resource, | 56 const Resource* resource, |
57 ResourceProvider::ScopedWriteLockGL* resource_lock, | 57 ResourceProvider::ScopedWriteLockGL* resource_lock, |
58 const RasterSource* raster_source, | 58 const RasterSource* raster_source, |
59 const gfx::Rect& raster_full_rect, | 59 const gfx::Rect& raster_full_rect, |
60 const gfx::Rect& raster_dirty_rect, | 60 const gfx::Rect& raster_dirty_rect, |
61 float scale, | 61 float scale, |
62 const RasterSource::PlaybackSettings& playback_settings, | 62 const RasterSource::PlaybackSettings& playback_settings, |
(...skipping 30 matching lines...) Expand all Loading... |
93 TaskGraphRunner* task_graph_runner_; | 93 TaskGraphRunner* task_graph_runner_; |
94 const NamespaceToken namespace_token_; | 94 const NamespaceToken namespace_token_; |
95 ResourceProvider* const resource_provider_; | 95 ResourceProvider* const resource_provider_; |
96 const int max_bytes_per_copy_operation_; | 96 const int max_bytes_per_copy_operation_; |
97 bool use_partial_raster_; | 97 bool use_partial_raster_; |
98 | 98 |
99 // Context lock must be acquired when accessing this member. | 99 // Context lock must be acquired when accessing this member. |
100 int bytes_scheduled_since_last_flush_; | 100 int bytes_scheduled_since_last_flush_; |
101 | 101 |
102 ResourceFormat preferred_tile_format_; | 102 ResourceFormat preferred_tile_format_; |
103 scoped_ptr<StagingBufferPool> staging_pool_; | 103 std::unique_ptr<StagingBufferPool> staging_pool_; |
104 | 104 |
105 Task::Vector completed_tasks_; | 105 Task::Vector completed_tasks_; |
106 | 106 |
107 DISALLOW_COPY_AND_ASSIGN(OneCopyTileTaskWorkerPool); | 107 DISALLOW_COPY_AND_ASSIGN(OneCopyTileTaskWorkerPool); |
108 }; | 108 }; |
109 | 109 |
110 } // namespace cc | 110 } // namespace cc |
111 | 111 |
112 #endif // CC_RASTER_ONE_COPY_TILE_TASK_WORKER_POOL_H_ | 112 #endif // CC_RASTER_ONE_COPY_TILE_TASK_WORKER_POOL_H_ |
OLD | NEW |