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