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