| 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 BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_CONTEXT_PROVIDER_H_ | 5 #ifndef BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_CONTEXT_PROVIDER_H_ |
| 6 #define BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_CONTEXT_PROVIDER_H_ | 6 #define BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_CONTEXT_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // Helper class to provide a graphics context for the compositor. | 27 // Helper class to provide a graphics context for the compositor. |
| 28 class BlimpContextProvider : public cc::ContextProvider { | 28 class BlimpContextProvider : public cc::ContextProvider { |
| 29 public: | 29 public: |
| 30 static scoped_refptr<BlimpContextProvider> Create( | 30 static scoped_refptr<BlimpContextProvider> Create( |
| 31 gfx::AcceleratedWidget widget, | 31 gfx::AcceleratedWidget widget, |
| 32 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager); | 32 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager); |
| 33 | 33 |
| 34 // cc::ContextProvider implementation. | 34 // cc::ContextProvider implementation. |
| 35 bool BindToCurrentThread() override; | 35 bool BindToCurrentThread() override; |
| 36 void DetachFromThread() override; | 36 void DetachFromThread() override; |
| 37 Capabilities ContextCapabilities() override; | 37 gpu::Capabilities ContextCapabilities() override; |
| 38 gpu::gles2::GLES2Interface* ContextGL() override; | 38 gpu::gles2::GLES2Interface* ContextGL() override; |
| 39 gpu::ContextSupport* ContextSupport() override; | 39 gpu::ContextSupport* ContextSupport() override; |
| 40 class GrContext* GrContext() override; | 40 class GrContext* GrContext() override; |
| 41 void InvalidateGrContext(uint32_t state) override; | 41 void InvalidateGrContext(uint32_t state) override; |
| 42 void SetupLock() override; | 42 void SetupLock() override; |
| 43 base::Lock* GetLock() override; | 43 base::Lock* GetLock() override; |
| 44 void DeleteCachedResources() override; | 44 void DeleteCachedResources() override; |
| 45 void SetLostContextCallback( | 45 void SetLostContextCallback( |
| 46 const LostContextCallback& lost_context_callback) override; | 46 const LostContextCallback& lost_context_callback) override; |
| 47 | 47 |
| 48 protected: | 48 protected: |
| 49 BlimpContextProvider( | 49 BlimpContextProvider( |
| 50 gfx::AcceleratedWidget widget, | 50 gfx::AcceleratedWidget widget, |
| 51 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager); | 51 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager); |
| 52 ~BlimpContextProvider() override; | 52 ~BlimpContextProvider() override; |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 void OnLostContext(); | 55 void OnLostContext(); |
| 56 | 56 |
| 57 base::ThreadChecker main_thread_checker_; | 57 base::ThreadChecker main_thread_checker_; |
| 58 base::ThreadChecker context_thread_checker_; | 58 base::ThreadChecker context_thread_checker_; |
| 59 | 59 |
| 60 base::Lock context_lock_; | 60 base::Lock context_lock_; |
| 61 std::unique_ptr<gpu::GLInProcessContext> context_; | 61 std::unique_ptr<gpu::GLInProcessContext> context_; |
| 62 std::unique_ptr<skia_bindings::GrContextForGLES2Interface> gr_context_; | 62 std::unique_ptr<skia_bindings::GrContextForGLES2Interface> gr_context_; |
| 63 | 63 |
| 64 cc::ContextProvider::Capabilities capabilities_; | |
| 65 | |
| 66 LostContextCallback lost_context_callback_; | 64 LostContextCallback lost_context_callback_; |
| 67 | 65 |
| 68 DISALLOW_COPY_AND_ASSIGN(BlimpContextProvider); | 66 DISALLOW_COPY_AND_ASSIGN(BlimpContextProvider); |
| 69 }; | 67 }; |
| 70 | 68 |
| 71 } // namespace client | 69 } // namespace client |
| 72 } // namespace blimp | 70 } // namespace blimp |
| 73 | 71 |
| 74 #endif // BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_CONTEXT_PROVIDER_H_ | 72 #endif // BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_CONTEXT_PROVIDER_H_ |
| OLD | NEW |