| 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 <vector> |
| 9 | 10 |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 12 #include "components/mus/public/interfaces/command_buffer.mojom.h" | 13 #include "components/mus/public/interfaces/command_buffer.mojom.h" |
| 13 #include "gpu/command_buffer/client/gpu_control.h" | 14 #include "gpu/command_buffer/client/gpu_control.h" |
| 14 #include "gpu/command_buffer/common/command_buffer.h" | 15 #include "gpu/command_buffer/common/command_buffer.h" |
| 15 #include "gpu/command_buffer/common/command_buffer_shared.h" | 16 #include "gpu/command_buffer/common/command_buffer_shared.h" |
| 16 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" | 17 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" |
| 17 | 18 |
| 18 namespace base { | 19 namespace base { |
| 19 class RunLoop; | 20 class RunLoop; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace gles2 { | 23 namespace gles2 { |
| 23 class CommandBufferClientImpl; | 24 class CommandBufferClientImpl; |
| 24 | 25 |
| 25 class CommandBufferDelegate { | 26 class CommandBufferDelegate { |
| 26 public: | 27 public: |
| 27 virtual ~CommandBufferDelegate(); | 28 virtual ~CommandBufferDelegate(); |
| 28 virtual void ContextLost(); | 29 virtual void ContextLost(); |
| 29 }; | 30 }; |
| 30 | 31 |
| 31 class CommandBufferClientImpl : public mojo::CommandBufferLostContextObserver, | 32 class CommandBufferClientImpl : public mojo::CommandBufferLostContextObserver, |
| 32 public gpu::CommandBuffer, | 33 public gpu::CommandBuffer, |
| 33 public gpu::GpuControl { | 34 public gpu::GpuControl { |
| 34 public: | 35 public: |
| 35 explicit CommandBufferClientImpl( | 36 explicit CommandBufferClientImpl( |
| 36 CommandBufferDelegate* delegate, | 37 CommandBufferDelegate* delegate, |
| 38 const std::vector<int32_t>& attribs, |
| 37 const MojoAsyncWaiter* async_waiter, | 39 const MojoAsyncWaiter* async_waiter, |
| 38 mojo::ScopedMessagePipeHandle command_buffer_handle); | 40 mojo::ScopedMessagePipeHandle command_buffer_handle); |
| 39 ~CommandBufferClientImpl() override; | 41 ~CommandBufferClientImpl() override; |
| 40 | 42 |
| 41 // CommandBuffer implementation: | 43 // CommandBuffer implementation: |
| 42 bool Initialize() override; | 44 bool Initialize() override; |
| 43 State GetLastState() override; | 45 State GetLastState() override; |
| 44 int32_t GetLastToken() override; | 46 int32_t GetLastToken() override; |
| 45 void Flush(int32_t put_offset) override; | 47 void Flush(int32_t put_offset) override; |
| 46 void OrderingBarrier(int32_t put_offset) override; | 48 void OrderingBarrier(int32_t put_offset) override; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 81 |
| 80 // mojo::CommandBufferLostContextObserver implementation: | 82 // mojo::CommandBufferLostContextObserver implementation: |
| 81 void DidLoseContext(int32_t lost_reason) override; | 83 void DidLoseContext(int32_t lost_reason) override; |
| 82 | 84 |
| 83 void TryUpdateState(); | 85 void TryUpdateState(); |
| 84 void MakeProgressAndUpdateState(); | 86 void MakeProgressAndUpdateState(); |
| 85 | 87 |
| 86 gpu::CommandBufferSharedState* shared_state() const { return shared_state_; } | 88 gpu::CommandBufferSharedState* shared_state() const { return shared_state_; } |
| 87 | 89 |
| 88 CommandBufferDelegate* delegate_; | 90 CommandBufferDelegate* delegate_; |
| 91 std::vector<int32_t> attribs_; |
| 89 mojo::Binding<mojo::CommandBufferLostContextObserver> observer_binding_; | 92 mojo::Binding<mojo::CommandBufferLostContextObserver> observer_binding_; |
| 90 mojo::CommandBufferPtr command_buffer_; | 93 mojo::CommandBufferPtr command_buffer_; |
| 91 scoped_ptr<SyncClientImpl> sync_client_impl_; | 94 scoped_ptr<SyncClientImpl> sync_client_impl_; |
| 92 scoped_ptr<SyncPointClientImpl> sync_point_client_impl_; | 95 scoped_ptr<SyncPointClientImpl> sync_point_client_impl_; |
| 93 | 96 |
| 94 gpu::Capabilities capabilities_; | 97 gpu::Capabilities capabilities_; |
| 95 State last_state_; | 98 State last_state_; |
| 96 mojo::ScopedSharedBufferHandle shared_state_handle_; | 99 mojo::ScopedSharedBufferHandle shared_state_handle_; |
| 97 gpu::CommandBufferSharedState* shared_state_; | 100 gpu::CommandBufferSharedState* shared_state_; |
| 98 int32_t last_put_offset_; | 101 int32_t last_put_offset_; |
| 99 int32_t next_transfer_buffer_id_; | 102 int32_t next_transfer_buffer_id_; |
| 100 | 103 |
| 101 // Image IDs are allocated in sequence. | 104 // Image IDs are allocated in sequence. |
| 102 int next_image_id_; | 105 int next_image_id_; |
| 103 | 106 |
| 104 const MojoAsyncWaiter* async_waiter_; | 107 const MojoAsyncWaiter* async_waiter_; |
| 105 }; | 108 }; |
| 106 | 109 |
| 107 } // gles2 | 110 } // gles2 |
| 108 | 111 |
| 109 #endif // MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ | 112 #endif // MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ |
| OLD | NEW |