| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 class StreamTextureManagerInProcess; | 41 class StreamTextureManagerInProcess; |
| 42 } | 42 } |
| 43 #endif | 43 #endif |
| 44 | 44 |
| 45 namespace gpu { | 45 namespace gpu { |
| 46 | 46 |
| 47 namespace gles2 { | 47 namespace gles2 { |
| 48 class GLES2Decoder; | 48 class GLES2Decoder; |
| 49 } | 49 } |
| 50 | 50 |
| 51 class CommandBufferServiceBase; |
| 51 class GpuMemoryBufferFactory; | 52 class GpuMemoryBufferFactory; |
| 52 class GpuScheduler; | 53 class GpuScheduler; |
| 53 class TransferBufferManagerInterface; | 54 class TransferBufferManagerInterface; |
| 54 | 55 |
| 55 // This class provides a thread-safe interface to the global GPU service (for | 56 // This class provides a thread-safe interface to the global GPU service (for |
| 56 // example GPU thread) when being run in single process mode. | 57 // example GPU thread) when being run in single process mode. |
| 57 // However, the behavior for accessing one context (i.e. one instance of this | 58 // However, the behavior for accessing one context (i.e. one instance of this |
| 58 // class) from different client threads is undefined. | 59 // class) from different client threads is undefined. |
| 59 class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, | 60 class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, |
| 60 public GpuControl { | 61 public GpuControl { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 80 | 81 |
| 81 // CommandBuffer implementation: | 82 // CommandBuffer implementation: |
| 82 virtual bool Initialize() OVERRIDE; | 83 virtual bool Initialize() OVERRIDE; |
| 83 virtual State GetState() OVERRIDE; | 84 virtual State GetState() OVERRIDE; |
| 84 virtual State GetLastState() OVERRIDE; | 85 virtual State GetLastState() OVERRIDE; |
| 85 virtual int32 GetLastToken() OVERRIDE; | 86 virtual int32 GetLastToken() OVERRIDE; |
| 86 virtual void Flush(int32 put_offset) OVERRIDE; | 87 virtual void Flush(int32 put_offset) OVERRIDE; |
| 87 virtual void WaitForTokenInRange(int32 start, int32 end) OVERRIDE; | 88 virtual void WaitForTokenInRange(int32 start, int32 end) OVERRIDE; |
| 88 virtual void WaitForGetOffsetInRange(int32 start, int32 end) OVERRIDE; | 89 virtual void WaitForGetOffsetInRange(int32 start, int32 end) OVERRIDE; |
| 89 virtual void SetGetBuffer(int32 shm_id) OVERRIDE; | 90 virtual void SetGetBuffer(int32 shm_id) OVERRIDE; |
| 90 virtual void SetGetOffset(int32 get_offset) OVERRIDE; | |
| 91 virtual scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size, | 91 virtual scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size, |
| 92 int32* id) OVERRIDE; | 92 int32* id) OVERRIDE; |
| 93 virtual void DestroyTransferBuffer(int32 id) OVERRIDE; | 93 virtual void DestroyTransferBuffer(int32 id) OVERRIDE; |
| 94 virtual scoped_refptr<gpu::Buffer> GetTransferBuffer(int32 id) OVERRIDE; | |
| 95 virtual void SetToken(int32 token) OVERRIDE; | |
| 96 virtual void SetParseError(gpu::error::Error error) OVERRIDE; | |
| 97 virtual void SetContextLostReason( | |
| 98 gpu::error::ContextLostReason reason) OVERRIDE; | |
| 99 virtual gpu::error::Error GetLastError() OVERRIDE; | 94 virtual gpu::error::Error GetLastError() OVERRIDE; |
| 100 | 95 |
| 101 // GpuControl implementation: | 96 // GpuControl implementation: |
| 102 virtual gpu::Capabilities GetCapabilities() OVERRIDE; | 97 virtual gpu::Capabilities GetCapabilities() OVERRIDE; |
| 103 virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer( | 98 virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer( |
| 104 size_t width, | 99 size_t width, |
| 105 size_t height, | 100 size_t height, |
| 106 unsigned internalformat, | 101 unsigned internalformat, |
| 107 int32* id) OVERRIDE; | 102 int32* id) OVERRIDE; |
| 108 virtual void DestroyGpuMemoryBuffer(int32 id) OVERRIDE; | 103 virtual void DestroyGpuMemoryBuffer(int32 id) OVERRIDE; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 scoped_refptr<gfx::GLContext> context_; | 193 scoped_refptr<gfx::GLContext> context_; |
| 199 scoped_refptr<gfx::GLSurface> surface_; | 194 scoped_refptr<gfx::GLSurface> surface_; |
| 200 base::Closure context_lost_callback_; | 195 base::Closure context_lost_callback_; |
| 201 | 196 |
| 202 // Members accessed on the client thread: | 197 // Members accessed on the client thread: |
| 203 State last_state_; | 198 State last_state_; |
| 204 int32 last_put_offset_; | 199 int32 last_put_offset_; |
| 205 gpu::Capabilities capabilities_; | 200 gpu::Capabilities capabilities_; |
| 206 | 201 |
| 207 // Accessed on both threads: | 202 // Accessed on both threads: |
| 208 scoped_ptr<CommandBuffer> command_buffer_; | 203 scoped_ptr<CommandBufferServiceBase> command_buffer_; |
| 209 base::Lock command_buffer_lock_; | 204 base::Lock command_buffer_lock_; |
| 210 base::WaitableEvent flush_event_; | 205 base::WaitableEvent flush_event_; |
| 211 scoped_refptr<Service> service_; | 206 scoped_refptr<Service> service_; |
| 212 State state_after_last_flush_; | 207 State state_after_last_flush_; |
| 213 base::Lock state_after_last_flush_lock_; | 208 base::Lock state_after_last_flush_lock_; |
| 214 scoped_ptr<GpuControl> gpu_control_; | 209 scoped_ptr<GpuControl> gpu_control_; |
| 215 scoped_refptr<gfx::GLShareGroup> gl_share_group_; | 210 scoped_refptr<gfx::GLShareGroup> gl_share_group_; |
| 216 | 211 |
| 217 #if defined(OS_ANDROID) | 212 #if defined(OS_ANDROID) |
| 218 scoped_ptr<StreamTextureManagerInProcess> stream_texture_manager_; | 213 scoped_ptr<StreamTextureManagerInProcess> stream_texture_manager_; |
| 219 #endif | 214 #endif |
| 220 | 215 |
| 221 // Only used with explicit scheduling and the gpu thread is the same as | 216 // Only used with explicit scheduling and the gpu thread is the same as |
| 222 // the client thread. | 217 // the client thread. |
| 223 scoped_ptr<base::SequenceChecker> sequence_checker_; | 218 scoped_ptr<base::SequenceChecker> sequence_checker_; |
| 224 | 219 |
| 225 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_; | 220 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_; |
| 226 base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_; | 221 base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_; |
| 227 | 222 |
| 228 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); | 223 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); |
| 229 }; | 224 }; |
| 230 | 225 |
| 231 } // namespace gpu | 226 } // namespace gpu |
| 232 | 227 |
| 233 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 228 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
| OLD | NEW |