| 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 MOJO_SERVICES_GLES2_COMMAND_BUFFER_IMPL_H_ | 5 #ifndef MOJO_SERVICES_GLES2_COMMAND_BUFFER_IMPL_H_ |
| 6 #define MOJO_SERVICES_GLES2_COMMAND_BUFFER_IMPL_H_ | 6 #define MOJO_SERVICES_GLES2_COMMAND_BUFFER_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
| 10 #include "mojo/public/cpp/system/core.h" | 10 #include "mojo/public/cpp/system/core.h" |
| 11 #include "mojo/services/gles2/command_buffer.mojom.h" | 11 #include "mojo/services/gles2/command_buffer.mojom.h" |
| 12 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
| 13 #include "ui/gfx/size.h" | 13 #include "ui/gfx/size.h" |
| 14 | 14 |
| 15 namespace gpu { | 15 namespace gpu { |
| 16 class CommandBufferService; | 16 class CommandBufferService; |
| 17 class GpuScheduler; | 17 class GpuScheduler; |
| 18 class GpuControlService; | 18 class GpuControlService; |
| 19 namespace gles2 { | 19 namespace gles2 { |
| 20 class GLES2Decoder; | 20 class GLES2Decoder; |
| 21 } | 21 } |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace gfx { | |
| 25 class GLSurface; | |
| 26 } | |
| 27 | |
| 28 namespace mojo { | 24 namespace mojo { |
| 29 namespace services { | 25 namespace services { |
| 30 | 26 |
| 31 class CommandBufferImpl : public InterfaceImpl<CommandBuffer> { | 27 class CommandBufferImpl : public InterfaceImpl<CommandBuffer> { |
| 32 public: | 28 public: |
| 33 CommandBufferImpl(gfx::AcceleratedWidget widget, | 29 CommandBufferImpl(gfx::AcceleratedWidget widget, |
| 34 const gfx::Size& size); | 30 const gfx::Size& size); |
| 35 virtual ~CommandBufferImpl(); | 31 virtual ~CommandBufferImpl(); |
| 36 | 32 |
| 37 virtual void OnConnectionError() OVERRIDE; | 33 virtual void OnConnectionError() OVERRIDE; |
| 38 virtual void Initialize(CommandBufferSyncClientPtr sync_client, | 34 virtual void Initialize(CommandBufferSyncClientPtr sync_client, |
| 39 mojo::ScopedSharedBufferHandle shared_state) OVERRIDE; | 35 mojo::ScopedSharedBufferHandle shared_state) OVERRIDE; |
| 40 virtual void SetGetBuffer(int32_t buffer) OVERRIDE; | 36 virtual void SetGetBuffer(int32_t buffer) OVERRIDE; |
| 41 virtual void Flush(int32_t put_offset) OVERRIDE; | 37 virtual void Flush(int32_t put_offset) OVERRIDE; |
| 42 virtual void MakeProgress(int32_t last_get_offset) OVERRIDE; | 38 virtual void MakeProgress(int32_t last_get_offset) OVERRIDE; |
| 43 virtual void RegisterTransferBuffer( | 39 virtual void RegisterTransferBuffer( |
| 44 int32_t id, | 40 int32_t id, |
| 45 mojo::ScopedSharedBufferHandle transfer_buffer, | 41 mojo::ScopedSharedBufferHandle transfer_buffer, |
| 46 uint32_t size) OVERRIDE; | 42 uint32_t size) OVERRIDE; |
| 47 virtual void DestroyTransferBuffer(int32_t id) OVERRIDE; | 43 virtual void DestroyTransferBuffer(int32_t id) OVERRIDE; |
| 48 virtual void Echo(const Callback<void()>& callback) OVERRIDE; | 44 virtual void Echo(const Callback<void()>& callback) OVERRIDE; |
| 49 | 45 |
| 50 virtual void RequestAnimationFrames() OVERRIDE; | 46 virtual void RequestAnimationFrames() OVERRIDE; |
| 51 virtual void CancelAnimationFrames() OVERRIDE; | 47 virtual void CancelAnimationFrames() OVERRIDE; |
| 52 | 48 |
| 53 private: | 49 private: |
| 54 bool DoInitialize(mojo::ScopedSharedBufferHandle shared_state); | 50 bool DoInitialize(mojo::ScopedSharedBufferHandle shared_state); |
| 55 | 51 |
| 56 void OnResize(gfx::Size size, float scale_factor); | |
| 57 | |
| 58 void OnParseError(); | 52 void OnParseError(); |
| 59 | 53 |
| 60 void DrawAnimationFrame(); | 54 void DrawAnimationFrame(); |
| 61 | 55 |
| 62 CommandBufferSyncClientPtr sync_client_; | 56 CommandBufferSyncClientPtr sync_client_; |
| 63 | 57 |
| 64 gfx::AcceleratedWidget widget_; | 58 gfx::AcceleratedWidget widget_; |
| 65 gfx::Size size_; | 59 gfx::Size size_; |
| 66 scoped_ptr<gpu::CommandBufferService> command_buffer_; | 60 scoped_ptr<gpu::CommandBufferService> command_buffer_; |
| 67 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; | 61 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; |
| 68 scoped_ptr<gpu::GpuScheduler> scheduler_; | 62 scoped_ptr<gpu::GpuScheduler> scheduler_; |
| 69 scoped_ptr<gpu::GpuControlService> gpu_control_; | 63 scoped_ptr<gpu::GpuControlService> gpu_control_; |
| 70 scoped_refptr<gfx::GLSurface> surface_; | |
| 71 base::RepeatingTimer<CommandBufferImpl> timer_; | 64 base::RepeatingTimer<CommandBufferImpl> timer_; |
| 72 | 65 |
| 73 DISALLOW_COPY_AND_ASSIGN(CommandBufferImpl); | 66 DISALLOW_COPY_AND_ASSIGN(CommandBufferImpl); |
| 74 }; | 67 }; |
| 75 | 68 |
| 76 } // namespace services | 69 } // namespace services |
| 77 } // namespace mojo | 70 } // namespace mojo |
| 78 | 71 |
| 79 #endif // MOJO_SERVICES_GLES2_COMMAND_BUFFER_IMPL_H_ | 72 #endif // MOJO_SERVICES_GLES2_COMMAND_BUFFER_IMPL_H_ |
| OLD | NEW |