OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <map> | 11 #include <map> |
| 12 #include <memory> |
12 #include <vector> | 13 #include <vector> |
13 | 14 |
14 #include "base/atomic_sequence_num.h" | 15 #include "base/atomic_sequence_num.h" |
15 #include "base/callback.h" | 16 #include "base/callback.h" |
16 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
17 #include "base/containers/scoped_ptr_hash_map.h" | 18 #include "base/containers/scoped_ptr_hash_map.h" |
18 #include "base/macros.h" | 19 #include "base/macros.h" |
19 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
20 #include "base/memory/scoped_ptr.h" | |
21 #include "base/memory/weak_ptr.h" | 21 #include "base/memory/weak_ptr.h" |
22 #include "base/synchronization/lock.h" | 22 #include "base/synchronization/lock.h" |
23 #include "base/synchronization/waitable_event.h" | 23 #include "base/synchronization/waitable_event.h" |
24 #include "base/threading/thread.h" | 24 #include "base/threading/thread.h" |
25 #include "gpu/command_buffer/client/gpu_control.h" | 25 #include "gpu/command_buffer/client/gpu_control.h" |
26 #include "gpu/command_buffer/common/command_buffer.h" | 26 #include "gpu/command_buffer/common/command_buffer.h" |
27 #include "gpu/command_buffer/service/gpu_preferences.h" | 27 #include "gpu/command_buffer/service/gpu_preferences.h" |
28 #include "gpu/gpu_export.h" | 28 #include "gpu/gpu_export.h" |
29 #include "ui/gfx/gpu_memory_buffer.h" | 29 #include "ui/gfx/gpu_memory_buffer.h" |
30 #include "ui/gfx/native_widget_types.h" | 30 #include "ui/gfx/native_widget_types.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set(); | 167 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set(); |
168 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state(); | 168 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state(); |
169 gpu::gles2::ProgramCache* program_cache(); | 169 gpu::gles2::ProgramCache* program_cache(); |
170 | 170 |
171 private: | 171 private: |
172 const GpuPreferences gpu_preferences_; | 172 const GpuPreferences gpu_preferences_; |
173 scoped_refptr<gfx::GLShareGroup> share_group_; | 173 scoped_refptr<gfx::GLShareGroup> share_group_; |
174 scoped_refptr<gles2::MailboxManager> mailbox_manager_; | 174 scoped_refptr<gles2::MailboxManager> mailbox_manager_; |
175 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set_; | 175 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set_; |
176 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_; | 176 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_; |
177 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; | 177 std::unique_ptr<gpu::gles2::ProgramCache> program_cache_; |
178 }; | 178 }; |
179 | 179 |
180 #if defined(OS_ANDROID) | 180 #if defined(OS_ANDROID) |
181 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture(uint32_t stream_id); | 181 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture(uint32_t stream_id); |
182 uint32_t CreateStreamTexture(uint32_t texture_id); | 182 uint32_t CreateStreamTexture(uint32_t texture_id); |
183 #endif | 183 #endif |
184 | 184 |
185 private: | 185 private: |
186 struct InitializeOnGpuThreadParams { | 186 struct InitializeOnGpuThreadParams { |
187 bool is_offscreen; | 187 bool is_offscreen; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 bool GetBufferChanged(int32_t transfer_buffer_id); | 244 bool GetBufferChanged(int32_t transfer_buffer_id); |
245 void PumpCommands(); | 245 void PumpCommands(); |
246 void PerformDelayedWork(); | 246 void PerformDelayedWork(); |
247 | 247 |
248 const CommandBufferId command_buffer_id_; | 248 const CommandBufferId command_buffer_id_; |
249 | 249 |
250 // Members accessed on the gpu thread (possibly with the exception of | 250 // Members accessed on the gpu thread (possibly with the exception of |
251 // creation): | 251 // creation): |
252 bool context_lost_; | 252 bool context_lost_; |
253 scoped_refptr<TransferBufferManagerInterface> transfer_buffer_manager_; | 253 scoped_refptr<TransferBufferManagerInterface> transfer_buffer_manager_; |
254 scoped_ptr<CommandExecutor> executor_; | 254 std::unique_ptr<CommandExecutor> executor_; |
255 scoped_ptr<gles2::GLES2Decoder> decoder_; | 255 std::unique_ptr<gles2::GLES2Decoder> decoder_; |
256 scoped_refptr<gfx::GLContext> context_; | 256 scoped_refptr<gfx::GLContext> context_; |
257 scoped_refptr<gfx::GLSurface> surface_; | 257 scoped_refptr<gfx::GLSurface> surface_; |
258 scoped_refptr<SyncPointOrderData> sync_point_order_data_; | 258 scoped_refptr<SyncPointOrderData> sync_point_order_data_; |
259 scoped_ptr<SyncPointClient> sync_point_client_; | 259 std::unique_ptr<SyncPointClient> sync_point_client_; |
260 base::Closure context_lost_callback_; | 260 base::Closure context_lost_callback_; |
261 bool delayed_work_pending_; // Used to throttle PerformDelayedWork. | 261 bool delayed_work_pending_; // Used to throttle PerformDelayedWork. |
262 ImageFactory* image_factory_; | 262 ImageFactory* image_factory_; |
263 | 263 |
264 // Members accessed on the client thread: | 264 // Members accessed on the client thread: |
265 State last_state_; | 265 State last_state_; |
266 int32_t last_put_offset_; | 266 int32_t last_put_offset_; |
267 gpu::Capabilities capabilities_; | 267 gpu::Capabilities capabilities_; |
268 GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 268 GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
269 base::AtomicSequenceNumber next_image_id_; | 269 base::AtomicSequenceNumber next_image_id_; |
270 uint64_t next_fence_sync_release_; | 270 uint64_t next_fence_sync_release_; |
271 uint64_t flushed_fence_sync_release_; | 271 uint64_t flushed_fence_sync_release_; |
272 | 272 |
273 // Accessed on both threads: | 273 // Accessed on both threads: |
274 scoped_ptr<CommandBufferServiceBase> command_buffer_; | 274 std::unique_ptr<CommandBufferServiceBase> command_buffer_; |
275 base::Lock command_buffer_lock_; | 275 base::Lock command_buffer_lock_; |
276 base::WaitableEvent flush_event_; | 276 base::WaitableEvent flush_event_; |
277 scoped_refptr<Service> service_; | 277 scoped_refptr<Service> service_; |
278 State state_after_last_flush_; | 278 State state_after_last_flush_; |
279 base::Lock state_after_last_flush_lock_; | 279 base::Lock state_after_last_flush_lock_; |
280 scoped_refptr<gfx::GLShareGroup> gl_share_group_; | 280 scoped_refptr<gfx::GLShareGroup> gl_share_group_; |
281 base::WaitableEvent fence_sync_wait_event_; | 281 base::WaitableEvent fence_sync_wait_event_; |
282 | 282 |
283 #if defined(OS_ANDROID) | 283 #if defined(OS_ANDROID) |
284 scoped_ptr<StreamTextureManagerInProcess> stream_texture_manager_; | 284 std::unique_ptr<StreamTextureManagerInProcess> stream_texture_manager_; |
285 #endif | 285 #endif |
286 | 286 |
287 // Only used with explicit scheduling and the gpu thread is the same as | 287 // Only used with explicit scheduling and the gpu thread is the same as |
288 // the client thread. | 288 // the client thread. |
289 scoped_ptr<base::SequenceChecker> sequence_checker_; | 289 std::unique_ptr<base::SequenceChecker> sequence_checker_; |
290 | 290 |
291 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_; | 291 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_; |
292 base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_; | 292 base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_; |
293 | 293 |
294 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); | 294 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); |
295 }; | 295 }; |
296 | 296 |
297 // Default Service class when a null service is used. | 297 // Default Service class when a null service is used. |
298 class GPU_EXPORT GpuInProcessThread | 298 class GPU_EXPORT GpuInProcessThread |
299 : public base::Thread, | 299 : public base::Thread, |
(...skipping 20 matching lines...) Expand all Loading... |
320 SyncPointManager* sync_point_manager_; // Non-owning. | 320 SyncPointManager* sync_point_manager_; // Non-owning. |
321 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; | 321 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; |
322 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> | 322 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> |
323 framebuffer_completeness_cache_; | 323 framebuffer_completeness_cache_; |
324 DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread); | 324 DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread); |
325 }; | 325 }; |
326 | 326 |
327 } // namespace gpu | 327 } // namespace gpu |
328 | 328 |
329 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 329 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
OLD | NEW |