| 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" |
| 11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
| 12 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
| 13 #include "cc/output/context_provider.h" | 13 #include "cc/output/context_provider.h" |
| 14 #include "cc/test/test_context_support.h" | 14 #include "cc/test/test_context_support.h" |
| 15 #include "gpu/command_buffer/client/gles2_interface_stub.h" | 15 #include "gpu/command_buffer/client/gles2_interface_stub.h" |
| 16 #include "skia/ext/refptr.h" | 16 #include "skia/ext/refptr.h" |
| 17 #include "third_party/skia/include/gpu/gl/SkGLContext.h" |
| 17 | 18 |
| 18 namespace cc { | 19 namespace cc { |
| 19 class TestWebGraphicsContext3D; | 20 class TestWebGraphicsContext3D; |
| 20 class TestGLES2Interface; | 21 class TestGLES2Interface; |
| 21 | 22 |
| 22 class TestContextProvider : public ContextProvider { | 23 class TestContextProvider : public ContextProvider { |
| 23 public: | 24 public: |
| 24 typedef base::Callback<scoped_ptr<TestWebGraphicsContext3D>(void)> | 25 typedef base::Callback<scoped_ptr<TestWebGraphicsContext3D>(void)> |
| 25 CreateCallback; | 26 CreateCallback; |
| 26 | 27 |
| 27 static scoped_refptr<TestContextProvider> Create(); | 28 static scoped_refptr<TestContextProvider> Create(); |
| 28 static scoped_refptr<TestContextProvider> Create( | 29 static scoped_refptr<TestContextProvider> Create( |
| 29 scoped_ptr<TestWebGraphicsContext3D> context); | 30 scoped_ptr<TestWebGraphicsContext3D> context); |
| 30 | 31 |
| 31 bool BindToCurrentThread() override; | 32 bool BindToCurrentThread() override; |
| 33 void DetachFromThread() override; |
| 32 Capabilities ContextCapabilities() override; | 34 Capabilities ContextCapabilities() override; |
| 33 gpu::gles2::GLES2Interface* ContextGL() override; | 35 gpu::gles2::GLES2Interface* ContextGL() override; |
| 34 gpu::ContextSupport* ContextSupport() override; | 36 gpu::ContextSupport* ContextSupport() override; |
| 35 class GrContext* GrContext() override; | 37 class GrContext* GrContext() override; |
| 36 bool IsContextLost() override; | 38 bool IsContextLost() override; |
| 37 void VerifyContexts() override; | 39 void VerifyContexts() override; |
| 38 void DeleteCachedResources() override; | 40 void DeleteCachedResources() override; |
| 39 bool DestroyedOnMainThread() override; | 41 bool DestroyedOnMainThread() override; |
| 40 void SetLostContextCallback(const LostContextCallback& cb) override; | 42 void SetLostContextCallback(const LostContextCallback& cb) override; |
| 41 void SetMemoryPolicyChangedCallback( | 43 void SetMemoryPolicyChangedCallback( |
| (...skipping 27 matching lines...) Expand all Loading... |
| 69 bool bound_; | 71 bool bound_; |
| 70 | 72 |
| 71 base::ThreadChecker main_thread_checker_; | 73 base::ThreadChecker main_thread_checker_; |
| 72 base::ThreadChecker context_thread_checker_; | 74 base::ThreadChecker context_thread_checker_; |
| 73 | 75 |
| 74 base::Lock destroyed_lock_; | 76 base::Lock destroyed_lock_; |
| 75 bool destroyed_; | 77 bool destroyed_; |
| 76 | 78 |
| 77 LostContextCallback lost_context_callback_; | 79 LostContextCallback lost_context_callback_; |
| 78 MemoryPolicyChangedCallback memory_policy_changed_callback_; | 80 MemoryPolicyChangedCallback memory_policy_changed_callback_; |
| 81 skia::RefPtr<class SkGLContext> gl_context_; |
| 79 skia::RefPtr<class GrContext> gr_context_; | 82 skia::RefPtr<class GrContext> gr_context_; |
| 80 | 83 |
| 81 base::WeakPtrFactory<TestContextProvider> weak_ptr_factory_; | 84 base::WeakPtrFactory<TestContextProvider> weak_ptr_factory_; |
| 82 | 85 |
| 83 DISALLOW_COPY_AND_ASSIGN(TestContextProvider); | 86 DISALLOW_COPY_AND_ASSIGN(TestContextProvider); |
| 84 }; | 87 }; |
| 85 | 88 |
| 86 } // namespace cc | 89 } // namespace cc |
| 87 | 90 |
| 88 #endif // CC_TEST_TEST_CONTEXT_PROVIDER_H_ | 91 #endif // CC_TEST_TEST_CONTEXT_PROVIDER_H_ |
| 89 | 92 |
| OLD | NEW |