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 "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class TestContextProvider : public ContextProvider { | 22 class TestContextProvider : public ContextProvider { |
23 public: | 23 public: |
24 typedef base::Callback<scoped_ptr<TestWebGraphicsContext3D>(void)> | 24 typedef base::Callback<scoped_ptr<TestWebGraphicsContext3D>(void)> |
25 CreateCallback; | 25 CreateCallback; |
26 | 26 |
27 static scoped_refptr<TestContextProvider> Create(); | 27 static scoped_refptr<TestContextProvider> Create(); |
28 static scoped_refptr<TestContextProvider> Create( | 28 static scoped_refptr<TestContextProvider> Create( |
29 scoped_ptr<TestWebGraphicsContext3D> context); | 29 scoped_ptr<TestWebGraphicsContext3D> context); |
30 | 30 |
31 bool BindToCurrentThread() override; | 31 bool BindToCurrentThread() override; |
| 32 void DetachFromThread() override; |
32 Capabilities ContextCapabilities() override; | 33 Capabilities ContextCapabilities() override; |
33 gpu::gles2::GLES2Interface* ContextGL() override; | 34 gpu::gles2::GLES2Interface* ContextGL() override; |
34 gpu::ContextSupport* ContextSupport() override; | 35 gpu::ContextSupport* ContextSupport() override; |
35 class GrContext* GrContext() override; | 36 class GrContext* GrContext() override; |
| 37 void SetupLock() override; |
| 38 base::Lock* GetLock() override; |
36 bool IsContextLost() override; | 39 bool IsContextLost() override; |
37 void VerifyContexts() override; | 40 void VerifyContexts() override; |
38 void DeleteCachedResources() override; | 41 void DeleteCachedResources() override; |
39 bool DestroyedOnMainThread() override; | 42 bool DestroyedOnMainThread() override; |
40 void SetLostContextCallback(const LostContextCallback& cb) override; | 43 void SetLostContextCallback(const LostContextCallback& cb) override; |
41 void SetMemoryPolicyChangedCallback( | 44 void SetMemoryPolicyChangedCallback( |
42 const MemoryPolicyChangedCallback& cb) override; | 45 const MemoryPolicyChangedCallback& cb) override; |
43 | 46 |
44 TestWebGraphicsContext3D* TestContext3d(); | 47 TestWebGraphicsContext3D* TestContext3d(); |
45 | 48 |
(...skipping 21 matching lines...) Expand all Loading... |
67 scoped_ptr<TestWebGraphicsContext3D> context3d_; | 70 scoped_ptr<TestWebGraphicsContext3D> context3d_; |
68 scoped_ptr<TestGLES2Interface> context_gl_; | 71 scoped_ptr<TestGLES2Interface> context_gl_; |
69 bool bound_; | 72 bool bound_; |
70 | 73 |
71 base::ThreadChecker main_thread_checker_; | 74 base::ThreadChecker main_thread_checker_; |
72 base::ThreadChecker context_thread_checker_; | 75 base::ThreadChecker context_thread_checker_; |
73 | 76 |
74 base::Lock destroyed_lock_; | 77 base::Lock destroyed_lock_; |
75 bool destroyed_; | 78 bool destroyed_; |
76 | 79 |
| 80 base::Lock context_lock_; |
| 81 |
77 LostContextCallback lost_context_callback_; | 82 LostContextCallback lost_context_callback_; |
78 MemoryPolicyChangedCallback memory_policy_changed_callback_; | 83 MemoryPolicyChangedCallback memory_policy_changed_callback_; |
79 skia::RefPtr<class GrContext> gr_context_; | 84 skia::RefPtr<class GrContext> gr_context_; |
80 | 85 |
81 base::WeakPtrFactory<TestContextProvider> weak_ptr_factory_; | 86 base::WeakPtrFactory<TestContextProvider> weak_ptr_factory_; |
82 | 87 |
83 DISALLOW_COPY_AND_ASSIGN(TestContextProvider); | 88 DISALLOW_COPY_AND_ASSIGN(TestContextProvider); |
84 }; | 89 }; |
85 | 90 |
86 } // namespace cc | 91 } // namespace cc |
87 | 92 |
88 #endif // CC_TEST_TEST_CONTEXT_PROVIDER_H_ | 93 #endif // CC_TEST_TEST_CONTEXT_PROVIDER_H_ |
89 | 94 |
OLD | NEW |