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_CONTEXT_PROVIDER_H_ | 5 #ifndef CC_TEST_TEST_CONTEXT_PROVIDER_H_ |
6 #define CC_TEST_TEST_CONTEXT_PROVIDER_H_ | 6 #define CC_TEST_TEST_CONTEXT_PROVIDER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 std::unique_ptr<TestContextSupport> support); | 40 std::unique_ptr<TestContextSupport> support); |
41 static scoped_refptr<TestContextProvider> Create( | 41 static scoped_refptr<TestContextProvider> Create( |
42 std::unique_ptr<TestGLES2Interface> gl); | 42 std::unique_ptr<TestGLES2Interface> gl); |
43 | 43 |
44 bool BindToCurrentThread() override; | 44 bool BindToCurrentThread() override; |
45 void DetachFromThread() override; | 45 void DetachFromThread() override; |
46 gpu::Capabilities ContextCapabilities() override; | 46 gpu::Capabilities ContextCapabilities() override; |
47 gpu::gles2::GLES2Interface* ContextGL() override; | 47 gpu::gles2::GLES2Interface* ContextGL() override; |
48 gpu::ContextSupport* ContextSupport() override; | 48 gpu::ContextSupport* ContextSupport() override; |
49 class GrContext* GrContext() override; | 49 class GrContext* GrContext() override; |
| 50 ContextCacheController* CacheController() override; |
50 void InvalidateGrContext(uint32_t state) override; | 51 void InvalidateGrContext(uint32_t state) override; |
51 base::Lock* GetLock() override; | 52 base::Lock* GetLock() override; |
52 void DeleteCachedResources() override; | |
53 void SetLostContextCallback(const LostContextCallback& cb) override; | 53 void SetLostContextCallback(const LostContextCallback& cb) override; |
54 | 54 |
55 TestWebGraphicsContext3D* TestContext3d(); | 55 TestWebGraphicsContext3D* TestContext3d(); |
56 | 56 |
57 // This returns the TestWebGraphicsContext3D but is valid to call | 57 // This returns the TestWebGraphicsContext3D but is valid to call |
58 // before the context is bound to a thread. This is needed to set up | 58 // before the context is bound to a thread. This is needed to set up |
59 // state on the test context before binding. Don't call | 59 // state on the test context before binding. Don't call |
60 // InitializeOnCurrentThread on the context returned from this method. | 60 // InitializeOnCurrentThread on the context returned from this method. |
61 TestWebGraphicsContext3D* UnboundTestContext3d(); | 61 TestWebGraphicsContext3D* UnboundTestContext3d(); |
62 | 62 |
63 TestContextSupport* support() { return support_.get(); } | 63 TestContextSupport* support() { return support_.get(); } |
64 | 64 |
65 protected: | 65 protected: |
66 explicit TestContextProvider( | 66 explicit TestContextProvider( |
67 std::unique_ptr<TestContextSupport> support, | 67 std::unique_ptr<TestContextSupport> support, |
68 std::unique_ptr<TestGLES2Interface> gl, | 68 std::unique_ptr<TestGLES2Interface> gl, |
69 std::unique_ptr<TestWebGraphicsContext3D> context); | 69 std::unique_ptr<TestWebGraphicsContext3D> context); |
70 ~TestContextProvider() override; | 70 ~TestContextProvider() override; |
71 | 71 |
72 private: | 72 private: |
73 void OnLostContext(); | 73 void OnLostContext(); |
74 | 74 |
75 std::unique_ptr<TestContextSupport> support_; | 75 std::unique_ptr<TestContextSupport> support_; |
76 std::unique_ptr<TestWebGraphicsContext3D> context3d_; | 76 std::unique_ptr<TestWebGraphicsContext3D> context3d_; |
77 std::unique_ptr<TestGLES2Interface> context_gl_; | 77 std::unique_ptr<TestGLES2Interface> context_gl_; |
| 78 sk_sp<class GrContext> gr_context_; |
| 79 std::unique_ptr<ContextCacheController> cache_controller_; |
78 bool bound_ = false; | 80 bool bound_ = false; |
79 | 81 |
80 base::ThreadChecker main_thread_checker_; | 82 base::ThreadChecker main_thread_checker_; |
81 base::ThreadChecker context_thread_checker_; | 83 base::ThreadChecker context_thread_checker_; |
82 | 84 |
83 base::Lock context_lock_; | 85 base::Lock context_lock_; |
84 | 86 |
85 LostContextCallback lost_context_callback_; | 87 LostContextCallback lost_context_callback_; |
86 sk_sp<class GrContext> gr_context_; | |
87 | 88 |
88 base::WeakPtrFactory<TestContextProvider> weak_ptr_factory_; | 89 base::WeakPtrFactory<TestContextProvider> weak_ptr_factory_; |
89 | 90 |
90 DISALLOW_COPY_AND_ASSIGN(TestContextProvider); | 91 DISALLOW_COPY_AND_ASSIGN(TestContextProvider); |
91 }; | 92 }; |
92 | 93 |
93 } // namespace cc | 94 } // namespace cc |
94 | 95 |
95 #endif // CC_TEST_TEST_CONTEXT_PROVIDER_H_ | 96 #endif // CC_TEST_TEST_CONTEXT_PROVIDER_H_ |
96 | 97 |
OLD | NEW |