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

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

Issue 2171143002: cc: Get rid of non-delegated rendering in most cc unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@killdirecttests
Patch Set: fakeoutputsurface: no-constructor 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/fake_layer_tree_host_client.cc ('k') | cc/test/fake_output_surface.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_FAKE_OUTPUT_SURFACE_H_ 5 #ifndef CC_TEST_FAKE_OUTPUT_SURFACE_H_
6 #define CC_TEST_FAKE_OUTPUT_SURFACE_H_ 6 #define CC_TEST_FAKE_OUTPUT_SURFACE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 10 matching lines...) Expand all
21 #include "cc/test/test_web_graphics_context_3d.h" 21 #include "cc/test/test_web_graphics_context_3d.h"
22 22
23 namespace cc { 23 namespace cc {
24 24
25 class FakeOutputSurface : public OutputSurface { 25 class FakeOutputSurface : public OutputSurface {
26 public: 26 public:
27 ~FakeOutputSurface() override; 27 ~FakeOutputSurface() override;
28 28
29 static std::unique_ptr<FakeOutputSurface> Create3d() { 29 static std::unique_ptr<FakeOutputSurface> Create3d() {
30 return base::WrapUnique( 30 return base::WrapUnique(
31 new FakeOutputSurface(TestContextProvider::Create(), 31 new FakeOutputSurface(TestContextProvider::Create(), nullptr, false));
32 TestContextProvider::CreateWorker(), false));
33 } 32 }
34 33
35 static std::unique_ptr<FakeOutputSurface> Create3d( 34 static std::unique_ptr<FakeOutputSurface> Create3d(
36 scoped_refptr<ContextProvider> context_provider) { 35 scoped_refptr<ContextProvider> context_provider) {
37 return base::WrapUnique(new FakeOutputSurface( 36 return base::WrapUnique(
38 context_provider, TestContextProvider::CreateWorker(), false)); 37 new FakeOutputSurface(context_provider, nullptr, false));
39 } 38 }
40 39
41 static std::unique_ptr<FakeOutputSurface> Create3d( 40 static std::unique_ptr<FakeOutputSurface> Create3d(
42 scoped_refptr<ContextProvider> context_provider, 41 scoped_refptr<ContextProvider> context_provider,
43 scoped_refptr<ContextProvider> worker_context_provider) { 42 scoped_refptr<ContextProvider> worker_context_provider) {
44 return base::WrapUnique(new FakeOutputSurface( 43 return base::WrapUnique(new FakeOutputSurface(
45 context_provider, worker_context_provider, false)); 44 context_provider, worker_context_provider, false));
46 } 45 }
47 46
48 static std::unique_ptr<FakeOutputSurface> Create3d( 47 static std::unique_ptr<FakeOutputSurface> Create3d(
49 std::unique_ptr<TestGLES2Interface> gl) { 48 std::unique_ptr<TestGLES2Interface> gl) {
50 return base::WrapUnique( 49 return base::WrapUnique(
51 new FakeOutputSurface(TestContextProvider::Create(std::move(gl)), 50 new FakeOutputSurface(TestContextProvider::Create(std::move(gl)),
52 TestContextProvider::CreateWorker(), false)); 51 TestContextProvider::CreateWorker(), false));
53 } 52 }
54 53
55 static std::unique_ptr<FakeOutputSurface> Create3d( 54 static std::unique_ptr<FakeOutputSurface> Create3d(
56 std::unique_ptr<TestWebGraphicsContext3D> context) { 55 std::unique_ptr<TestWebGraphicsContext3D> context) {
57 return base::WrapUnique( 56 return base::WrapUnique(new FakeOutputSurface(
58 new FakeOutputSurface(TestContextProvider::Create(std::move(context)), 57 TestContextProvider::Create(std::move(context)), nullptr, false));
59 TestContextProvider::CreateWorker(), false));
60 } 58 }
61 59
62 static std::unique_ptr<FakeOutputSurface> CreateSoftware( 60 static std::unique_ptr<FakeOutputSurface> CreateSoftware(
63 std::unique_ptr<SoftwareOutputDevice> software_device) { 61 std::unique_ptr<SoftwareOutputDevice> software_device) {
64 return base::WrapUnique( 62 return base::WrapUnique(new FakeOutputSurface(
65 new FakeOutputSurface(std::move(software_device), false)); 63 nullptr, nullptr, std::move(software_device), false));
66 } 64 }
67 65
68 static std::unique_ptr<FakeOutputSurface> CreateDelegating3d() { 66 static std::unique_ptr<FakeOutputSurface> CreateDelegating3d() {
69 return base::WrapUnique( 67 return base::WrapUnique(
70 new FakeOutputSurface(TestContextProvider::Create(), 68 new FakeOutputSurface(TestContextProvider::Create(),
71 TestContextProvider::CreateWorker(), true)); 69 TestContextProvider::CreateWorker(), true));
72 } 70 }
73 71
74 static std::unique_ptr<FakeOutputSurface> CreateDelegating3d( 72 static std::unique_ptr<FakeOutputSurface> CreateDelegating3d(
75 scoped_refptr<TestContextProvider> context_provider) { 73 scoped_refptr<TestContextProvider> context_provider) {
76 return base::WrapUnique(new FakeOutputSurface( 74 return base::WrapUnique(new FakeOutputSurface(
77 context_provider, TestContextProvider::CreateWorker(), true)); 75 context_provider, TestContextProvider::CreateWorker(), true));
78 } 76 }
79 77
80 static std::unique_ptr<FakeOutputSurface> CreateDelegating3d( 78 static std::unique_ptr<FakeOutputSurface> CreateDelegating3d(
81 std::unique_ptr<TestWebGraphicsContext3D> context) { 79 std::unique_ptr<TestWebGraphicsContext3D> context) {
82 return base::WrapUnique( 80 return base::WrapUnique(
83 new FakeOutputSurface(TestContextProvider::Create(std::move(context)), 81 new FakeOutputSurface(TestContextProvider::Create(std::move(context)),
84 TestContextProvider::CreateWorker(), true)); 82 TestContextProvider::CreateWorker(), true));
85 } 83 }
86 84
87 static std::unique_ptr<FakeOutputSurface> CreateDelegatingSoftware( 85 static std::unique_ptr<FakeOutputSurface> CreateDelegatingSoftware() {
88 std::unique_ptr<SoftwareOutputDevice> software_device) {
89 return base::WrapUnique( 86 return base::WrapUnique(
90 new FakeOutputSurface(std::move(software_device), true)); 87 new FakeOutputSurface(nullptr, nullptr, nullptr, true));
91 } 88 }
92 89
93 static std::unique_ptr<FakeOutputSurface> CreateNoRequireSyncPoint( 90 static std::unique_ptr<FakeOutputSurface> CreateNoRequireSyncPoint(
94 std::unique_ptr<TestWebGraphicsContext3D> context) { 91 std::unique_ptr<TestWebGraphicsContext3D> context) {
95 std::unique_ptr<FakeOutputSurface> surface(Create3d(std::move(context))); 92 std::unique_ptr<FakeOutputSurface> surface(Create3d(std::move(context)));
96 surface->capabilities_.delegated_sync_points_required = false; 93 surface->capabilities_.delegated_sync_points_required = false;
97 return surface; 94 return surface;
98 } 95 }
99 96
100 static std::unique_ptr<FakeOutputSurface> CreateOffscreen( 97 static std::unique_ptr<FakeOutputSurface> CreateOffscreen(
(...skipping 18 matching lines...) Expand all
119 bool BindToClient(OutputSurfaceClient* client) override; 116 bool BindToClient(OutputSurfaceClient* client) override;
120 void DetachFromClient() override; 117 void DetachFromClient() override;
121 118
122 void set_framebuffer(GLint framebuffer, GLenum format) { 119 void set_framebuffer(GLint framebuffer, GLenum format) {
123 framebuffer_ = framebuffer; 120 framebuffer_ = framebuffer;
124 framebuffer_format_ = format; 121 framebuffer_format_ = format;
125 } 122 }
126 void BindFramebuffer() override; 123 void BindFramebuffer() override;
127 uint32_t GetFramebufferCopyTextureFormat() override; 124 uint32_t GetFramebufferCopyTextureFormat() override;
128 125
129 void SetTreeActivationCallback(const base::Closure& callback);
130
131 const TransferableResourceArray& resources_held_by_parent() { 126 const TransferableResourceArray& resources_held_by_parent() {
132 return resources_held_by_parent_; 127 return resources_held_by_parent_;
133 } 128 }
134 129
135 bool HasExternalStencilTest() const override; 130 bool HasExternalStencilTest() const override;
136 131
137 bool SurfaceIsSuspendForRecycle() const override; 132 bool SurfaceIsSuspendForRecycle() const override;
138 133
139 OverlayCandidateValidator* GetOverlayCandidateValidator() const override; 134 OverlayCandidateValidator* GetOverlayCandidateValidator() const override;
140 void SetOverlayCandidateValidator(OverlayCandidateValidator* validator) { 135 void SetOverlayCandidateValidator(OverlayCandidateValidator* validator) {
(...skipping 16 matching lines...) Expand all
157 return last_swap_rect_; 152 return last_swap_rect_;
158 } 153 }
159 154
160 void ReturnResourcesHeldByParent(); 155 void ReturnResourcesHeldByParent();
161 156
162 protected: 157 protected:
163 FakeOutputSurface(scoped_refptr<ContextProvider> context_provider, 158 FakeOutputSurface(scoped_refptr<ContextProvider> context_provider,
164 scoped_refptr<ContextProvider> worker_context_provider, 159 scoped_refptr<ContextProvider> worker_context_provider,
165 bool delegated_rendering); 160 bool delegated_rendering);
166 161
167 FakeOutputSurface(std::unique_ptr<SoftwareOutputDevice> software_device,
168 bool delegated_rendering);
169
170 FakeOutputSurface(scoped_refptr<ContextProvider> context_provider, 162 FakeOutputSurface(scoped_refptr<ContextProvider> context_provider,
171 scoped_refptr<ContextProvider> worker_context_provider, 163 scoped_refptr<ContextProvider> worker_context_provider,
172 std::unique_ptr<SoftwareOutputDevice> software_device, 164 std::unique_ptr<SoftwareOutputDevice> software_device,
173 bool delegated_rendering); 165 bool delegated_rendering);
174 166
175 OutputSurfaceClient* client_ = nullptr; 167 OutputSurfaceClient* client_ = nullptr;
176 std::unique_ptr<CompositorFrame> last_sent_frame_; 168 std::unique_ptr<CompositorFrame> last_sent_frame_;
177 size_t num_sent_frames_ = 0; 169 size_t num_sent_frames_ = 0;
178 bool has_external_stencil_test_ = false; 170 bool has_external_stencil_test_ = false;
179 bool suspended_for_recycle_ = false; 171 bool suspended_for_recycle_ = false;
180 GLint framebuffer_ = 0; 172 GLint framebuffer_ = 0;
181 GLenum framebuffer_format_ = 0; 173 GLenum framebuffer_format_ = 0;
182 TransferableResourceArray resources_held_by_parent_; 174 TransferableResourceArray resources_held_by_parent_;
183 std::unique_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind_; 175 std::unique_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind_;
184 OverlayCandidateValidator* overlay_candidate_validator_ = nullptr; 176 OverlayCandidateValidator* overlay_candidate_validator_ = nullptr;
185 bool last_swap_rect_valid_ = false; 177 bool last_swap_rect_valid_ = false;
186 gfx::Rect last_swap_rect_; 178 gfx::Rect last_swap_rect_;
187 }; 179 };
188 180
189 } // namespace cc 181 } // namespace cc
190 182
191 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ 183 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_
OLDNEW
« no previous file with comments | « cc/test/fake_layer_tree_host_client.cc ('k') | cc/test/fake_output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698