| 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_DEBUG_TEST_CONTEXT_PROVIDER_H_ | 5 #ifndef CC_TEST_TEST_CONTEXT_PROVIDER_H_ |
| 6 #define CC_DEBUG_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/base/cc_export.h" | |
| 13 #include "cc/debug/test_context_support.h" | |
| 14 #include "cc/output/context_provider.h" | 12 #include "cc/output/context_provider.h" |
| 13 #include "cc/test/test_context_support.h" |
| 15 | 14 |
| 16 namespace WebKit { class WebGraphicsContext3D; } | 15 namespace WebKit { class WebGraphicsContext3D; } |
| 17 | 16 |
| 18 namespace cc { | 17 namespace cc { |
| 19 class TestWebGraphicsContext3D; | 18 class TestWebGraphicsContext3D; |
| 20 | 19 |
| 21 class CC_EXPORT TestContextProvider | 20 class TestContextProvider : public cc::ContextProvider { |
| 22 : public NON_EXPORTED_BASE(cc::ContextProvider) { | |
| 23 public: | 21 public: |
| 24 typedef base::Callback<scoped_ptr<TestWebGraphicsContext3D>(void)> | 22 typedef base::Callback<scoped_ptr<TestWebGraphicsContext3D>(void)> |
| 25 CreateCallback; | 23 CreateCallback; |
| 26 | 24 |
| 27 static scoped_refptr<TestContextProvider> Create(); | 25 static scoped_refptr<TestContextProvider> Create(); |
| 28 static scoped_refptr<TestContextProvider> Create( | 26 static scoped_refptr<TestContextProvider> Create( |
| 29 scoped_ptr<TestWebGraphicsContext3D> context); | 27 scoped_ptr<TestWebGraphicsContext3D> context); |
| 30 | 28 |
| 31 virtual bool BindToCurrentThread() OVERRIDE; | 29 virtual bool BindToCurrentThread() OVERRIDE; |
| 32 virtual Capabilities ContextCapabilities() OVERRIDE; | 30 virtual Capabilities ContextCapabilities() OVERRIDE; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 48 // state on the test context before binding. Don't call | 46 // state on the test context before binding. Don't call |
| 49 // makeContextCurrent on the context returned from this method. | 47 // makeContextCurrent on the context returned from this method. |
| 50 TestWebGraphicsContext3D* UnboundTestContext3d(); | 48 TestWebGraphicsContext3D* UnboundTestContext3d(); |
| 51 | 49 |
| 52 void SetMemoryAllocation(const ManagedMemoryPolicy& policy, | 50 void SetMemoryAllocation(const ManagedMemoryPolicy& policy, |
| 53 bool discard_backbuffer_when_not_visible); | 51 bool discard_backbuffer_when_not_visible); |
| 54 | 52 |
| 55 void SetMaxTransferBufferUsageBytes(size_t max_transfer_buffer_usage_bytes); | 53 void SetMaxTransferBufferUsageBytes(size_t max_transfer_buffer_usage_bytes); |
| 56 | 54 |
| 57 protected: | 55 protected: |
| 58 TestContextProvider(scoped_ptr<TestWebGraphicsContext3D> context); | 56 explicit TestContextProvider(scoped_ptr<TestWebGraphicsContext3D> context); |
| 59 virtual ~TestContextProvider(); | 57 virtual ~TestContextProvider(); |
| 60 | 58 |
| 61 void OnLostContext(); | 59 void OnLostContext(); |
| 62 void OnSwapBuffersComplete(); | 60 void OnSwapBuffersComplete(); |
| 63 | 61 |
| 64 TestContextSupport support_; | 62 TestContextSupport support_; |
| 65 | 63 |
| 66 scoped_ptr<TestWebGraphicsContext3D> context3d_; | 64 scoped_ptr<TestWebGraphicsContext3D> context3d_; |
| 67 bool bound_; | 65 bool bound_; |
| 68 | 66 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 79 class LostContextCallbackProxy; | 77 class LostContextCallbackProxy; |
| 80 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; | 78 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; |
| 81 | 79 |
| 82 class SwapBuffersCompleteCallbackProxy; | 80 class SwapBuffersCompleteCallbackProxy; |
| 83 scoped_ptr<SwapBuffersCompleteCallbackProxy> | 81 scoped_ptr<SwapBuffersCompleteCallbackProxy> |
| 84 swap_buffers_complete_callback_proxy_; | 82 swap_buffers_complete_callback_proxy_; |
| 85 }; | 83 }; |
| 86 | 84 |
| 87 } // namespace cc | 85 } // namespace cc |
| 88 | 86 |
| 89 #endif // CC_DEBUG_TEST_CONTEXT_PROVIDER_H_ | 87 #endif // CC_TEST_TEST_CONTEXT_PROVIDER_H_ |
| 90 | 88 |
| OLD | NEW |