| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ | 5 #ifndef MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ |
| 6 #define MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ | 6 #define MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "mojo/services/gles2/command_buffer.mojom.h" |
| 11 |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 12 #include "gpu/command_buffer/client/gpu_control.h" | 14 #include "gpu/command_buffer/client/gpu_control.h" |
| 13 #include "gpu/command_buffer/common/command_buffer.h" | 15 #include "gpu/command_buffer/common/command_buffer.h" |
| 14 #include "gpu/command_buffer/common/command_buffer_shared.h" | 16 #include "gpu/command_buffer/common/command_buffer_shared.h" |
| 15 #include "mojo/public/cpp/bindings/error_handler.h" | 17 #include "mojo/public/cpp/bindings/error_handler.h" |
| 16 #include "mojo/public/cpp/bindings/remote_ptr.h" | |
| 17 #include "mojo/services/gles2/command_buffer.mojom.h" | |
| 18 | 18 |
| 19 namespace base { | 19 namespace base { |
| 20 class RunLoop; | 20 class RunLoop; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace mojo { | 23 namespace mojo { |
| 24 template <typename S> | 24 template <typename S> |
| 25 class SyncDispatcher; | 25 class SyncDispatcher; |
| 26 | 26 |
| 27 namespace gles2 { | 27 namespace gles2 { |
| 28 class CommandBufferClientImpl; | 28 class CommandBufferClientImpl; |
| 29 | 29 |
| 30 class CommandBufferDelegate { | 30 class CommandBufferDelegate { |
| 31 public: | 31 public: |
| 32 virtual ~CommandBufferDelegate(); | 32 virtual ~CommandBufferDelegate(); |
| 33 virtual void ContextLost(); | 33 virtual void ContextLost(); |
| 34 virtual void DrawAnimationFrame(); | 34 virtual void DrawAnimationFrame(); |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 class CommandBufferClientImpl : public CommandBufferClient, | 37 class CommandBufferClientImpl : public CommandBufferClient, |
| 38 public CommandBufferSyncClient, | 38 public CommandBufferSyncClient, |
| 39 public ErrorHandler, | 39 public ErrorHandler, |
| 40 public gpu::CommandBuffer, | 40 public gpu::CommandBuffer, |
| 41 public gpu::GpuControl { | 41 public gpu::GpuControl { |
| 42 public: | 42 public: |
| 43 explicit CommandBufferClientImpl( | 43 explicit CommandBufferClientImpl( |
| 44 CommandBufferDelegate* delegate, | 44 CommandBufferDelegate* delegate, |
| 45 MojoAsyncWaiter* async_waiter, | 45 MojoAsyncWaiter* async_waiter, |
| 46 ScopedCommandBufferHandle command_buffer_handle); | 46 ScopedMessagePipeHandle command_buffer_handle); |
| 47 virtual ~CommandBufferClientImpl(); | 47 virtual ~CommandBufferClientImpl(); |
| 48 | 48 |
| 49 // CommandBuffer implementation: | 49 // CommandBuffer implementation: |
| 50 virtual bool Initialize() OVERRIDE; | 50 virtual bool Initialize() OVERRIDE; |
| 51 virtual State GetLastState() OVERRIDE; | 51 virtual State GetLastState() OVERRIDE; |
| 52 virtual int32 GetLastToken() OVERRIDE; | 52 virtual int32 GetLastToken() OVERRIDE; |
| 53 virtual void Flush(int32 put_offset) OVERRIDE; | 53 virtual void Flush(int32 put_offset) OVERRIDE; |
| 54 virtual void WaitForTokenInRange(int32 start, int32 end) OVERRIDE; | 54 virtual void WaitForTokenInRange(int32 start, int32 end) OVERRIDE; |
| 55 virtual void WaitForGetOffsetInRange(int32 start, int32 end) OVERRIDE; | 55 virtual void WaitForGetOffsetInRange(int32 start, int32 end) OVERRIDE; |
| 56 virtual void SetGetBuffer(int32 shm_id) OVERRIDE; | 56 virtual void SetGetBuffer(int32 shm_id) OVERRIDE; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 virtual void OnError() OVERRIDE; | 90 virtual void OnError() OVERRIDE; |
| 91 | 91 |
| 92 virtual void DrawAnimationFrame() OVERRIDE; | 92 virtual void DrawAnimationFrame() OVERRIDE; |
| 93 | 93 |
| 94 void TryUpdateState(); | 94 void TryUpdateState(); |
| 95 void MakeProgressAndUpdateState(); | 95 void MakeProgressAndUpdateState(); |
| 96 | 96 |
| 97 gpu::CommandBufferSharedState* shared_state() const { return shared_state_; } | 97 gpu::CommandBufferSharedState* shared_state() const { return shared_state_; } |
| 98 | 98 |
| 99 CommandBufferDelegate* delegate_; | 99 CommandBufferDelegate* delegate_; |
| 100 RemotePtr<mojo::CommandBuffer> command_buffer_; | 100 CommandBufferPtr command_buffer_; |
| 101 scoped_ptr<SyncDispatcher<CommandBufferSyncClient> > sync_dispatcher_; | 101 // XXX scoped_ptr<SyncDispatcher<CommandBufferSyncClient> > sync_dispatcher_; |
| 102 | 102 |
| 103 State last_state_; | 103 State last_state_; |
| 104 mojo::ScopedSharedBufferHandle shared_state_handle_; | 104 mojo::ScopedSharedBufferHandle shared_state_handle_; |
| 105 gpu::CommandBufferSharedState* shared_state_; | 105 gpu::CommandBufferSharedState* shared_state_; |
| 106 int32 last_put_offset_; | 106 int32 last_put_offset_; |
| 107 int32 next_transfer_buffer_id_; | 107 int32 next_transfer_buffer_id_; |
| 108 | 108 |
| 109 bool initialize_result_; | 109 bool initialize_result_; |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 } // gles2 | 112 } // gles2 |
| 113 } // mojo | 113 } // mojo |
| 114 | 114 |
| 115 #endif // MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ | 115 #endif // MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ |
| OLD | NEW |