| 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 24 matching lines...) Expand all Loading... |
| 35 void DetachFromThread() override; | 35 void DetachFromThread() override; |
| 36 Capabilities ContextCapabilities() override; | 36 Capabilities ContextCapabilities() override; |
| 37 gpu::gles2::GLES2Interface* ContextGL() override; | 37 gpu::gles2::GLES2Interface* ContextGL() override; |
| 38 gpu::ContextSupport* ContextSupport() override; | 38 gpu::ContextSupport* ContextSupport() override; |
| 39 class GrContext* GrContext() override; | 39 class GrContext* GrContext() override; |
| 40 void InvalidateGrContext(uint32_t state) override; | 40 void InvalidateGrContext(uint32_t state) override; |
| 41 void SetupLock() override; | 41 void SetupLock() override; |
| 42 base::Lock* GetLock() override; | 42 base::Lock* GetLock() override; |
| 43 void DeleteCachedResources() override; | 43 void DeleteCachedResources() override; |
| 44 void SetLostContextCallback(const LostContextCallback& cb) override; | 44 void SetLostContextCallback(const LostContextCallback& cb) override; |
| 45 void SetMemoryPolicyChangedCallback( |
| 46 const MemoryPolicyChangedCallback& cb) override; |
| 45 | 47 |
| 46 TestWebGraphicsContext3D* TestContext3d(); | 48 TestWebGraphicsContext3D* TestContext3d(); |
| 47 | 49 |
| 48 // This returns the TestWebGraphicsContext3D but is valid to call | 50 // This returns the TestWebGraphicsContext3D but is valid to call |
| 49 // before the context is bound to a thread. This is needed to set up | 51 // before the context is bound to a thread. This is needed to set up |
| 50 // state on the test context before binding. Don't call | 52 // state on the test context before binding. Don't call |
| 51 // InitializeOnCurrentThread on the context returned from this method. | 53 // InitializeOnCurrentThread on the context returned from this method. |
| 52 TestWebGraphicsContext3D* UnboundTestContext3d(); | 54 TestWebGraphicsContext3D* UnboundTestContext3d(); |
| 53 | 55 |
| 54 TestContextSupport* support() { return &support_; } | 56 TestContextSupport* support() { return &support_; } |
| 55 | 57 |
| 58 void SetMemoryAllocation(const ManagedMemoryPolicy& policy); |
| 59 |
| 56 void SetMaxTransferBufferUsageBytes(size_t max_transfer_buffer_usage_bytes); | 60 void SetMaxTransferBufferUsageBytes(size_t max_transfer_buffer_usage_bytes); |
| 57 | 61 |
| 58 protected: | 62 protected: |
| 59 explicit TestContextProvider(scoped_ptr<TestWebGraphicsContext3D> context); | 63 explicit TestContextProvider(scoped_ptr<TestWebGraphicsContext3D> context); |
| 60 ~TestContextProvider() override; | 64 ~TestContextProvider() override; |
| 61 | 65 |
| 62 private: | 66 private: |
| 63 void OnLostContext(); | 67 void OnLostContext(); |
| 64 | 68 |
| 65 TestContextSupport support_; | 69 TestContextSupport support_; |
| 66 | 70 |
| 67 scoped_ptr<TestWebGraphicsContext3D> context3d_; | 71 scoped_ptr<TestWebGraphicsContext3D> context3d_; |
| 68 scoped_ptr<TestGLES2Interface> context_gl_; | 72 scoped_ptr<TestGLES2Interface> context_gl_; |
| 69 bool bound_; | 73 bool bound_; |
| 70 | 74 |
| 71 base::ThreadChecker main_thread_checker_; | 75 base::ThreadChecker main_thread_checker_; |
| 72 base::ThreadChecker context_thread_checker_; | 76 base::ThreadChecker context_thread_checker_; |
| 73 | 77 |
| 74 base::Lock context_lock_; | 78 base::Lock context_lock_; |
| 75 | 79 |
| 76 LostContextCallback lost_context_callback_; | 80 LostContextCallback lost_context_callback_; |
| 81 MemoryPolicyChangedCallback memory_policy_changed_callback_; |
| 77 skia::RefPtr<class GrContext> gr_context_; | 82 skia::RefPtr<class GrContext> gr_context_; |
| 78 | 83 |
| 79 base::WeakPtrFactory<TestContextProvider> weak_ptr_factory_; | 84 base::WeakPtrFactory<TestContextProvider> weak_ptr_factory_; |
| 80 | 85 |
| 81 DISALLOW_COPY_AND_ASSIGN(TestContextProvider); | 86 DISALLOW_COPY_AND_ASSIGN(TestContextProvider); |
| 82 }; | 87 }; |
| 83 | 88 |
| 84 } // namespace cc | 89 } // namespace cc |
| 85 | 90 |
| 86 #endif // CC_TEST_TEST_CONTEXT_PROVIDER_H_ | 91 #endif // CC_TEST_TEST_CONTEXT_PROVIDER_H_ |
| 87 | 92 |
| OLD | NEW |