| 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 "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
| 12 #include "base/threading/non_thread_safe.h" | 12 #include "base/threading/non_thread_safe.h" |
| 13 #include "cc/output/context_provider.h" | 13 #include "cc/output/context_provider.h" |
| 14 #include "components/mus/gles2/command_buffer_local_client.h" | 14 #include "components/mus/gles2/command_buffer_local_client.h" |
| 15 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
| 16 #include "ui/gl/gl_surface.h" |
| 16 | 17 |
| 17 namespace gpu { | 18 namespace gpu { |
| 18 | 19 |
| 19 class TransferBuffer; | 20 class TransferBuffer; |
| 20 | 21 |
| 21 namespace gles2 { | 22 namespace gles2 { |
| 22 class GLES2CmdHelper; | 23 class GLES2CmdHelper; |
| 23 class GLES2Implementation; | 24 class GLES2Implementation; |
| 24 } | 25 } |
| 25 | 26 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 47 gpu::ContextSupport* ContextSupport() override; | 48 gpu::ContextSupport* ContextSupport() override; |
| 48 class GrContext* GrContext() override; | 49 class GrContext* GrContext() override; |
| 49 void InvalidateGrContext(uint32_t state) override; | 50 void InvalidateGrContext(uint32_t state) override; |
| 50 Capabilities ContextCapabilities() override; | 51 Capabilities ContextCapabilities() override; |
| 51 void DeleteCachedResources() override {} | 52 void DeleteCachedResources() override {} |
| 52 void SetLostContextCallback( | 53 void SetLostContextCallback( |
| 53 const LostContextCallback& lost_context_callback) override; | 54 const LostContextCallback& lost_context_callback) override; |
| 54 void SetupLock() override; | 55 void SetupLock() override; |
| 55 base::Lock* GetLock() override; | 56 base::Lock* GetLock() override; |
| 56 | 57 |
| 58 // SurfacesContextProvider API. |
| 59 void SetSwapBuffersCompletionCallback( |
| 60 gfx::GLSurface::SwapCompletionCallback callback); |
| 61 |
| 57 protected: | 62 protected: |
| 58 friend class base::RefCountedThreadSafe<SurfacesContextProvider>; | 63 friend class base::RefCountedThreadSafe<SurfacesContextProvider>; |
| 59 ~SurfacesContextProvider() override; | 64 ~SurfacesContextProvider() override; |
| 60 | 65 |
| 61 private: | 66 private: |
| 62 // CommandBufferLocalClient: | 67 // CommandBufferLocalClient: |
| 63 void UpdateVSyncParameters(int64_t timebase, int64_t interval) override; | 68 void UpdateVSyncParameters(int64_t timebase, int64_t interval) override; |
| 64 void DidLoseContext() override; | 69 void DidLoseContext() override; |
| 70 void GpuCompletedSwapBuffers(gfx::SwapResult result) override; |
| 65 | 71 |
| 66 // From GLES2Context: | 72 // From GLES2Context: |
| 67 // Initialized in BindToCurrentThread. | 73 // Initialized in BindToCurrentThread. |
| 68 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; | 74 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; |
| 69 scoped_ptr<gpu::TransferBuffer> transfer_buffer_; | 75 scoped_ptr<gpu::TransferBuffer> transfer_buffer_; |
| 70 scoped_ptr<gpu::gles2::GLES2Implementation> implementation_; | 76 scoped_ptr<gpu::gles2::GLES2Implementation> implementation_; |
| 71 | 77 |
| 72 cc::ContextProvider::Capabilities capabilities_; | 78 cc::ContextProvider::Capabilities capabilities_; |
| 73 LostContextCallback lost_context_callback_; | 79 LostContextCallback lost_context_callback_; |
| 74 | 80 |
| 75 SurfacesContextProviderDelegate* delegate_; | 81 SurfacesContextProviderDelegate* delegate_; |
| 76 gfx::AcceleratedWidget widget_; | 82 gfx::AcceleratedWidget widget_; |
| 77 CommandBufferLocal* command_buffer_local_; | 83 CommandBufferLocal* command_buffer_local_; |
| 78 | 84 |
| 85 gfx::GLSurface::SwapCompletionCallback swap_buffers_completion_callback_; |
| 86 |
| 79 base::Lock context_lock_; | 87 base::Lock context_lock_; |
| 80 | 88 |
| 81 DISALLOW_COPY_AND_ASSIGN(SurfacesContextProvider); | 89 DISALLOW_COPY_AND_ASSIGN(SurfacesContextProvider); |
| 82 }; | 90 }; |
| 83 | 91 |
| 84 } // namespace mus | 92 } // namespace mus |
| 85 | 93 |
| 86 #endif // COMPONENTS_MUS_SURFACES_SURFACES_CONTEXT_PROVIDER_H_ | 94 #endif // COMPONENTS_MUS_SURFACES_SURFACES_CONTEXT_PROVIDER_H_ |
| OLD | NEW |