OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_NATIVE_VIEWPORT_ONSCREEN_CONTEXT_PROVIDER_H_ | 5 #ifndef COMPONENTS_NATIVE_VIEWPORT_ONSCREEN_CONTEXT_PROVIDER_H_ |
6 #define COMPONENTS_NATIVE_VIEWPORT_ONSCREEN_CONTEXT_PROVIDER_H_ | 6 #define COMPONENTS_NATIVE_VIEWPORT_ONSCREEN_CONTEXT_PROVIDER_H_ |
7 | 7 |
| 8 #include <set> |
| 9 |
8 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
9 #include "components/gpu/public/interfaces/context_provider.mojom.h" | 11 #include "components/gpu/public/interfaces/context_provider.mojom.h" |
10 #include "components/gpu/public/interfaces/viewport_parameter_listener.mojom.h" | 12 #include "components/gpu/public/interfaces/viewport_parameter_listener.mojom.h" |
11 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
12 | 14 |
13 namespace gles2 { | 15 namespace gles2 { |
| 16 class CommandBufferDriver; |
14 class GpuState; | 17 class GpuState; |
15 } | 18 } |
16 | 19 |
17 namespace native_viewport { | 20 namespace native_viewport { |
18 | 21 |
19 class OnscreenContextProvider : public mojo::ContextProvider { | 22 class OnscreenContextProvider : public mojo::ContextProvider { |
20 public: | 23 public: |
21 explicit OnscreenContextProvider(const scoped_refptr<gles2::GpuState>& state); | 24 explicit OnscreenContextProvider(const scoped_refptr<gles2::GpuState>& state); |
22 ~OnscreenContextProvider() override; | 25 ~OnscreenContextProvider() override; |
23 | 26 |
24 void Bind(mojo::InterfaceRequest<mojo::ContextProvider> request); | 27 void Bind(mojo::InterfaceRequest<mojo::ContextProvider> request); |
25 | 28 |
26 void SetAcceleratedWidget(gfx::AcceleratedWidget widget); | 29 void SetAcceleratedWidget(gfx::AcceleratedWidget widget); |
27 | 30 |
28 private: | 31 private: |
29 // mojo::ContextProvider implementation: | 32 // mojo::ContextProvider implementation: |
30 void Create(mojo::ViewportParameterListenerPtr viewport_parameter_listener, | 33 void Create(mojo::ViewportParameterListenerPtr viewport_parameter_listener, |
31 const CreateCallback& callback) override; | 34 const CreateCallback& callback) override; |
32 | 35 |
33 void CreateAndReturnCommandBuffer(); | 36 void CreateAndReturnCommandBuffer(); |
| 37 void CommandBufferDestroyed(gles2::CommandBufferDriver* command_buffer); |
34 | 38 |
35 scoped_refptr<gles2::GpuState> state_; | 39 scoped_refptr<gles2::GpuState> state_; |
36 gfx::AcceleratedWidget widget_; | 40 gfx::AcceleratedWidget widget_; |
37 mojo::ViewportParameterListenerPtr pending_listener_; | 41 mojo::ViewportParameterListenerPtr pending_listener_; |
38 CreateCallback pending_create_callback_; | 42 CreateCallback pending_create_callback_; |
39 mojo::Binding<mojo::ContextProvider> binding_; | 43 mojo::Binding<mojo::ContextProvider> binding_; |
| 44 std::set<gles2::CommandBufferDriver*> command_buffers_; |
40 | 45 |
41 DISALLOW_COPY_AND_ASSIGN(OnscreenContextProvider); | 46 DISALLOW_COPY_AND_ASSIGN(OnscreenContextProvider); |
42 }; | 47 }; |
43 | 48 |
44 } // namespace mojo | 49 } // namespace mojo |
45 | 50 |
46 #endif // COMPONENTS_NATIVE_VIEWPORT_ONSCREEN_CONTEXT_PROVIDER_H_ | 51 #endif // COMPONENTS_NATIVE_VIEWPORT_ONSCREEN_CONTEXT_PROVIDER_H_ |
OLD | NEW |