Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: cc/test/test_context_provider.h

Issue 2278283003: Refactor client visibility handling (Closed)
Patch Set: feedback Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 21 matching lines...) Expand all
32 static scoped_refptr<TestContextProvider> Create(); 32 static scoped_refptr<TestContextProvider> Create();
33 // Creates a worker context provider that can be used on any thread. This is 33 // Creates a worker context provider that can be used on any thread. This is
34 // equivalent to: Create(); BindToCurrentThread(). 34 // equivalent to: Create(); BindToCurrentThread().
35 static scoped_refptr<TestContextProvider> CreateWorker(); 35 static scoped_refptr<TestContextProvider> CreateWorker();
36 static scoped_refptr<TestContextProvider> Create( 36 static scoped_refptr<TestContextProvider> Create(
37 std::unique_ptr<TestWebGraphicsContext3D> context); 37 std::unique_ptr<TestWebGraphicsContext3D> context);
38 static scoped_refptr<TestContextProvider> Create( 38 static scoped_refptr<TestContextProvider> Create(
39 std::unique_ptr<TestWebGraphicsContext3D> context, 39 std::unique_ptr<TestWebGraphicsContext3D> context,
40 std::unique_ptr<TestContextSupport> support); 40 std::unique_ptr<TestContextSupport> support);
41 static scoped_refptr<TestContextProvider> Create( 41 static scoped_refptr<TestContextProvider> Create(
42 std::unique_ptr<TestWebGraphicsContext3D> context,
43 std::unique_ptr<TestContextSupport> support,
44 std::unique_ptr<ContextCacheController> cache_controller);
45 static scoped_refptr<TestContextProvider> Create(
42 std::unique_ptr<TestGLES2Interface> gl); 46 std::unique_ptr<TestGLES2Interface> gl);
43 47
44 bool BindToCurrentThread() override; 48 bool BindToCurrentThread() override;
45 void DetachFromThread() override; 49 void DetachFromThread() override;
46 gpu::Capabilities ContextCapabilities() override; 50 gpu::Capabilities ContextCapabilities() override;
47 gpu::gles2::GLES2Interface* ContextGL() override; 51 gpu::gles2::GLES2Interface* ContextGL() override;
48 gpu::ContextSupport* ContextSupport() override; 52 gpu::ContextSupport* ContextSupport() override;
49 class GrContext* GrContext() override; 53 class GrContext* GrContext() override;
54 ContextCacheController* CacheController() override;
50 void InvalidateGrContext(uint32_t state) override; 55 void InvalidateGrContext(uint32_t state) override;
51 base::Lock* GetLock() override; 56 base::Lock* GetLock() override;
52 void DeleteCachedResources() override;
53 void SetLostContextCallback(const LostContextCallback& cb) override; 57 void SetLostContextCallback(const LostContextCallback& cb) override;
54 58
55 TestWebGraphicsContext3D* TestContext3d(); 59 TestWebGraphicsContext3D* TestContext3d();
56 60
57 // This returns the TestWebGraphicsContext3D but is valid to call 61 // This returns the TestWebGraphicsContext3D but is valid to call
58 // before the context is bound to a thread. This is needed to set up 62 // before the context is bound to a thread. This is needed to set up
59 // state on the test context before binding. Don't call 63 // state on the test context before binding. Don't call
60 // InitializeOnCurrentThread on the context returned from this method. 64 // InitializeOnCurrentThread on the context returned from this method.
61 TestWebGraphicsContext3D* UnboundTestContext3d(); 65 TestWebGraphicsContext3D* UnboundTestContext3d();
62 66
63 TestContextSupport* support() { return support_.get(); } 67 TestContextSupport* support() { return support_.get(); }
64 68
65 protected: 69 protected:
66 explicit TestContextProvider( 70 explicit TestContextProvider(
67 std::unique_ptr<TestContextSupport> support, 71 std::unique_ptr<TestContextSupport> support,
68 std::unique_ptr<TestGLES2Interface> gl, 72 std::unique_ptr<TestGLES2Interface> gl,
69 std::unique_ptr<TestWebGraphicsContext3D> context); 73 std::unique_ptr<TestWebGraphicsContext3D> context,
74 std::unique_ptr<ContextCacheController> cache_controller);
70 ~TestContextProvider() override; 75 ~TestContextProvider() override;
71 76
72 private: 77 private:
73 void OnLostContext(); 78 void OnLostContext();
74 79
75 std::unique_ptr<TestContextSupport> support_; 80 std::unique_ptr<TestContextSupport> support_;
76 std::unique_ptr<TestWebGraphicsContext3D> context3d_; 81 std::unique_ptr<TestWebGraphicsContext3D> context3d_;
77 std::unique_ptr<TestGLES2Interface> context_gl_; 82 std::unique_ptr<TestGLES2Interface> context_gl_;
83 sk_sp<class GrContext> gr_context_;
84 std::unique_ptr<ContextCacheController> cache_controller_;
78 bool bound_ = false; 85 bool bound_ = false;
79 86
80 base::ThreadChecker main_thread_checker_; 87 base::ThreadChecker main_thread_checker_;
81 base::ThreadChecker context_thread_checker_; 88 base::ThreadChecker context_thread_checker_;
82 89
83 base::Lock context_lock_; 90 base::Lock context_lock_;
84 91
85 LostContextCallback lost_context_callback_; 92 LostContextCallback lost_context_callback_;
86 sk_sp<class GrContext> gr_context_;
87 93
88 base::WeakPtrFactory<TestContextProvider> weak_ptr_factory_; 94 base::WeakPtrFactory<TestContextProvider> weak_ptr_factory_;
89 95
90 DISALLOW_COPY_AND_ASSIGN(TestContextProvider); 96 DISALLOW_COPY_AND_ASSIGN(TestContextProvider);
91 }; 97 };
92 98
93 } // namespace cc 99 } // namespace cc
94 100
95 #endif // CC_TEST_TEST_CONTEXT_PROVIDER_H_ 101 #endif // CC_TEST_TEST_CONTEXT_PROVIDER_H_
96 102
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698