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 ResourceFormat preferred_tile_format); | 53 bool use_rgba_4444_texture_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 Shutdown() override; | 59 void Shutdown() override; |
60 void ScheduleTasks(TaskGraph* graph) override; | 60 void ScheduleTasks(TaskGraph* graph) override; |
61 void CheckForCompletedTasks() override; | 61 void CheckForCompletedTasks() override; |
62 ResourceFormat GetResourceFormat(bool must_support_alpha) const override; | 62 ResourceFormat GetResourceFormat(bool must_support_alpha) const override; |
63 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override; | 63 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override; |
(...skipping 21 matching lines...) Expand all Loading... |
85 uint64_t resource_content_id, | 85 uint64_t resource_content_id, |
86 uint64_t previous_content_id); | 86 uint64_t previous_content_id); |
87 | 87 |
88 protected: | 88 protected: |
89 OneCopyTileTaskWorkerPool(base::SequencedTaskRunner* task_runner, | 89 OneCopyTileTaskWorkerPool(base::SequencedTaskRunner* task_runner, |
90 TaskGraphRunner* task_graph_runner, | 90 TaskGraphRunner* task_graph_runner, |
91 ResourceProvider* resource_provider, | 91 ResourceProvider* resource_provider, |
92 int max_copy_texture_chromium_size, | 92 int max_copy_texture_chromium_size, |
93 bool use_partial_raster, | 93 bool use_partial_raster, |
94 int max_staging_buffer_usage_in_bytes, | 94 int max_staging_buffer_usage_in_bytes, |
95 ResourceFormat preferred_tile_format); | 95 bool use_rgba_4444_texture_format); |
96 | 96 |
97 private: | 97 private: |
98 struct StagingBuffer { | 98 struct StagingBuffer { |
99 StagingBuffer(const gfx::Size& size, ResourceFormat format); | 99 StagingBuffer(const gfx::Size& size, ResourceFormat format); |
100 ~StagingBuffer(); | 100 ~StagingBuffer(); |
101 | 101 |
102 void DestroyGLResources(gpu::gles2::GLES2Interface* gl); | 102 void DestroyGLResources(gpu::gles2::GLES2Interface* gl); |
103 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, | 103 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, |
104 ResourceFormat format, | 104 ResourceFormat format, |
105 bool is_free) const; | 105 bool is_free) const; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 142 |
143 mutable base::Lock lock_; | 143 mutable base::Lock lock_; |
144 // |lock_| must be acquired when accessing the following members. | 144 // |lock_| must be acquired when accessing the following members. |
145 using StagingBufferSet = std::set<const StagingBuffer*>; | 145 using StagingBufferSet = std::set<const StagingBuffer*>; |
146 StagingBufferSet buffers_; | 146 StagingBufferSet buffers_; |
147 using StagingBufferDeque = std::deque<scoped_ptr<StagingBuffer>>; | 147 using StagingBufferDeque = std::deque<scoped_ptr<StagingBuffer>>; |
148 StagingBufferDeque free_buffers_; | 148 StagingBufferDeque free_buffers_; |
149 StagingBufferDeque busy_buffers_; | 149 StagingBufferDeque busy_buffers_; |
150 int bytes_scheduled_since_last_flush_; | 150 int bytes_scheduled_since_last_flush_; |
151 const int max_staging_buffer_usage_in_bytes_; | 151 const int max_staging_buffer_usage_in_bytes_; |
152 ResourceFormat preferred_tile_format_; | 152 bool use_rgba_4444_texture_format_; |
153 int staging_buffer_usage_in_bytes_; | 153 int staging_buffer_usage_in_bytes_; |
154 int free_staging_buffer_usage_in_bytes_; | 154 int free_staging_buffer_usage_in_bytes_; |
155 const base::TimeDelta staging_buffer_expiration_delay_; | 155 const base::TimeDelta staging_buffer_expiration_delay_; |
156 bool reduce_memory_usage_pending_; | 156 bool reduce_memory_usage_pending_; |
157 base::Closure reduce_memory_usage_callback_; | 157 base::Closure reduce_memory_usage_callback_; |
158 | 158 |
159 base::WeakPtrFactory<OneCopyTileTaskWorkerPool> weak_ptr_factory_; | 159 base::WeakPtrFactory<OneCopyTileTaskWorkerPool> weak_ptr_factory_; |
160 | 160 |
161 DISALLOW_COPY_AND_ASSIGN(OneCopyTileTaskWorkerPool); | 161 DISALLOW_COPY_AND_ASSIGN(OneCopyTileTaskWorkerPool); |
162 }; | 162 }; |
163 | 163 |
164 } // namespace cc | 164 } // namespace cc |
165 | 165 |
166 #endif // CC_RASTER_ONE_COPY_TILE_TASK_WORKER_POOL_H_ | 166 #endif // CC_RASTER_ONE_COPY_TILE_TASK_WORKER_POOL_H_ |
OLD | NEW |