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_VIEW_MANAGER_GLES2_COMMAND_BUFFER_IMPL_H_ | 5 #ifndef COMPONENTS_VIEW_MANAGER_GLES2_COMMAND_BUFFER_IMPL_H_ |
6 #define COMPONENTS_VIEW_MANAGER_GLES2_COMMAND_BUFFER_IMPL_H_ | 6 #define COMPONENTS_VIEW_MANAGER_GLES2_COMMAND_BUFFER_IMPL_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "components/view_manager/public/interfaces/command_buffer.mojom.h" | 10 #include "components/view_manager/public/interfaces/command_buffer.mojom.h" |
11 #include "components/view_manager/public/interfaces/viewport_parameter_listener. mojom.h" | 11 #include "components/view_manager/public/interfaces/viewport_parameter_listener. 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 gpu { | 14 namespace gpu { |
15 class SyncPointManager; | 15 class SyncPointManager; |
msw
2015/07/21 17:53:01
nit: remove this.
| |
16 } | 16 } |
17 | 17 |
18 namespace gles2 { | 18 namespace gles2 { |
19 class CommandBufferDriver; | 19 class CommandBufferDriver; |
20 class CommandBufferImplObserver; | 20 class CommandBufferImplObserver; |
21 class GpuState; | |
21 | 22 |
22 // This class listens to the CommandBuffer message pipe on a low-latency thread | 23 // This class listens to the CommandBuffer message pipe on a low-latency thread |
23 // so that we can insert sync points without blocking on the GL driver. It | 24 // so that we can insert sync points without blocking on the GL driver. It |
24 // forwards most method calls to the CommandBufferDriver, which runs on the | 25 // forwards most method calls to the CommandBufferDriver, which runs on the |
25 // same thread as the native viewport. | 26 // same thread as the native viewport. |
26 class CommandBufferImpl : public mojo::CommandBuffer { | 27 class CommandBufferImpl : public mojo::CommandBuffer { |
27 public: | 28 public: |
28 CommandBufferImpl( | 29 CommandBufferImpl(mojo::InterfaceRequest<CommandBuffer> request, |
29 mojo::InterfaceRequest<CommandBuffer> request, | 30 mojo::ViewportParameterListenerPtr listener, |
30 mojo::ViewportParameterListenerPtr listener, | 31 scoped_refptr<GpuState> gpu_state, |
31 scoped_refptr<base::SingleThreadTaskRunner> control_task_runner, | 32 scoped_ptr<CommandBufferDriver> driver); |
32 gpu::SyncPointManager* sync_point_manager, | |
33 scoped_ptr<CommandBufferDriver> driver); | |
34 | 33 |
35 // mojo::CommandBuffer: | 34 // mojo::CommandBuffer: |
36 void Initialize(mojo::CommandBufferSyncClientPtr sync_client, | 35 void Initialize(mojo::CommandBufferSyncClientPtr sync_client, |
37 mojo::CommandBufferSyncPointClientPtr sync_point_client, | 36 mojo::CommandBufferSyncPointClientPtr sync_point_client, |
38 mojo::CommandBufferLostContextObserverPtr loss_observer, | 37 mojo::CommandBufferLostContextObserverPtr loss_observer, |
39 mojo::ScopedSharedBufferHandle shared_state) override; | 38 mojo::ScopedSharedBufferHandle shared_state) override; |
40 void SetGetBuffer(int32_t buffer) override; | 39 void SetGetBuffer(int32_t buffer) override; |
41 void Flush(int32_t put_offset) override; | 40 void Flush(int32_t put_offset) override; |
42 void MakeProgress(int32_t last_get_offset) override; | 41 void MakeProgress(int32_t last_get_offset) override; |
43 void RegisterTransferBuffer(int32_t id, | 42 void RegisterTransferBuffer(int32_t id, |
(...skipping 24 matching lines...) Expand all Loading... | |
68 | 67 |
69 ~CommandBufferImpl() override; | 68 ~CommandBufferImpl() override; |
70 | 69 |
71 void BindToRequest(mojo::InterfaceRequest<CommandBuffer> request); | 70 void BindToRequest(mojo::InterfaceRequest<CommandBuffer> request); |
72 | 71 |
73 void UpdateVSyncParameters(base::TimeTicks timebase, | 72 void UpdateVSyncParameters(base::TimeTicks timebase, |
74 base::TimeDelta interval); | 73 base::TimeDelta interval); |
75 | 74 |
76 void OnConnectionError(); | 75 void OnConnectionError(); |
77 | 76 |
78 scoped_refptr<gpu::SyncPointManager> sync_point_manager_; | 77 scoped_refptr<GpuState> gpu_state_; |
79 scoped_refptr<base::SingleThreadTaskRunner> driver_task_runner_; | 78 scoped_refptr<base::SingleThreadTaskRunner> driver_task_runner_; |
80 scoped_ptr<CommandBufferDriver> driver_; | 79 scoped_ptr<CommandBufferDriver> driver_; |
81 mojo::CommandBufferSyncPointClientPtr sync_point_client_; | 80 mojo::CommandBufferSyncPointClientPtr sync_point_client_; |
82 mojo::ViewportParameterListenerPtr viewport_parameter_listener_; | 81 mojo::ViewportParameterListenerPtr viewport_parameter_listener_; |
83 mojo::Binding<CommandBuffer> binding_; | 82 mojo::Binding<CommandBuffer> binding_; |
84 CommandBufferImplObserver* observer_; | 83 CommandBufferImplObserver* observer_; |
85 | 84 |
86 DISALLOW_COPY_AND_ASSIGN(CommandBufferImpl); | 85 DISALLOW_COPY_AND_ASSIGN(CommandBufferImpl); |
87 }; | 86 }; |
88 | 87 |
89 } // namespace gles2 | 88 } // namespace gles2 |
90 | 89 |
91 #endif // COMPONENTS_VIEW_MANAGER_GLES2_COMMAND_BUFFER_IMPL_H_ | 90 #endif // COMPONENTS_VIEW_MANAGER_GLES2_COMMAND_BUFFER_IMPL_H_ |
OLD | NEW |