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