| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 UI_COMPOSITOR_TEST_IN_PROCESS_CONTEXT_PROVIDER_H_ | 5 #ifndef UI_COMPOSITOR_TEST_IN_PROCESS_CONTEXT_PROVIDER_H_ |
| 6 #define UI_COMPOSITOR_TEST_IN_PROCESS_CONTEXT_PROVIDER_H_ | 6 #define UI_COMPOSITOR_TEST_IN_PROCESS_CONTEXT_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 class GpuMemoryBufferManager; | 23 class GpuMemoryBufferManager; |
| 24 class ImageFactory; | 24 class ImageFactory; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace ui { | 27 namespace ui { |
| 28 | 28 |
| 29 class InProcessContextProvider : public cc::ContextProvider { | 29 class InProcessContextProvider : public cc::ContextProvider { |
| 30 public: | 30 public: |
| 31 static scoped_refptr<InProcessContextProvider> Create( | 31 static scoped_refptr<InProcessContextProvider> Create( |
| 32 const gpu::gles2::ContextCreationAttribHelper& attribs, | 32 const gpu::gles2::ContextCreationAttribHelper& attribs, |
| 33 InProcessContextProvider* shared_context, |
| 33 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 34 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 34 gpu::ImageFactory* image_factory, | 35 gpu::ImageFactory* image_factory, |
| 35 gfx::AcceleratedWidget window, | 36 gfx::AcceleratedWidget window, |
| 36 const std::string& debug_name); | 37 const std::string& debug_name); |
| 37 | 38 |
| 38 // Uses default attributes for creating an offscreen context. | 39 // Uses default attributes for creating an offscreen context. |
| 39 static scoped_refptr<InProcessContextProvider> CreateOffscreen( | 40 static scoped_refptr<InProcessContextProvider> CreateOffscreen( |
| 40 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 41 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 41 gpu::ImageFactory* image_factory); | 42 gpu::ImageFactory* image_factory, |
| 43 InProcessContextProvider* shared_context); |
| 42 | 44 |
| 43 // cc::ContextProvider: | 45 // cc::ContextProvider: |
| 44 bool BindToCurrentThread() override; | 46 bool BindToCurrentThread() override; |
| 45 void DetachFromThread() override; | 47 void DetachFromThread() override; |
| 46 Capabilities ContextCapabilities() override; | 48 Capabilities ContextCapabilities() override; |
| 47 gpu::gles2::GLES2Interface* ContextGL() override; | 49 gpu::gles2::GLES2Interface* ContextGL() override; |
| 48 gpu::ContextSupport* ContextSupport() override; | 50 gpu::ContextSupport* ContextSupport() override; |
| 49 class GrContext* GrContext() override; | 51 class GrContext* GrContext() override; |
| 50 void InvalidateGrContext(uint32_t state) override; | 52 void InvalidateGrContext(uint32_t state) override; |
| 51 void SetupLock() override; | 53 void SetupLock() override; |
| 52 base::Lock* GetLock() override; | 54 base::Lock* GetLock() override; |
| 53 void DeleteCachedResources() override; | 55 void DeleteCachedResources() override; |
| 54 void SetLostContextCallback( | 56 void SetLostContextCallback( |
| 55 const LostContextCallback& lost_context_callback) override; | 57 const LostContextCallback& lost_context_callback) override; |
| 56 | 58 |
| 57 private: | 59 private: |
| 58 InProcessContextProvider( | 60 InProcessContextProvider( |
| 59 const gpu::gles2::ContextCreationAttribHelper& attribs, | 61 const gpu::gles2::ContextCreationAttribHelper& attribs, |
| 62 InProcessContextProvider* shared_context, |
| 60 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 63 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 61 gpu::ImageFactory* image_factory, | 64 gpu::ImageFactory* image_factory, |
| 62 gfx::AcceleratedWidget window, | 65 gfx::AcceleratedWidget window, |
| 63 const std::string& debug_name); | 66 const std::string& debug_name); |
| 64 ~InProcessContextProvider() override; | 67 ~InProcessContextProvider() override; |
| 65 | 68 |
| 66 void OnLostContext(); | |
| 67 | |
| 68 base::ThreadChecker main_thread_checker_; | 69 base::ThreadChecker main_thread_checker_; |
| 69 base::ThreadChecker context_thread_checker_; | 70 base::ThreadChecker context_thread_checker_; |
| 70 | 71 |
| 71 scoped_ptr<gpu::GLInProcessContext> context_; | 72 scoped_ptr<gpu::GLInProcessContext> context_; |
| 72 skia::RefPtr<class GrContext> gr_context_; | 73 skia::RefPtr<class GrContext> gr_context_; |
| 73 | 74 |
| 74 gpu::gles2::ContextCreationAttribHelper attribs_; | 75 gpu::gles2::ContextCreationAttribHelper attribs_; |
| 76 InProcessContextProvider* shared_context_; |
| 75 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 77 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
| 76 gpu::ImageFactory* image_factory_; | 78 gpu::ImageFactory* image_factory_; |
| 77 gfx::AcceleratedWidget window_; | 79 gfx::AcceleratedWidget window_; |
| 78 std::string debug_name_; | 80 std::string debug_name_; |
| 79 cc::ContextProvider::Capabilities capabilities_; | 81 cc::ContextProvider::Capabilities capabilities_; |
| 80 | 82 |
| 81 LostContextCallback lost_context_callback_; | |
| 82 | |
| 83 base::Lock context_lock_; | 83 base::Lock context_lock_; |
| 84 | 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(InProcessContextProvider); | 85 DISALLOW_COPY_AND_ASSIGN(InProcessContextProvider); |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 } // namespace ui | 88 } // namespace ui |
| 89 | 89 |
| 90 #endif // UI_COMPOSITOR_TEST_IN_PROCESS_CONTEXT_PROVIDER_H_ | 90 #endif // UI_COMPOSITOR_TEST_IN_PROCESS_CONTEXT_PROVIDER_H_ |
| OLD | NEW |