| 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 "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
| 12 | 13 |
| 13 namespace gles2 { | 14 namespace gles2 { |
| 14 class GpuState; | 15 class GpuState; |
| 15 } | 16 } |
| 16 | 17 |
| 17 namespace native_viewport { | 18 namespace native_viewport { |
| 18 | 19 |
| 19 class OnscreenContextProvider : public mojo::ContextProvider { | 20 class OnscreenContextProvider : public mojo::ContextProvider, |
| 21 public gles2::CommandBufferImpl::Observer { |
| 20 public: | 22 public: |
| 21 explicit OnscreenContextProvider(const scoped_refptr<gles2::GpuState>& state); | 23 explicit OnscreenContextProvider(const scoped_refptr<gles2::GpuState>& state); |
| 22 ~OnscreenContextProvider() override; | 24 ~OnscreenContextProvider() override; |
| 23 | 25 |
| 24 void Bind(mojo::InterfaceRequest<mojo::ContextProvider> request); | 26 void Bind(mojo::InterfaceRequest<mojo::ContextProvider> request); |
| 25 | 27 |
| 26 void SetAcceleratedWidget(gfx::AcceleratedWidget widget); | 28 void SetAcceleratedWidget(gfx::AcceleratedWidget widget); |
| 27 | 29 |
| 28 private: | 30 private: |
| 29 // mojo::ContextProvider implementation: | 31 // mojo::ContextProvider implementation: |
| 30 void Create(mojo::ViewportParameterListenerPtr viewport_parameter_listener, | 32 void Create(mojo::ViewportParameterListenerPtr viewport_parameter_listener, |
| 31 const CreateCallback& callback) override; | 33 const CreateCallback& callback) override; |
| 32 | 34 |
| 35 // gles2::CommandBufferImpl::Observer implementation: |
| 36 void OnCommandBufferImplDestroyed() override; |
| 37 |
| 33 void CreateAndReturnCommandBuffer(); | 38 void CreateAndReturnCommandBuffer(); |
| 34 | 39 |
| 40 gles2::CommandBufferImpl* command_buffer_impl_; |
| 35 scoped_refptr<gles2::GpuState> state_; | 41 scoped_refptr<gles2::GpuState> state_; |
| 36 gfx::AcceleratedWidget widget_; | 42 gfx::AcceleratedWidget widget_; |
| 37 mojo::ViewportParameterListenerPtr pending_listener_; | 43 mojo::ViewportParameterListenerPtr pending_listener_; |
| 38 CreateCallback pending_create_callback_; | 44 CreateCallback pending_create_callback_; |
| 39 mojo::Binding<mojo::ContextProvider> binding_; | 45 mojo::Binding<mojo::ContextProvider> binding_; |
| 40 | 46 |
| 41 DISALLOW_COPY_AND_ASSIGN(OnscreenContextProvider); | 47 DISALLOW_COPY_AND_ASSIGN(OnscreenContextProvider); |
| 42 }; | 48 }; |
| 43 | 49 |
| 44 } // namespace mojo | 50 } // namespace mojo |
| 45 | 51 |
| 46 #endif // SERVICES_NATIVE_VIEWPORT_ONSCREEN_CONTEXT_PROVIDER_H_ | 52 #endif // SERVICES_NATIVE_VIEWPORT_ONSCREEN_CONTEXT_PROVIDER_H_ |
| OLD | NEW |