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