| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 CC_TEST_TEST_IN_PROCESS_CONTEXT_PROVIDER_H_ | 5 #ifndef CC_TEST_TEST_IN_PROCESS_CONTEXT_PROVIDER_H_ |
| 6 #define CC_TEST_TEST_IN_PROCESS_CONTEXT_PROVIDER_H_ | 6 #define CC_TEST_TEST_IN_PROCESS_CONTEXT_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| 11 #include "cc/output/context_provider.h" | 11 #include "cc/output/context_provider.h" |
| 12 #include "cc/test/test_gpu_memory_buffer_manager.h" | 12 #include "cc/test/test_gpu_memory_buffer_manager.h" |
| 13 #include "cc/test/test_image_factory.h" | 13 #include "cc/test/test_image_factory.h" |
| 14 #include "skia/ext/refptr.h" | 14 #include "skia/ext/refptr.h" |
| 15 | 15 |
| 16 class GrContext; | 16 class GrContext; |
| 17 | 17 |
| 18 namespace gpu { | 18 namespace gpu { |
| 19 class GLInProcessContext; | 19 class GLInProcessContext; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace cc { | 22 namespace cc { |
| 23 | 23 |
| 24 scoped_ptr<gpu::GLInProcessContext> CreateTestInProcessContext(); | 24 scoped_ptr<gpu::GLInProcessContext> CreateTestInProcessContext(); |
| 25 scoped_ptr<gpu::GLInProcessContext> CreateTestInProcessContext( | 25 scoped_ptr<gpu::GLInProcessContext> CreateTestInProcessContext( |
| 26 TestGpuMemoryBufferManager* gpu_memory_buffer_manager, | 26 TestGpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 27 TestImageFactory* image_factory); | 27 TestImageFactory* image_factory, |
| 28 gpu::GLInProcessContext* shared_context); |
| 28 | 29 |
| 29 class TestInProcessContextProvider : public ContextProvider { | 30 class TestInProcessContextProvider : public ContextProvider { |
| 30 public: | 31 public: |
| 31 TestInProcessContextProvider(); | 32 explicit TestInProcessContextProvider( |
| 33 TestInProcessContextProvider* shared_context); |
| 32 | 34 |
| 33 bool BindToCurrentThread() override; | 35 bool BindToCurrentThread() override; |
| 34 gpu::gles2::GLES2Interface* ContextGL() override; | 36 gpu::gles2::GLES2Interface* ContextGL() override; |
| 35 gpu::ContextSupport* ContextSupport() override; | 37 gpu::ContextSupport* ContextSupport() override; |
| 36 class GrContext* GrContext() override; | 38 class GrContext* GrContext() override; |
| 37 void InvalidateGrContext(uint32_t state) override; | 39 void InvalidateGrContext(uint32_t state) override; |
| 38 void SetupLock() override; | 40 void SetupLock() override; |
| 39 base::Lock* GetLock() override; | 41 base::Lock* GetLock() override; |
| 40 Capabilities ContextCapabilities() override; | 42 Capabilities ContextCapabilities() override; |
| 41 void DeleteCachedResources() override; | 43 void DeleteCachedResources() override; |
| 42 void SetLostContextCallback( | 44 void SetLostContextCallback( |
| 43 const LostContextCallback& lost_context_callback) override; | 45 const LostContextCallback& lost_context_callback) override; |
| 44 | 46 |
| 45 protected: | 47 protected: |
| 46 friend class base::RefCountedThreadSafe<TestInProcessContextProvider>; | 48 friend class base::RefCountedThreadSafe<TestInProcessContextProvider>; |
| 47 ~TestInProcessContextProvider() override; | 49 ~TestInProcessContextProvider() override; |
| 48 | 50 |
| 49 private: | 51 private: |
| 50 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; | 52 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; |
| 51 TestImageFactory image_factory_; | 53 TestImageFactory image_factory_; |
| 52 scoped_ptr<gpu::GLInProcessContext> context_; | 54 scoped_ptr<gpu::GLInProcessContext> context_; |
| 53 skia::RefPtr<class GrContext> gr_context_; | 55 skia::RefPtr<class GrContext> gr_context_; |
| 54 base::Lock context_lock_; | 56 base::Lock context_lock_; |
| 55 }; | 57 }; |
| 56 | 58 |
| 57 } // namespace cc | 59 } // namespace cc |
| 58 | 60 |
| 59 #endif // CC_TEST_TEST_IN_PROCESS_CONTEXT_PROVIDER_H_ | 61 #endif // CC_TEST_TEST_IN_PROCESS_CONTEXT_PROVIDER_H_ |
| OLD | NEW |