| 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 SERVICES_NATIVE_VIEWPORT_ONSCREEN_CONTEXT_PROVIDER_H_ | 5 #ifndef SERVICES_NATIVE_VIEWPORT_ONSCREEN_CONTEXT_PROVIDER_H_ |
| 6 #define SERVICES_NATIVE_VIEWPORT_ONSCREEN_CONTEXT_PROVIDER_H_ | 6 #define SERVICES_NATIVE_VIEWPORT_ONSCREEN_CONTEXT_PROVIDER_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "mojo/services/gpu/public/interfaces/context_provider.mojom.h" | 9 #include "mojo/services/gpu/public/interfaces/context_provider.mojom.h" |
| 10 #include "mojo/services/gpu/public/interfaces/viewport_parameter_listener.mojom.
h" | 10 #include "mojo/services/gpu/public/interfaces/viewport_parameter_listener.mojom.
h" |
| 11 #include "services/gles2/command_buffer_impl.h" | 11 #include "services/gles2/command_buffer_impl.h" |
| 12 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
| 13 #include "ui/gl/gl_surface.h" |
| 13 | 14 |
| 14 namespace gles2 { | 15 namespace gles2 { |
| 15 class GpuState; | 16 class GpuState; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace native_viewport { | 19 namespace native_viewport { |
| 19 | 20 |
| 20 class OnscreenContextProvider : public mojo::ContextProvider, | 21 class OnscreenContextProvider : public mojo::ContextProvider, |
| 21 public gles2::CommandBufferImpl::Observer { | 22 public gles2::CommandBufferImpl::Observer { |
| 22 public: | 23 public: |
| 23 explicit OnscreenContextProvider(const scoped_refptr<gles2::GpuState>& state); | 24 explicit OnscreenContextProvider(const scoped_refptr<gles2::GpuState>& state); |
| 24 ~OnscreenContextProvider() override; | 25 ~OnscreenContextProvider() override; |
| 25 | 26 |
| 26 void Bind(mojo::InterfaceRequest<mojo::ContextProvider> request); | 27 void Bind(mojo::InterfaceRequest<mojo::ContextProvider> request); |
| 27 | 28 |
| 28 void SetAcceleratedWidget(gfx::AcceleratedWidget widget); | 29 void SetAcceleratedWidget(gfx::AcceleratedWidget widget); |
| 29 | 30 void set_surface_configuration( |
| 31 const gfx::SurfaceConfiguration requested_configuration) { |
| 32 requested_configuration_ = requested_configuration; |
| 33 }; |
| 30 private: | 34 private: |
| 31 // mojo::ContextProvider implementation: | 35 // mojo::ContextProvider implementation: |
| 32 void Create(mojo::ViewportParameterListenerPtr viewport_parameter_listener, | 36 void Create(mojo::ViewportParameterListenerPtr viewport_parameter_listener, |
| 33 const CreateCallback& callback) override; | 37 const CreateCallback& callback) override; |
| 34 | 38 |
| 35 // gles2::CommandBufferImpl::Observer implementation: | 39 // gles2::CommandBufferImpl::Observer implementation: |
| 36 void OnCommandBufferImplDestroyed() override; | 40 void OnCommandBufferImplDestroyed() override; |
| 37 | 41 |
| 38 void CreateAndReturnCommandBuffer(); | 42 void CreateAndReturnCommandBuffer(); |
| 39 | 43 |
| 44 gfx::SurfaceConfiguration requested_configuration_; |
| 40 gles2::CommandBufferImpl* command_buffer_impl_; | 45 gles2::CommandBufferImpl* command_buffer_impl_; |
| 41 scoped_refptr<gles2::GpuState> state_; | 46 scoped_refptr<gles2::GpuState> state_; |
| 42 gfx::AcceleratedWidget widget_; | 47 gfx::AcceleratedWidget widget_; |
| 43 mojo::ViewportParameterListenerPtr pending_listener_; | 48 mojo::ViewportParameterListenerPtr pending_listener_; |
| 44 CreateCallback pending_create_callback_; | 49 CreateCallback pending_create_callback_; |
| 45 mojo::Binding<mojo::ContextProvider> binding_; | 50 mojo::Binding<mojo::ContextProvider> binding_; |
| 46 | 51 |
| 47 DISALLOW_COPY_AND_ASSIGN(OnscreenContextProvider); | 52 DISALLOW_COPY_AND_ASSIGN(OnscreenContextProvider); |
| 48 }; | 53 }; |
| 49 | 54 |
| 50 } // namespace mojo | 55 } // namespace mojo |
| 51 | 56 |
| 52 #endif // SERVICES_NATIVE_VIEWPORT_ONSCREEN_CONTEXT_PROVIDER_H_ | 57 #endif // SERVICES_NATIVE_VIEWPORT_ONSCREEN_CONTEXT_PROVIDER_H_ |
| OLD | NEW |