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 <deque> | 10 #include <deque> |
(...skipping 22 matching lines...) Expand all Loading... |
33 class GLES2Interface; | 33 class GLES2Interface; |
34 } | 34 } |
35 } | 35 } |
36 | 36 |
37 namespace cc { | 37 namespace cc { |
38 class ResourcePool; | 38 class ResourcePool; |
39 | 39 |
40 class CC_EXPORT OneCopyTileTaskWorkerPool | 40 class CC_EXPORT OneCopyTileTaskWorkerPool |
41 : public TileTaskWorkerPool, | 41 : public TileTaskWorkerPool, |
42 public TileTaskRunner, | 42 public TileTaskRunner, |
43 public TileTaskClient, | 43 public DependencyTaskClient, |
44 public base::trace_event::MemoryDumpProvider { | 44 public base::trace_event::MemoryDumpProvider { |
45 public: | 45 public: |
46 ~OneCopyTileTaskWorkerPool() override; | 46 ~OneCopyTileTaskWorkerPool() override; |
47 | 47 |
48 static scoped_ptr<TileTaskWorkerPool> Create( | 48 static scoped_ptr<TileTaskWorkerPool> Create( |
49 base::SequencedTaskRunner* task_runner, | 49 base::SequencedTaskRunner* task_runner, |
50 TaskGraphRunner* task_graph_runner, | 50 TaskGraphRunner* task_graph_runner, |
51 ContextProvider* context_provider, | 51 ContextProvider* context_provider, |
52 ResourceProvider* resource_provider, | 52 ResourceProvider* resource_provider, |
53 int max_copy_texture_chromium_size, | 53 int max_copy_texture_chromium_size, |
54 bool use_partial_raster, | 54 bool use_partial_raster, |
55 int max_staging_buffer_usage_in_bytes, | 55 int max_staging_buffer_usage_in_bytes, |
56 ResourceFormat preferred_tile_format); | 56 ResourceFormat preferred_tile_format); |
57 | 57 |
58 // Overridden from TileTaskWorkerPool: | 58 // Overridden from TileTaskWorkerPool: |
59 TileTaskRunner* AsTileTaskRunner() override; | 59 TileTaskRunner* AsTileTaskRunner() override; |
60 | 60 |
61 // Overridden from TileTaskRunner: | 61 // Overridden from TileTaskRunner: |
62 void Shutdown() override; | 62 void Shutdown() override; |
63 void ScheduleTasks(TaskGraph* graph) override; | 63 void ScheduleTasks(TaskGraph* graph) override; |
64 void CheckForCompletedTasks() override; | 64 void CheckForCompletedTasks() override; |
65 ResourceFormat GetResourceFormat(bool must_support_alpha) const override; | 65 ResourceFormat GetResourceFormat(bool must_support_alpha) const override; |
66 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override; | 66 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override; |
67 | 67 |
68 // Overridden from TileTaskClient: | 68 // Overridden from DependencyTaskClient: |
69 scoped_ptr<RasterBuffer> AcquireBufferForRaster( | 69 scoped_ptr<RasterBuffer> AcquireBufferForRaster( |
70 const Resource* resource, | 70 const Resource* resource, |
71 uint64_t resource_content_id, | 71 uint64_t resource_content_id, |
72 uint64_t previous_content_id) override; | 72 uint64_t previous_content_id) override; |
73 void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override; | 73 void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override; |
74 | 74 |
75 // Overridden from base::trace_event::MemoryDumpProvider: | 75 // Overridden from base::trace_event::MemoryDumpProvider: |
76 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, | 76 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, |
77 base::trace_event::ProcessMemoryDump* pmd) override; | 77 base::trace_event::ProcessMemoryDump* pmd) override; |
78 | 78 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 void StagingStateAsValueInto( | 133 void StagingStateAsValueInto( |
134 base::trace_event::TracedValue* staging_state) const; | 134 base::trace_event::TracedValue* staging_state) const; |
135 | 135 |
136 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 136 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
137 TaskGraphRunner* task_graph_runner_; | 137 TaskGraphRunner* task_graph_runner_; |
138 const NamespaceToken namespace_token_; | 138 const NamespaceToken namespace_token_; |
139 ResourceProvider* const resource_provider_; | 139 ResourceProvider* const resource_provider_; |
140 const int max_bytes_per_copy_operation_; | 140 const int max_bytes_per_copy_operation_; |
141 const bool use_partial_raster_; | 141 const bool use_partial_raster_; |
142 | 142 |
143 Task::Vector completed_tasks_; | 143 DependencyTask::Vector completed_tasks_; |
144 | 144 |
145 mutable base::Lock lock_; | 145 mutable base::Lock lock_; |
146 // |lock_| must be acquired when accessing the following members. | 146 // |lock_| must be acquired when accessing the following members. |
147 using StagingBufferSet = std::set<const StagingBuffer*>; | 147 using StagingBufferSet = std::set<const StagingBuffer*>; |
148 StagingBufferSet buffers_; | 148 StagingBufferSet buffers_; |
149 using StagingBufferDeque = std::deque<scoped_ptr<StagingBuffer>>; | 149 using StagingBufferDeque = std::deque<scoped_ptr<StagingBuffer>>; |
150 StagingBufferDeque free_buffers_; | 150 StagingBufferDeque free_buffers_; |
151 StagingBufferDeque busy_buffers_; | 151 StagingBufferDeque busy_buffers_; |
152 int bytes_scheduled_since_last_flush_; | 152 int bytes_scheduled_since_last_flush_; |
153 const int max_staging_buffer_usage_in_bytes_; | 153 const int max_staging_buffer_usage_in_bytes_; |
154 ResourceFormat preferred_tile_format_; | 154 ResourceFormat preferred_tile_format_; |
155 int staging_buffer_usage_in_bytes_; | 155 int staging_buffer_usage_in_bytes_; |
156 int free_staging_buffer_usage_in_bytes_; | 156 int free_staging_buffer_usage_in_bytes_; |
157 const base::TimeDelta staging_buffer_expiration_delay_; | 157 const base::TimeDelta staging_buffer_expiration_delay_; |
158 bool reduce_memory_usage_pending_; | 158 bool reduce_memory_usage_pending_; |
159 base::Closure reduce_memory_usage_callback_; | 159 base::Closure reduce_memory_usage_callback_; |
160 | 160 |
161 base::WeakPtrFactory<OneCopyTileTaskWorkerPool> weak_ptr_factory_; | 161 base::WeakPtrFactory<OneCopyTileTaskWorkerPool> weak_ptr_factory_; |
162 | 162 |
163 DISALLOW_COPY_AND_ASSIGN(OneCopyTileTaskWorkerPool); | 163 DISALLOW_COPY_AND_ASSIGN(OneCopyTileTaskWorkerPool); |
164 }; | 164 }; |
165 | 165 |
166 } // namespace cc | 166 } // namespace cc |
167 | 167 |
168 #endif // CC_RASTER_ONE_COPY_TILE_TASK_WORKER_POOL_H_ | 168 #endif // CC_RASTER_ONE_COPY_TILE_TASK_WORKER_POOL_H_ |
OLD | NEW |