| 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 COMPONENTS_MUS_GLES2_COMMAND_BUFFER_IMPL_H_ | 5 #ifndef COMPONENTS_MUS_GLES2_COMMAND_BUFFER_IMPL_H_ |
| 6 #define COMPONENTS_MUS_GLES2_COMMAND_BUFFER_IMPL_H_ | 6 #define COMPONENTS_MUS_GLES2_COMMAND_BUFFER_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "components/mus/public/interfaces/command_buffer.mojom.h" | 11 #include "components/mus/public/interfaces/command_buffer.mojom.h" |
| 12 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" | 12 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" |
| 13 | 13 |
| 14 namespace mus { | 14 namespace mus { |
| 15 | 15 |
| 16 class CommandBufferDriver; | 16 class CommandBufferDriver; |
| 17 class CommandBufferImplObserver; | 17 class CommandBufferImplObserver; |
| 18 class GpuState; | 18 class GpuState; |
| 19 | 19 |
| 20 // This class listens to the CommandBuffer message pipe on a low-latency thread | 20 // This class listens to the CommandBuffer message pipe on a low-latency thread |
| 21 // so that we can insert sync points without blocking on the GL driver. It | 21 // so that we can insert sync points without blocking on the GL driver. It |
| 22 // forwards most method calls to the CommandBufferDriver, which runs on the | 22 // forwards most method calls to the CommandBufferDriver, which runs on the |
| 23 // same thread as the native viewport. | 23 // same thread as the native viewport. |
| 24 class CommandBufferImpl : public mojo::CommandBuffer { | 24 class CommandBufferImpl : public mojom::CommandBuffer { |
| 25 public: | 25 public: |
| 26 CommandBufferImpl(mojo::InterfaceRequest<CommandBuffer> request, | 26 CommandBufferImpl(mojo::InterfaceRequest<CommandBuffer> request, |
| 27 scoped_refptr<GpuState> gpu_state, | 27 scoped_refptr<GpuState> gpu_state, |
| 28 scoped_ptr<CommandBufferDriver> driver); | 28 scoped_ptr<CommandBufferDriver> driver); |
| 29 | 29 |
| 30 // mojo::CommandBuffer: | 30 // mojom::CommandBuffer: |
| 31 void Initialize(mojo::CommandBufferSyncClientPtr sync_client, | 31 void Initialize(mojom::CommandBufferSyncClientPtr sync_client, |
| 32 mojo::CommandBufferSyncPointClientPtr sync_point_client, | 32 mojom::CommandBufferSyncPointClientPtr sync_point_client, |
| 33 mojo::CommandBufferLostContextObserverPtr loss_observer, | 33 mojom::CommandBufferLostContextObserverPtr loss_observer, |
| 34 mojo::ScopedSharedBufferHandle shared_state, | 34 mojo::ScopedSharedBufferHandle shared_state, |
| 35 mojo::Array<int32_t> attribs) override; | 35 mojo::Array<int32_t> attribs) override; |
| 36 void SetGetBuffer(int32_t buffer) override; | 36 void SetGetBuffer(int32_t buffer) override; |
| 37 void Flush(int32_t put_offset) override; | 37 void Flush(int32_t put_offset) override; |
| 38 void MakeProgress(int32_t last_get_offset) override; | 38 void MakeProgress(int32_t last_get_offset) override; |
| 39 void RegisterTransferBuffer(int32_t id, | 39 void RegisterTransferBuffer(int32_t id, |
| 40 mojo::ScopedSharedBufferHandle transfer_buffer, | 40 mojo::ScopedSharedBufferHandle transfer_buffer, |
| 41 uint32_t size) override; | 41 uint32_t size) override; |
| 42 void DestroyTransferBuffer(int32_t id) override; | 42 void DestroyTransferBuffer(int32_t id) override; |
| 43 void InsertSyncPoint(bool retire) override; | 43 void InsertSyncPoint(bool retire) override; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 64 | 64 |
| 65 ~CommandBufferImpl() override; | 65 ~CommandBufferImpl() override; |
| 66 | 66 |
| 67 void BindToRequest(mojo::InterfaceRequest<CommandBuffer> request); | 67 void BindToRequest(mojo::InterfaceRequest<CommandBuffer> request); |
| 68 | 68 |
| 69 void OnConnectionError(); | 69 void OnConnectionError(); |
| 70 | 70 |
| 71 scoped_refptr<GpuState> gpu_state_; | 71 scoped_refptr<GpuState> gpu_state_; |
| 72 scoped_refptr<base::SingleThreadTaskRunner> driver_task_runner_; | 72 scoped_refptr<base::SingleThreadTaskRunner> driver_task_runner_; |
| 73 scoped_ptr<CommandBufferDriver> driver_; | 73 scoped_ptr<CommandBufferDriver> driver_; |
| 74 mojo::CommandBufferSyncPointClientPtr sync_point_client_; | 74 mojom::CommandBufferSyncPointClientPtr sync_point_client_; |
| 75 scoped_ptr<mojo::Binding<CommandBuffer>> binding_; | 75 scoped_ptr<mojo::Binding<CommandBuffer>> binding_; |
| 76 CommandBufferImplObserver* observer_; | 76 CommandBufferImplObserver* observer_; |
| 77 base::WeakPtrFactory<CommandBufferImpl> weak_ptr_factory_; | 77 base::WeakPtrFactory<CommandBufferImpl> weak_ptr_factory_; |
| 78 | 78 |
| 79 DISALLOW_COPY_AND_ASSIGN(CommandBufferImpl); | 79 DISALLOW_COPY_AND_ASSIGN(CommandBufferImpl); |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 } // namespace mus | 82 } // namespace mus |
| 83 | 83 |
| 84 #endif // COMPONENTS_MUS_GLES2_COMMAND_BUFFER_IMPL_H_ | 84 #endif // COMPONENTS_MUS_GLES2_COMMAND_BUFFER_IMPL_H_ |
| OLD | NEW |