| 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 class MailboxManager; |
| 21 } | 22 } |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace gfx { | 25 namespace gfx { |
| 26 class GLContext; |
| 27 class GLShareGroup; |
| 25 class GLSurface; | 28 class GLSurface; |
| 26 } | 29 } |
| 27 | 30 |
| 28 namespace mojo { | 31 namespace mojo { |
| 29 | 32 |
| 30 class CommandBufferImpl : public InterfaceImpl<CommandBuffer> { | 33 class CommandBufferImpl : public InterfaceImpl<CommandBuffer> { |
| 31 public: | 34 public: |
| 35 // Offscreen. |
| 36 CommandBufferImpl(gfx::GLShareGroup* share_group, |
| 37 gpu::gles2::MailboxManager* mailbox_manager); |
| 38 // Onscreen. |
| 32 CommandBufferImpl(gfx::AcceleratedWidget widget, | 39 CommandBufferImpl(gfx::AcceleratedWidget widget, |
| 33 const gfx::Size& size); | 40 const gfx::Size& size, |
| 41 gfx::GLShareGroup* share_group, |
| 42 gpu::gles2::MailboxManager* mailbox_manager); |
| 34 virtual ~CommandBufferImpl(); | 43 virtual ~CommandBufferImpl(); |
| 35 | 44 |
| 36 virtual void Initialize(CommandBufferSyncClientPtr sync_client, | 45 virtual void Initialize(CommandBufferSyncClientPtr sync_client, |
| 37 mojo::ScopedSharedBufferHandle shared_state) OVERRIDE; | 46 mojo::ScopedSharedBufferHandle shared_state) OVERRIDE; |
| 38 virtual void SetGetBuffer(int32_t buffer) OVERRIDE; | 47 virtual void SetGetBuffer(int32_t buffer) OVERRIDE; |
| 39 virtual void Flush(int32_t put_offset) OVERRIDE; | 48 virtual void Flush(int32_t put_offset) OVERRIDE; |
| 40 virtual void MakeProgress(int32_t last_get_offset) OVERRIDE; | 49 virtual void MakeProgress(int32_t last_get_offset) OVERRIDE; |
| 41 virtual void RegisterTransferBuffer( | 50 virtual void RegisterTransferBuffer( |
| 42 int32_t id, | 51 int32_t id, |
| 43 mojo::ScopedSharedBufferHandle transfer_buffer, | 52 mojo::ScopedSharedBufferHandle transfer_buffer, |
| 44 uint32_t size) OVERRIDE; | 53 uint32_t size) OVERRIDE; |
| 45 virtual void DestroyTransferBuffer(int32_t id) OVERRIDE; | 54 virtual void DestroyTransferBuffer(int32_t id) OVERRIDE; |
| 46 virtual void Echo(const Callback<void()>& callback) OVERRIDE; | 55 virtual void Echo(const Callback<void()>& callback) OVERRIDE; |
| 47 | 56 |
| 48 private: | 57 private: |
| 49 bool DoInitialize(mojo::ScopedSharedBufferHandle shared_state); | 58 bool DoInitialize(mojo::ScopedSharedBufferHandle shared_state); |
| 50 | 59 |
| 51 void OnResize(gfx::Size size, float scale_factor); | 60 void OnResize(gfx::Size size, float scale_factor); |
| 52 | 61 |
| 53 void OnParseError(); | 62 void OnParseError(); |
| 54 | 63 |
| 55 CommandBufferSyncClientPtr sync_client_; | 64 CommandBufferSyncClientPtr sync_client_; |
| 56 | 65 |
| 57 gfx::AcceleratedWidget widget_; | 66 gfx::AcceleratedWidget widget_; |
| 58 gfx::Size size_; | 67 gfx::Size size_; |
| 59 scoped_ptr<gpu::CommandBufferService> command_buffer_; | 68 scoped_ptr<gpu::CommandBufferService> command_buffer_; |
| 60 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; | 69 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; |
| 61 scoped_ptr<gpu::GpuScheduler> scheduler_; | 70 scoped_ptr<gpu::GpuScheduler> scheduler_; |
| 71 scoped_refptr<gfx::GLContext> context_; |
| 62 scoped_refptr<gfx::GLSurface> surface_; | 72 scoped_refptr<gfx::GLSurface> surface_; |
| 73 scoped_refptr<gfx::GLShareGroup> share_group_; |
| 74 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; |
| 63 | 75 |
| 64 DISALLOW_COPY_AND_ASSIGN(CommandBufferImpl); | 76 DISALLOW_COPY_AND_ASSIGN(CommandBufferImpl); |
| 65 }; | 77 }; |
| 66 | 78 |
| 67 } // namespace mojo | 79 } // namespace mojo |
| 68 | 80 |
| 69 #endif // MOJO_SERVICES_GLES2_COMMAND_BUFFER_IMPL_H_ | 81 #endif // MOJO_SERVICES_GLES2_COMMAND_BUFFER_IMPL_H_ |
| OLD | NEW |