| 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 #include <queue> | |
| 10 | 9 |
| 11 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/shared_memory.h" | 11 #include "base/memory/shared_memory.h" |
| 13 #include "gpu/command_buffer/common/command_buffer.h" | 12 #include "gpu/command_buffer/common/command_buffer.h" |
| 14 #include "gpu/command_buffer/common/command_buffer_shared.h" | 13 #include "gpu/command_buffer/common/command_buffer_shared.h" |
| 15 #include "gpu/command_buffer/common/gpu_control.h" | 14 #include "gpu/command_buffer/common/gpu_control.h" |
| 16 #include "mojo/public/bindings/error_handler.h" | 15 #include "mojo/public/bindings/error_handler.h" |
| 17 #include "mojo/public/bindings/remote_ptr.h" | 16 #include "mojo/public/bindings/remote_ptr.h" |
| 18 #include "mojo/services/gles2/command_buffer.mojom.h" | 17 #include "mojo/services/gles2/command_buffer.mojom.h" |
| 19 | 18 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 void RequestAnimationFrames(); | 84 void RequestAnimationFrames(); |
| 86 void CancelAnimationFrames(); | 85 void CancelAnimationFrames(); |
| 87 | 86 |
| 88 private: | 87 private: |
| 89 typedef std::map<int32, gpu::Buffer> TransferBufferMap; | 88 typedef std::map<int32, gpu::Buffer> TransferBufferMap; |
| 90 | 89 |
| 91 // CommandBufferClient implementation: | 90 // CommandBufferClient implementation: |
| 92 virtual void DidInitialize(bool success) MOJO_OVERRIDE; | 91 virtual void DidInitialize(bool success) MOJO_OVERRIDE; |
| 93 virtual void DidMakeProgress(const CommandBufferState& state) MOJO_OVERRIDE; | 92 virtual void DidMakeProgress(const CommandBufferState& state) MOJO_OVERRIDE; |
| 94 virtual void DidDestroy() MOJO_OVERRIDE; | 93 virtual void DidDestroy() MOJO_OVERRIDE; |
| 95 virtual void EchoAck() MOJO_OVERRIDE; | |
| 96 virtual void LostContext(int32_t lost_reason) MOJO_OVERRIDE; | 94 virtual void LostContext(int32_t lost_reason) MOJO_OVERRIDE; |
| 97 | 95 |
| 98 // ErrorHandler implementation: | 96 // ErrorHandler implementation: |
| 99 virtual void OnError() MOJO_OVERRIDE; | 97 virtual void OnError() MOJO_OVERRIDE; |
| 100 | 98 |
| 101 virtual void DrawAnimationFrame() MOJO_OVERRIDE; | 99 virtual void DrawAnimationFrame() MOJO_OVERRIDE; |
| 102 | 100 |
| 103 void TryUpdateState(); | 101 void TryUpdateState(); |
| 104 void MakeProgressAndUpdateState(); | 102 void MakeProgressAndUpdateState(); |
| 105 | 103 |
| 106 gpu::CommandBufferSharedState* shared_state() const { | 104 gpu::CommandBufferSharedState* shared_state() const { |
| 107 return reinterpret_cast<gpu::CommandBufferSharedState*>( | 105 return reinterpret_cast<gpu::CommandBufferSharedState*>( |
| 108 shared_state_shm_->memory()); | 106 shared_state_shm_->memory()); |
| 109 } | 107 } |
| 110 | 108 |
| 111 CommandBufferDelegate* delegate_; | 109 CommandBufferDelegate* delegate_; |
| 112 RemotePtr<mojo::CommandBuffer> command_buffer_; | 110 RemotePtr<mojo::CommandBuffer> command_buffer_; |
| 113 scoped_ptr<SyncDispatcher<CommandBufferSyncClient> > sync_dispatcher_; | 111 scoped_ptr<SyncDispatcher<CommandBufferSyncClient> > sync_dispatcher_; |
| 114 | 112 |
| 115 State last_state_; | 113 State last_state_; |
| 116 scoped_ptr<base::SharedMemory> shared_state_shm_; | 114 scoped_ptr<base::SharedMemory> shared_state_shm_; |
| 117 TransferBufferMap transfer_buffers_; | 115 TransferBufferMap transfer_buffers_; |
| 118 int32 last_put_offset_; | 116 int32 last_put_offset_; |
| 119 int32 next_transfer_buffer_id_; | 117 int32 next_transfer_buffer_id_; |
| 120 std::queue<base::Closure> echo_closures_; | |
| 121 | 118 |
| 122 bool initialize_result_; | 119 bool initialize_result_; |
| 123 }; | 120 }; |
| 124 | 121 |
| 125 } // gles2 | 122 } // gles2 |
| 126 } // mojo | 123 } // mojo |
| 127 | 124 |
| 128 #endif // MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ | 125 #endif // MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ |
| OLD | NEW |