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

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

Issue 2208693003: Revert of cc: Make LayerTreeTests use a DelegatingRenderer and Display. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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_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 18 matching lines...) Expand all
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( 38 static scoped_refptr<TestContextProvider> Create(
39 std::unique_ptr<TestWebGraphicsContext3D> context,
40 std::unique_ptr<TestContextSupport> support);
41 static scoped_refptr<TestContextProvider> Create(
42 std::unique_ptr<TestGLES2Interface> gl); 39 std::unique_ptr<TestGLES2Interface> gl);
43 40
44 bool BindToCurrentThread() override; 41 bool BindToCurrentThread() override;
45 void DetachFromThread() override; 42 void DetachFromThread() override;
46 gpu::Capabilities ContextCapabilities() override; 43 gpu::Capabilities ContextCapabilities() override;
47 gpu::gles2::GLES2Interface* ContextGL() override; 44 gpu::gles2::GLES2Interface* ContextGL() override;
48 gpu::ContextSupport* ContextSupport() override; 45 gpu::ContextSupport* ContextSupport() override;
49 class GrContext* GrContext() override; 46 class GrContext* GrContext() override;
50 void InvalidateGrContext(uint32_t state) override; 47 void InvalidateGrContext(uint32_t state) override;
51 base::Lock* GetLock() override; 48 base::Lock* GetLock() override;
52 void DeleteCachedResources() override; 49 void DeleteCachedResources() override;
53 void SetLostContextCallback(const LostContextCallback& cb) override; 50 void SetLostContextCallback(const LostContextCallback& cb) override;
54 51
55 TestWebGraphicsContext3D* TestContext3d(); 52 TestWebGraphicsContext3D* TestContext3d();
56 53
57 // This returns the TestWebGraphicsContext3D but is valid to call 54 // This returns the TestWebGraphicsContext3D but is valid to call
58 // 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
59 // state on the test context before binding. Don't call 56 // state on the test context before binding. Don't call
60 // InitializeOnCurrentThread on the context returned from this method. 57 // InitializeOnCurrentThread on the context returned from this method.
61 TestWebGraphicsContext3D* UnboundTestContext3d(); 58 TestWebGraphicsContext3D* UnboundTestContext3d();
62 59
63 TestContextSupport* support() { return support_.get(); } 60 TestContextSupport* support() { return &support_; }
64 61
65 protected: 62 protected:
66 explicit TestContextProvider( 63 explicit TestContextProvider(
67 std::unique_ptr<TestContextSupport> support,
68 std::unique_ptr<TestGLES2Interface> gl, 64 std::unique_ptr<TestGLES2Interface> gl,
69 std::unique_ptr<TestWebGraphicsContext3D> context); 65 std::unique_ptr<TestWebGraphicsContext3D> context);
70 ~TestContextProvider() override; 66 ~TestContextProvider() override;
71 67
72 private: 68 private:
73 void OnLostContext(); 69 void OnLostContext();
74 70
75 std::unique_ptr<TestContextSupport> support_; 71 TestContextSupport support_;
72
76 std::unique_ptr<TestWebGraphicsContext3D> context3d_; 73 std::unique_ptr<TestWebGraphicsContext3D> context3d_;
77 std::unique_ptr<TestGLES2Interface> context_gl_; 74 std::unique_ptr<TestGLES2Interface> context_gl_;
78 bool bound_ = false; 75 bool bound_;
79 76
80 base::ThreadChecker main_thread_checker_; 77 base::ThreadChecker main_thread_checker_;
81 base::ThreadChecker context_thread_checker_; 78 base::ThreadChecker context_thread_checker_;
82 79
83 base::Lock context_lock_; 80 base::Lock context_lock_;
84 81
85 LostContextCallback lost_context_callback_; 82 LostContextCallback lost_context_callback_;
86 sk_sp<class GrContext> gr_context_; 83 sk_sp<class GrContext> gr_context_;
87 84
88 base::WeakPtrFactory<TestContextProvider> weak_ptr_factory_; 85 base::WeakPtrFactory<TestContextProvider> weak_ptr_factory_;
89 86
90 DISALLOW_COPY_AND_ASSIGN(TestContextProvider); 87 DISALLOW_COPY_AND_ASSIGN(TestContextProvider);
91 }; 88 };
92 89
93 } // namespace cc 90 } // namespace cc
94 91
95 #endif // CC_TEST_TEST_CONTEXT_PROVIDER_H_ 92 #endif // CC_TEST_TEST_CONTEXT_PROVIDER_H_
96 93
OLDNEW
« no previous file with comments | « cc/test/layer_tree_test.cc ('k') | cc/test/test_context_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698