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

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

Issue 2161323002: cc: Make LayerTreeHostImpl unittests use a delegating output surface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: display-lthi-tests: . Created 4 years, 5 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
« no previous file with comments | « cc/test/layer_tree_pixel_test.cc ('k') | cc/test/test_context_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 17 matching lines...) Expand all
28 public: 28 public:
29 typedef base::Callback<std::unique_ptr<TestWebGraphicsContext3D>(void)> 29 typedef base::Callback<std::unique_ptr<TestWebGraphicsContext3D>(void)>
30 CreateCallback; 30 CreateCallback;
31 31
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(
39 std::unique_ptr<TestGLES2Interface> gl);
38 40
39 bool BindToCurrentThread() override; 41 bool BindToCurrentThread() override;
40 void DetachFromThread() override; 42 void DetachFromThread() override;
41 gpu::Capabilities ContextCapabilities() override; 43 gpu::Capabilities ContextCapabilities() override;
42 gpu::gles2::GLES2Interface* ContextGL() override; 44 gpu::gles2::GLES2Interface* ContextGL() override;
43 gpu::ContextSupport* ContextSupport() override; 45 gpu::ContextSupport* ContextSupport() override;
44 class GrContext* GrContext() override; 46 class GrContext* GrContext() override;
45 void InvalidateGrContext(uint32_t state) override; 47 void InvalidateGrContext(uint32_t state) override;
46 base::Lock* GetLock() override; 48 base::Lock* GetLock() override;
47 void DeleteCachedResources() override; 49 void DeleteCachedResources() override;
48 void SetLostContextCallback(const LostContextCallback& cb) override; 50 void SetLostContextCallback(const LostContextCallback& cb) override;
49 51
50 TestWebGraphicsContext3D* TestContext3d(); 52 TestWebGraphicsContext3D* TestContext3d();
51 53
52 // This returns the TestWebGraphicsContext3D but is valid to call 54 // This returns the TestWebGraphicsContext3D but is valid to call
53 // before the context is bound to a thread. This is needed to set up 55 // before the context is bound to a thread. This is needed to set up
54 // state on the test context before binding. Don't call 56 // state on the test context before binding. Don't call
55 // InitializeOnCurrentThread on the context returned from this method. 57 // InitializeOnCurrentThread on the context returned from this method.
56 TestWebGraphicsContext3D* UnboundTestContext3d(); 58 TestWebGraphicsContext3D* UnboundTestContext3d();
57 59
58 TestContextSupport* support() { return &support_; } 60 TestContextSupport* support() { return &support_; }
59 61
60 protected: 62 protected:
61 explicit TestContextProvider( 63 explicit TestContextProvider(
64 std::unique_ptr<TestGLES2Interface> gl,
62 std::unique_ptr<TestWebGraphicsContext3D> context); 65 std::unique_ptr<TestWebGraphicsContext3D> context);
63 ~TestContextProvider() override; 66 ~TestContextProvider() override;
64 67
65 private: 68 private:
66 void OnLostContext(); 69 void OnLostContext();
67 70
68 TestContextSupport support_; 71 TestContextSupport support_;
69 72
70 std::unique_ptr<TestWebGraphicsContext3D> context3d_; 73 std::unique_ptr<TestWebGraphicsContext3D> context3d_;
71 std::unique_ptr<TestGLES2Interface> context_gl_; 74 std::unique_ptr<TestGLES2Interface> context_gl_;
72 bool bound_; 75 bool bound_;
73 76
74 base::ThreadChecker main_thread_checker_; 77 base::ThreadChecker main_thread_checker_;
75 base::ThreadChecker context_thread_checker_; 78 base::ThreadChecker context_thread_checker_;
76 79
77 base::Lock context_lock_; 80 base::Lock context_lock_;
78 81
79 LostContextCallback lost_context_callback_; 82 LostContextCallback lost_context_callback_;
80 sk_sp<class GrContext> gr_context_; 83 sk_sp<class GrContext> gr_context_;
81 84
82 base::WeakPtrFactory<TestContextProvider> weak_ptr_factory_; 85 base::WeakPtrFactory<TestContextProvider> weak_ptr_factory_;
83 86
84 DISALLOW_COPY_AND_ASSIGN(TestContextProvider); 87 DISALLOW_COPY_AND_ASSIGN(TestContextProvider);
85 }; 88 };
86 89
87 } // namespace cc 90 } // namespace cc
88 91
89 #endif // CC_TEST_TEST_CONTEXT_PROVIDER_H_ 92 #endif // CC_TEST_TEST_CONTEXT_PROVIDER_H_
90 93
OLDNEW
« no previous file with comments | « cc/test/layer_tree_pixel_test.cc ('k') | cc/test/test_context_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698