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 <deque> | 8 #include <deque> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 ~OneCopyTileTaskWorkerPool() override; | 43 ~OneCopyTileTaskWorkerPool() override; |
44 | 44 |
45 static scoped_ptr<TileTaskWorkerPool> Create( | 45 static scoped_ptr<TileTaskWorkerPool> Create( |
46 base::SequencedTaskRunner* task_runner, | 46 base::SequencedTaskRunner* task_runner, |
47 TaskGraphRunner* task_graph_runner, | 47 TaskGraphRunner* task_graph_runner, |
48 ContextProvider* context_provider, | 48 ContextProvider* context_provider, |
49 ResourceProvider* resource_provider, | 49 ResourceProvider* resource_provider, |
50 int max_copy_texture_chromium_size, | 50 int max_copy_texture_chromium_size, |
51 bool use_partial_raster, | 51 bool use_partial_raster, |
52 int max_staging_buffer_usage_in_bytes, | 52 int max_staging_buffer_usage_in_bytes, |
53 bool use_rgba_4444_texture_format); | 53 ResourceFormat preferred_tile_format); |
54 | 54 |
55 // Overridden from TileTaskWorkerPool: | 55 // Overridden from TileTaskWorkerPool: |
56 TileTaskRunner* AsTileTaskRunner() override; | 56 TileTaskRunner* AsTileTaskRunner() override; |
57 | 57 |
58 // Overridden from TileTaskRunner: | 58 // Overridden from TileTaskRunner: |
59 void SetClient(TileTaskRunnerClient* client) override; | 59 void SetClient(TileTaskRunnerClient* client) override; |
60 void Shutdown() override; | 60 void Shutdown() override; |
61 void ScheduleTasks(TileTaskQueue* queue) override; | 61 void ScheduleTasks(TileTaskQueue* queue) override; |
62 void CheckForCompletedTasks() override; | 62 void CheckForCompletedTasks() override; |
63 ResourceFormat GetResourceFormat(bool must_support_alpha) const override; | 63 ResourceFormat GetResourceFormat(bool must_support_alpha) const override; |
(...skipping 22 matching lines...) Expand all Loading... |
86 uint64_t resource_content_id, | 86 uint64_t resource_content_id, |
87 uint64_t previous_content_id); | 87 uint64_t previous_content_id); |
88 | 88 |
89 protected: | 89 protected: |
90 OneCopyTileTaskWorkerPool(base::SequencedTaskRunner* task_runner, | 90 OneCopyTileTaskWorkerPool(base::SequencedTaskRunner* task_runner, |
91 TaskGraphRunner* task_graph_runner, | 91 TaskGraphRunner* task_graph_runner, |
92 ResourceProvider* resource_provider, | 92 ResourceProvider* resource_provider, |
93 int max_copy_texture_chromium_size, | 93 int max_copy_texture_chromium_size, |
94 bool use_partial_raster, | 94 bool use_partial_raster, |
95 int max_staging_buffer_usage_in_bytes, | 95 int max_staging_buffer_usage_in_bytes, |
96 bool use_rgba_4444_texture_format); | 96 ResourceFormat preferred_tile_format); |
97 | 97 |
98 private: | 98 private: |
99 struct StagingBuffer { | 99 struct StagingBuffer { |
100 StagingBuffer(const gfx::Size& size, ResourceFormat format); | 100 StagingBuffer(const gfx::Size& size, ResourceFormat format); |
101 ~StagingBuffer(); | 101 ~StagingBuffer(); |
102 | 102 |
103 void DestroyGLResources(gpu::gles2::GLES2Interface* gl); | 103 void DestroyGLResources(gpu::gles2::GLES2Interface* gl); |
104 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, | 104 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, |
105 ResourceFormat format, | 105 ResourceFormat format, |
106 bool is_free) const; | 106 bool is_free) const; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 mutable base::Lock lock_; | 151 mutable base::Lock lock_; |
152 // |lock_| must be acquired when accessing the following members. | 152 // |lock_| must be acquired when accessing the following members. |
153 using StagingBufferSet = std::set<const StagingBuffer*>; | 153 using StagingBufferSet = std::set<const StagingBuffer*>; |
154 StagingBufferSet buffers_; | 154 StagingBufferSet buffers_; |
155 using StagingBufferDeque = std::deque<scoped_ptr<StagingBuffer>>; | 155 using StagingBufferDeque = std::deque<scoped_ptr<StagingBuffer>>; |
156 StagingBufferDeque free_buffers_; | 156 StagingBufferDeque free_buffers_; |
157 StagingBufferDeque busy_buffers_; | 157 StagingBufferDeque busy_buffers_; |
158 int bytes_scheduled_since_last_flush_; | 158 int bytes_scheduled_since_last_flush_; |
159 const int max_staging_buffer_usage_in_bytes_; | 159 const int max_staging_buffer_usage_in_bytes_; |
160 bool use_rgba_4444_texture_format_; | 160 ResourceFormat preferred_tile_format_; |
161 int staging_buffer_usage_in_bytes_; | 161 int staging_buffer_usage_in_bytes_; |
162 int free_staging_buffer_usage_in_bytes_; | 162 int free_staging_buffer_usage_in_bytes_; |
163 const base::TimeDelta staging_buffer_expiration_delay_; | 163 const base::TimeDelta staging_buffer_expiration_delay_; |
164 bool reduce_memory_usage_pending_; | 164 bool reduce_memory_usage_pending_; |
165 base::Closure reduce_memory_usage_callback_; | 165 base::Closure reduce_memory_usage_callback_; |
166 | 166 |
167 base::WeakPtrFactory<OneCopyTileTaskWorkerPool> weak_ptr_factory_; | 167 base::WeakPtrFactory<OneCopyTileTaskWorkerPool> weak_ptr_factory_; |
168 // "raster finished" tasks need their own factory as they need to be | 168 // "raster finished" tasks need their own factory as they need to be |
169 // canceled when ScheduleTasks() is called. | 169 // canceled when ScheduleTasks() is called. |
170 base::WeakPtrFactory<OneCopyTileTaskWorkerPool> | 170 base::WeakPtrFactory<OneCopyTileTaskWorkerPool> |
171 task_set_finished_weak_ptr_factory_; | 171 task_set_finished_weak_ptr_factory_; |
172 | 172 |
173 DISALLOW_COPY_AND_ASSIGN(OneCopyTileTaskWorkerPool); | 173 DISALLOW_COPY_AND_ASSIGN(OneCopyTileTaskWorkerPool); |
174 }; | 174 }; |
175 | 175 |
176 } // namespace cc | 176 } // namespace cc |
177 | 177 |
178 #endif // CC_RASTER_ONE_COPY_TILE_TASK_WORKER_POOL_H_ | 178 #endif // CC_RASTER_ONE_COPY_TILE_TASK_WORKER_POOL_H_ |
OLD | NEW |