| 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 SERVICES_UI_SURFACES_SURFACES_CONTEXT_PROVIDER_H_ | 5 #ifndef SERVICES_UI_SURFACES_SURFACES_CONTEXT_PROVIDER_H_ |
| 6 #define SERVICES_UI_SURFACES_SURFACES_CONTEXT_PROVIDER_H_ | 6 #define SERVICES_UI_SURFACES_SURFACES_CONTEXT_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 SurfacesContextProvider(gfx::AcceleratedWidget widget, | 45 SurfacesContextProvider(gfx::AcceleratedWidget widget, |
| 46 scoped_refptr<gpu::GpuChannelHost> gpu_channel); | 46 scoped_refptr<gpu::GpuChannelHost> gpu_channel); |
| 47 | 47 |
| 48 void SetDelegate(SurfacesContextProviderDelegate* delegate); | 48 void SetDelegate(SurfacesContextProviderDelegate* delegate); |
| 49 | 49 |
| 50 // cc::ContextProvider implementation. | 50 // cc::ContextProvider implementation. |
| 51 bool BindToCurrentThread() override; | 51 bool BindToCurrentThread() override; |
| 52 gpu::gles2::GLES2Interface* ContextGL() override; | 52 gpu::gles2::GLES2Interface* ContextGL() override; |
| 53 gpu::ContextSupport* ContextSupport() override; | 53 gpu::ContextSupport* ContextSupport() override; |
| 54 class GrContext* GrContext() override; | 54 class GrContext* GrContext() override; |
| 55 cc::ContextCacheController* CacheController() override; |
| 55 void InvalidateGrContext(uint32_t state) override; | 56 void InvalidateGrContext(uint32_t state) override; |
| 56 gpu::Capabilities ContextCapabilities() override; | 57 gpu::Capabilities ContextCapabilities() override; |
| 57 void DeleteCachedResources() override {} | |
| 58 void SetLostContextCallback( | 58 void SetLostContextCallback( |
| 59 const LostContextCallback& lost_context_callback) override; | 59 const LostContextCallback& lost_context_callback) override; |
| 60 base::Lock* GetLock() override; | 60 base::Lock* GetLock() override; |
| 61 | 61 |
| 62 // SurfacesContextProvider API. | 62 // SurfacesContextProvider API. |
| 63 void SetSwapBuffersCompletionCallback( | 63 void SetSwapBuffersCompletionCallback( |
| 64 gl::GLSurface::SwapCompletionCallback callback); | 64 gl::GLSurface::SwapCompletionCallback callback); |
| 65 | 65 |
| 66 protected: | 66 protected: |
| 67 friend class base::RefCountedThreadSafe<SurfacesContextProvider>; | 67 friend class base::RefCountedThreadSafe<SurfacesContextProvider>; |
| 68 ~SurfacesContextProvider() override; | 68 ~SurfacesContextProvider() override; |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 // Callbacks for CommandBufferProxyImpl: | 71 // Callbacks for CommandBufferProxyImpl: |
| 72 void OnGpuSwapBuffersCompleted( | 72 void OnGpuSwapBuffersCompleted( |
| 73 const std::vector<ui::LatencyInfo>& latency_info, | 73 const std::vector<ui::LatencyInfo>& latency_info, |
| 74 gfx::SwapResult result, | 74 gfx::SwapResult result, |
| 75 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac); | 75 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac); |
| 76 void OnUpdateVSyncParameters(base::TimeTicks timebase, | 76 void OnUpdateVSyncParameters(base::TimeTicks timebase, |
| 77 base::TimeDelta interval); | 77 base::TimeDelta interval); |
| 78 | 78 |
| 79 // From GLES2Context: | 79 // From GLES2Context: |
| 80 // Initialized in BindToCurrentThread. | 80 // Initialized in BindToCurrentThread. |
| 81 std::unique_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; | 81 std::unique_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; |
| 82 std::unique_ptr<gpu::TransferBuffer> transfer_buffer_; | 82 std::unique_ptr<gpu::TransferBuffer> transfer_buffer_; |
| 83 std::unique_ptr<gpu::gles2::GLES2Implementation> implementation_; | 83 std::unique_ptr<gpu::gles2::GLES2Implementation> implementation_; |
| 84 std::unique_ptr<cc::ContextCacheController> cache_controller_; |
| 84 | 85 |
| 85 gpu::Capabilities capabilities_; | 86 gpu::Capabilities capabilities_; |
| 86 LostContextCallback lost_context_callback_; | 87 LostContextCallback lost_context_callback_; |
| 87 | 88 |
| 88 SurfacesContextProviderDelegate* delegate_; | 89 SurfacesContextProviderDelegate* delegate_; |
| 89 gfx::AcceleratedWidget widget_; | 90 gfx::AcceleratedWidget widget_; |
| 90 std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_proxy_impl_; | 91 std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_proxy_impl_; |
| 91 gl::GLSurface::SwapCompletionCallback swap_buffers_completion_callback_; | 92 gl::GLSurface::SwapCompletionCallback swap_buffers_completion_callback_; |
| 92 | 93 |
| 93 DISALLOW_COPY_AND_ASSIGN(SurfacesContextProvider); | 94 DISALLOW_COPY_AND_ASSIGN(SurfacesContextProvider); |
| 94 }; | 95 }; |
| 95 | 96 |
| 96 } // namespace ui | 97 } // namespace ui |
| 97 | 98 |
| 98 #endif // SERVICES_UI_SURFACES_SURFACES_CONTEXT_PROVIDER_H_ | 99 #endif // SERVICES_UI_SURFACES_SURFACES_CONTEXT_PROVIDER_H_ |
| OLD | NEW |