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 20 matching lines...) Expand all Loading... |
31 | 31 |
32 static scoped_refptr<TestContextProvider> Create(); | 32 static scoped_refptr<TestContextProvider> Create(); |
33 // Creates a worker context provider that can be used on any thread. This is | 33 // Creates a worker context provider that can be used on any thread. This is |
34 // equivalent to: Create(); BindToCurrentThread(); SetupLock(). | 34 // equivalent to: Create(); BindToCurrentThread(); SetupLock(). |
35 static scoped_refptr<TestContextProvider> CreateWorker(); | 35 static scoped_refptr<TestContextProvider> CreateWorker(); |
36 static scoped_refptr<TestContextProvider> Create( | 36 static scoped_refptr<TestContextProvider> Create( |
37 std::unique_ptr<TestWebGraphicsContext3D> context); | 37 std::unique_ptr<TestWebGraphicsContext3D> context); |
38 | 38 |
39 bool BindToCurrentThread() override; | 39 bool BindToCurrentThread() override; |
40 void DetachFromThread() override; | 40 void DetachFromThread() override; |
41 Capabilities ContextCapabilities() override; | 41 gpu::Capabilities ContextCapabilities() override; |
42 gpu::gles2::GLES2Interface* ContextGL() override; | 42 gpu::gles2::GLES2Interface* ContextGL() override; |
43 gpu::ContextSupport* ContextSupport() override; | 43 gpu::ContextSupport* ContextSupport() override; |
44 class GrContext* GrContext() override; | 44 class GrContext* GrContext() override; |
45 void InvalidateGrContext(uint32_t state) override; | 45 void InvalidateGrContext(uint32_t state) override; |
46 void SetupLock() override; | 46 void SetupLock() override; |
47 base::Lock* GetLock() override; | 47 base::Lock* GetLock() override; |
48 void DeleteCachedResources() override; | 48 void DeleteCachedResources() override; |
49 void SetLostContextCallback(const LostContextCallback& cb) override; | 49 void SetLostContextCallback(const LostContextCallback& cb) override; |
50 | 50 |
51 TestWebGraphicsContext3D* TestContext3d(); | 51 TestWebGraphicsContext3D* TestContext3d(); |
52 | 52 |
53 // This returns the TestWebGraphicsContext3D but is valid to call | 53 // This returns the TestWebGraphicsContext3D but is valid to call |
54 // before the context is bound to a thread. This is needed to set up | 54 // before the context is bound to a thread. This is needed to set up |
55 // state on the test context before binding. Don't call | 55 // state on the test context before binding. Don't call |
56 // InitializeOnCurrentThread on the context returned from this method. | 56 // InitializeOnCurrentThread on the context returned from this method. |
57 TestWebGraphicsContext3D* UnboundTestContext3d(); | 57 TestWebGraphicsContext3D* UnboundTestContext3d(); |
58 | 58 |
59 TestContextSupport* support() { return &support_; } | 59 TestContextSupport* support() { return &support_; } |
60 | 60 |
61 void SetMaxTransferBufferUsageBytes(size_t max_transfer_buffer_usage_bytes); | |
62 | |
63 protected: | 61 protected: |
64 explicit TestContextProvider( | 62 explicit TestContextProvider( |
65 std::unique_ptr<TestWebGraphicsContext3D> context); | 63 std::unique_ptr<TestWebGraphicsContext3D> context); |
66 ~TestContextProvider() override; | 64 ~TestContextProvider() override; |
67 | 65 |
68 private: | 66 private: |
69 void OnLostContext(); | 67 void OnLostContext(); |
70 | 68 |
71 TestContextSupport support_; | 69 TestContextSupport support_; |
72 | 70 |
(...skipping 11 matching lines...) Expand all Loading... |
84 | 82 |
85 base::WeakPtrFactory<TestContextProvider> weak_ptr_factory_; | 83 base::WeakPtrFactory<TestContextProvider> weak_ptr_factory_; |
86 | 84 |
87 DISALLOW_COPY_AND_ASSIGN(TestContextProvider); | 85 DISALLOW_COPY_AND_ASSIGN(TestContextProvider); |
88 }; | 86 }; |
89 | 87 |
90 } // namespace cc | 88 } // namespace cc |
91 | 89 |
92 #endif // CC_TEST_TEST_CONTEXT_PROVIDER_H_ | 90 #endif // CC_TEST_TEST_CONTEXT_PROVIDER_H_ |
93 | 91 |
OLD | NEW |