| 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/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| 11 #include "base/threading/thread_checker.h" | 11 #include "base/threading/thread_checker.h" |
| 12 #include "cc/output/context_provider.h" | 12 #include "cc/output/context_provider.h" |
| 13 #include "cc/test/test_context_support.h" | 13 #include "cc/test/test_context_support.h" |
| 14 #include "gpu/command_buffer/client/gles2_interface_stub.h" |
| 14 | 15 |
| 15 namespace blink { class WebGraphicsContext3D; } | 16 namespace blink { class WebGraphicsContext3D; } |
| 16 | 17 |
| 17 namespace cc { | 18 namespace cc { |
| 18 class TestWebGraphicsContext3D; | 19 class TestWebGraphicsContext3D; |
| 19 | 20 |
| 20 class TestContextProvider : public cc::ContextProvider { | 21 class TestContextProvider : public cc::ContextProvider { |
| 21 public: | 22 public: |
| 22 typedef base::Callback<scoped_ptr<TestWebGraphicsContext3D>(void)> | 23 typedef base::Callback<scoped_ptr<TestWebGraphicsContext3D>(void)> |
| 23 CreateCallback; | 24 CreateCallback; |
| 24 | 25 |
| 25 static scoped_refptr<TestContextProvider> Create(); | 26 static scoped_refptr<TestContextProvider> Create(); |
| 26 static scoped_refptr<TestContextProvider> Create( | 27 static scoped_refptr<TestContextProvider> Create( |
| 27 scoped_ptr<TestWebGraphicsContext3D> context); | 28 scoped_ptr<TestWebGraphicsContext3D> context); |
| 28 | 29 |
| 29 virtual bool BindToCurrentThread() OVERRIDE; | 30 virtual bool BindToCurrentThread() OVERRIDE; |
| 30 virtual Capabilities ContextCapabilities() OVERRIDE; | 31 virtual Capabilities ContextCapabilities() OVERRIDE; |
| 31 virtual blink::WebGraphicsContext3D* Context3d() OVERRIDE; | 32 virtual blink::WebGraphicsContext3D* Context3d() OVERRIDE; |
| 33 virtual gpu::gles2::GLES2Interface* ContextGL() OVERRIDE; |
| 32 virtual gpu::ContextSupport* ContextSupport() OVERRIDE; | 34 virtual gpu::ContextSupport* ContextSupport() OVERRIDE; |
| 33 virtual class GrContext* GrContext() OVERRIDE; | 35 virtual class GrContext* GrContext() OVERRIDE; |
| 34 virtual bool IsContextLost() OVERRIDE; | 36 virtual bool IsContextLost() OVERRIDE; |
| 35 virtual void VerifyContexts() OVERRIDE; | 37 virtual void VerifyContexts() OVERRIDE; |
| 36 virtual bool DestroyedOnMainThread() OVERRIDE; | 38 virtual bool DestroyedOnMainThread() OVERRIDE; |
| 37 virtual void SetLostContextCallback(const LostContextCallback& cb) OVERRIDE; | 39 virtual void SetLostContextCallback(const LostContextCallback& cb) OVERRIDE; |
| 38 virtual void SetSwapBuffersCompleteCallback( | 40 virtual void SetSwapBuffersCompleteCallback( |
| 39 const SwapBuffersCompleteCallback& cb) OVERRIDE; | 41 const SwapBuffersCompleteCallback& cb) OVERRIDE; |
| 40 virtual void SetMemoryPolicyChangedCallback( | 42 virtual void SetMemoryPolicyChangedCallback( |
| 41 const MemoryPolicyChangedCallback& cb) OVERRIDE; | 43 const MemoryPolicyChangedCallback& cb) OVERRIDE; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 55 protected: | 57 protected: |
| 56 explicit TestContextProvider(scoped_ptr<TestWebGraphicsContext3D> context); | 58 explicit TestContextProvider(scoped_ptr<TestWebGraphicsContext3D> context); |
| 57 virtual ~TestContextProvider(); | 59 virtual ~TestContextProvider(); |
| 58 | 60 |
| 59 void OnLostContext(); | 61 void OnLostContext(); |
| 60 void OnSwapBuffersComplete(); | 62 void OnSwapBuffersComplete(); |
| 61 | 63 |
| 62 TestContextSupport support_; | 64 TestContextSupport support_; |
| 63 | 65 |
| 64 scoped_ptr<TestWebGraphicsContext3D> context3d_; | 66 scoped_ptr<TestWebGraphicsContext3D> context3d_; |
| 67 gpu::gles2::GLES2InterfaceStub context_gl_stub_; |
| 65 bool bound_; | 68 bool bound_; |
| 66 | 69 |
| 67 base::ThreadChecker main_thread_checker_; | 70 base::ThreadChecker main_thread_checker_; |
| 68 base::ThreadChecker context_thread_checker_; | 71 base::ThreadChecker context_thread_checker_; |
| 69 | 72 |
| 70 base::Lock destroyed_lock_; | 73 base::Lock destroyed_lock_; |
| 71 bool destroyed_; | 74 bool destroyed_; |
| 72 | 75 |
| 73 LostContextCallback lost_context_callback_; | 76 LostContextCallback lost_context_callback_; |
| 74 SwapBuffersCompleteCallback swap_buffers_complete_callback_; | 77 SwapBuffersCompleteCallback swap_buffers_complete_callback_; |
| 75 MemoryPolicyChangedCallback memory_policy_changed_callback_; | 78 MemoryPolicyChangedCallback memory_policy_changed_callback_; |
| 76 | 79 |
| 77 class LostContextCallbackProxy; | 80 class LostContextCallbackProxy; |
| 78 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; | 81 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; |
| 79 | 82 |
| 80 class SwapBuffersCompleteCallbackProxy; | 83 class SwapBuffersCompleteCallbackProxy; |
| 81 scoped_ptr<SwapBuffersCompleteCallbackProxy> | 84 scoped_ptr<SwapBuffersCompleteCallbackProxy> |
| 82 swap_buffers_complete_callback_proxy_; | 85 swap_buffers_complete_callback_proxy_; |
| 83 }; | 86 }; |
| 84 | 87 |
| 85 } // namespace cc | 88 } // namespace cc |
| 86 | 89 |
| 87 #endif // CC_TEST_TEST_CONTEXT_PROVIDER_H_ | 90 #endif // CC_TEST_TEST_CONTEXT_PROVIDER_H_ |
| 88 | 91 |
| OLD | NEW |