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