| 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 <map> |
| 8 #include <vector> | 9 #include <vector> |
| 9 | 10 |
| 10 #include "base/callback.h" | 11 #include "base/callback.h" |
| 11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/linked_ptr.h" |
| 12 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 15 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
| 16 #include "base/synchronization/waitable_event.h" | 18 #include "base/synchronization/waitable_event.h" |
| 19 #include "gpu/command_buffer/client/gpu_control.h" |
| 17 #include "gpu/command_buffer/common/command_buffer.h" | 20 #include "gpu/command_buffer/common/command_buffer.h" |
| 18 #include "gpu/command_buffer/common/gpu_control.h" | |
| 19 #include "gpu/gpu_export.h" | 21 #include "gpu/gpu_export.h" |
| 20 #include "ui/gfx/gpu_memory_buffer.h" | 22 #include "ui/gfx/gpu_memory_buffer.h" |
| 21 #include "ui/gfx/native_widget_types.h" | 23 #include "ui/gfx/native_widget_types.h" |
| 22 #include "ui/gl/gl_surface.h" | 24 #include "ui/gl/gl_surface.h" |
| 23 #include "ui/gl/gpu_preference.h" | 25 #include "ui/gl/gpu_preference.h" |
| 24 | 26 |
| 25 namespace base { | 27 namespace base { |
| 26 class SequenceChecker; | 28 class SequenceChecker; |
| 27 } | 29 } |
| 28 | 30 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 43 #endif | 45 #endif |
| 44 | 46 |
| 45 namespace gpu { | 47 namespace gpu { |
| 46 | 48 |
| 47 namespace gles2 { | 49 namespace gles2 { |
| 48 class GLES2Decoder; | 50 class GLES2Decoder; |
| 49 class ShaderTranslatorCache; | 51 class ShaderTranslatorCache; |
| 50 } | 52 } |
| 51 | 53 |
| 52 class CommandBufferServiceBase; | 54 class CommandBufferServiceBase; |
| 55 class GpuControlService; |
| 53 class GpuMemoryBufferFactory; | 56 class GpuMemoryBufferFactory; |
| 54 class GpuScheduler; | 57 class GpuScheduler; |
| 55 class TransferBufferManagerInterface; | 58 class TransferBufferManagerInterface; |
| 56 | 59 |
| 57 // This class provides a thread-safe interface to the global GPU service (for | 60 // This class provides a thread-safe interface to the global GPU service (for |
| 58 // example GPU thread) when being run in single process mode. | 61 // example GPU thread) when being run in single process mode. |
| 59 // However, the behavior for accessing one context (i.e. one instance of this | 62 // However, the behavior for accessing one context (i.e. one instance of this |
| 60 // class) from different client threads is undefined. | 63 // class) from different client threads is undefined. |
| 61 class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, | 64 class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, |
| 62 public GpuControl { | 65 public GpuControl { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 scoped_ptr<GpuScheduler> gpu_scheduler_; | 197 scoped_ptr<GpuScheduler> gpu_scheduler_; |
| 195 scoped_ptr<gles2::GLES2Decoder> decoder_; | 198 scoped_ptr<gles2::GLES2Decoder> decoder_; |
| 196 scoped_refptr<gfx::GLContext> context_; | 199 scoped_refptr<gfx::GLContext> context_; |
| 197 scoped_refptr<gfx::GLSurface> surface_; | 200 scoped_refptr<gfx::GLSurface> surface_; |
| 198 base::Closure context_lost_callback_; | 201 base::Closure context_lost_callback_; |
| 199 | 202 |
| 200 // Members accessed on the client thread: | 203 // Members accessed on the client thread: |
| 201 State last_state_; | 204 State last_state_; |
| 202 int32 last_put_offset_; | 205 int32 last_put_offset_; |
| 203 gpu::Capabilities capabilities_; | 206 gpu::Capabilities capabilities_; |
| 207 typedef std::map<int32, linked_ptr<gfx::GpuMemoryBuffer> > GpuMemoryBufferMap; |
| 208 GpuMemoryBufferMap gpu_memory_buffers_; |
| 204 | 209 |
| 205 // Accessed on both threads: | 210 // Accessed on both threads: |
| 206 scoped_ptr<CommandBufferServiceBase> command_buffer_; | 211 scoped_ptr<CommandBufferServiceBase> command_buffer_; |
| 207 base::Lock command_buffer_lock_; | 212 base::Lock command_buffer_lock_; |
| 208 base::WaitableEvent flush_event_; | 213 base::WaitableEvent flush_event_; |
| 209 scoped_refptr<Service> service_; | 214 scoped_refptr<Service> service_; |
| 210 State state_after_last_flush_; | 215 State state_after_last_flush_; |
| 211 base::Lock state_after_last_flush_lock_; | 216 base::Lock state_after_last_flush_lock_; |
| 212 scoped_ptr<GpuControl> gpu_control_; | 217 scoped_ptr<GpuControlService> gpu_control_; |
| 213 scoped_refptr<gfx::GLShareGroup> gl_share_group_; | 218 scoped_refptr<gfx::GLShareGroup> gl_share_group_; |
| 214 | 219 |
| 215 #if defined(OS_ANDROID) | 220 #if defined(OS_ANDROID) |
| 216 scoped_ptr<StreamTextureManagerInProcess> stream_texture_manager_; | 221 scoped_ptr<StreamTextureManagerInProcess> stream_texture_manager_; |
| 217 #endif | 222 #endif |
| 218 | 223 |
| 219 // Only used with explicit scheduling and the gpu thread is the same as | 224 // Only used with explicit scheduling and the gpu thread is the same as |
| 220 // the client thread. | 225 // the client thread. |
| 221 scoped_ptr<base::SequenceChecker> sequence_checker_; | 226 scoped_ptr<base::SequenceChecker> sequence_checker_; |
| 222 | 227 |
| 223 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_; | 228 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_; |
| 224 base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_; | 229 base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_; |
| 225 | 230 |
| 226 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); | 231 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); |
| 227 }; | 232 }; |
| 228 | 233 |
| 229 } // namespace gpu | 234 } // namespace gpu |
| 230 | 235 |
| 231 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 236 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
| OLD | NEW |