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

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

Issue 1866203004: Convert //cc from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptrcc: rebase Created 4 years, 8 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_mask_layer_impl.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"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/ptr_util.h"
12 #include "base/time/time.h" 13 #include "base/time/time.h"
13 #include "cc/output/begin_frame_args.h" 14 #include "cc/output/begin_frame_args.h"
14 #include "cc/output/compositor_frame.h" 15 #include "cc/output/compositor_frame.h"
15 #include "cc/output/managed_memory_policy.h" 16 #include "cc/output/managed_memory_policy.h"
16 #include "cc/output/output_surface.h" 17 #include "cc/output/output_surface.h"
17 #include "cc/output/software_output_device.h" 18 #include "cc/output/software_output_device.h"
18 #include "cc/test/test_context_provider.h" 19 #include "cc/test/test_context_provider.h"
19 #include "cc/test/test_web_graphics_context_3d.h" 20 #include "cc/test/test_web_graphics_context_3d.h"
20 21
21 namespace cc { 22 namespace cc {
22 23
23 class FakeOutputSurface : public OutputSurface { 24 class FakeOutputSurface : public OutputSurface {
24 public: 25 public:
25 ~FakeOutputSurface() override; 26 ~FakeOutputSurface() override;
26 27
27 static scoped_ptr<FakeOutputSurface> Create3d() { 28 static std::unique_ptr<FakeOutputSurface> Create3d() {
28 return make_scoped_ptr( 29 return base::WrapUnique(
29 new FakeOutputSurface(TestContextProvider::Create(), 30 new FakeOutputSurface(TestContextProvider::Create(),
30 TestContextProvider::CreateWorker(), false)); 31 TestContextProvider::CreateWorker(), false));
31 } 32 }
32 33
33 static scoped_ptr<FakeOutputSurface> Create3d( 34 static std::unique_ptr<FakeOutputSurface> Create3d(
34 scoped_refptr<ContextProvider> context_provider) { 35 scoped_refptr<ContextProvider> context_provider) {
35 return make_scoped_ptr(new FakeOutputSurface( 36 return base::WrapUnique(new FakeOutputSurface(
36 context_provider, TestContextProvider::CreateWorker(), false)); 37 context_provider, TestContextProvider::CreateWorker(), false));
37 } 38 }
38 39
39 static scoped_ptr<FakeOutputSurface> Create3d( 40 static std::unique_ptr<FakeOutputSurface> Create3d(
40 scoped_refptr<ContextProvider> context_provider, 41 scoped_refptr<ContextProvider> context_provider,
41 scoped_refptr<ContextProvider> worker_context_provider) { 42 scoped_refptr<ContextProvider> worker_context_provider) {
42 return make_scoped_ptr(new FakeOutputSurface( 43 return base::WrapUnique(new FakeOutputSurface(
43 context_provider, worker_context_provider, false)); 44 context_provider, worker_context_provider, false));
44 } 45 }
45 46
46 static scoped_ptr<FakeOutputSurface> Create3d( 47 static std::unique_ptr<FakeOutputSurface> Create3d(
47 scoped_ptr<TestWebGraphicsContext3D> context) { 48 std::unique_ptr<TestWebGraphicsContext3D> context) {
48 return make_scoped_ptr( 49 return base::WrapUnique(
49 new FakeOutputSurface(TestContextProvider::Create(std::move(context)), 50 new FakeOutputSurface(TestContextProvider::Create(std::move(context)),
50 TestContextProvider::CreateWorker(), false)); 51 TestContextProvider::CreateWorker(), false));
51 } 52 }
52 53
53 static scoped_ptr<FakeOutputSurface> CreateSoftware( 54 static std::unique_ptr<FakeOutputSurface> CreateSoftware(
54 scoped_ptr<SoftwareOutputDevice> software_device) { 55 std::unique_ptr<SoftwareOutputDevice> software_device) {
55 return make_scoped_ptr( 56 return base::WrapUnique(
56 new FakeOutputSurface(std::move(software_device), false)); 57 new FakeOutputSurface(std::move(software_device), false));
57 } 58 }
58 59
59 static scoped_ptr<FakeOutputSurface> 60 static std::unique_ptr<FakeOutputSurface>
60 Create3dWithResourcelessSoftwareSupport() { 61 Create3dWithResourcelessSoftwareSupport() {
61 return make_scoped_ptr(new FakeOutputSurface( 62 return base::WrapUnique(new FakeOutputSurface(
62 TestContextProvider::Create(), 63 TestContextProvider::Create(),
63 make_scoped_ptr(new SoftwareOutputDevice), false)); 64 base::WrapUnique(new SoftwareOutputDevice), false));
64 } 65 }
65 66
66 static scoped_ptr<FakeOutputSurface> CreateDelegating3d() { 67 static std::unique_ptr<FakeOutputSurface> CreateDelegating3d() {
67 return make_scoped_ptr( 68 return base::WrapUnique(
68 new FakeOutputSurface(TestContextProvider::Create(), 69 new FakeOutputSurface(TestContextProvider::Create(),
69 TestContextProvider::CreateWorker(), true)); 70 TestContextProvider::CreateWorker(), true));
70 } 71 }
71 72
72 static scoped_ptr<FakeOutputSurface> CreateDelegating3d( 73 static std::unique_ptr<FakeOutputSurface> CreateDelegating3d(
73 scoped_refptr<TestContextProvider> context_provider) { 74 scoped_refptr<TestContextProvider> context_provider) {
74 return make_scoped_ptr(new FakeOutputSurface( 75 return base::WrapUnique(new FakeOutputSurface(
75 context_provider, TestContextProvider::CreateWorker(), true)); 76 context_provider, TestContextProvider::CreateWorker(), true));
76 } 77 }
77 78
78 static scoped_ptr<FakeOutputSurface> CreateDelegating3d( 79 static std::unique_ptr<FakeOutputSurface> CreateDelegating3d(
79 scoped_ptr<TestWebGraphicsContext3D> context) { 80 std::unique_ptr<TestWebGraphicsContext3D> context) {
80 return make_scoped_ptr( 81 return base::WrapUnique(
81 new FakeOutputSurface(TestContextProvider::Create(std::move(context)), 82 new FakeOutputSurface(TestContextProvider::Create(std::move(context)),
82 TestContextProvider::CreateWorker(), true)); 83 TestContextProvider::CreateWorker(), true));
83 } 84 }
84 85
85 static scoped_ptr<FakeOutputSurface> CreateDelegatingSoftware( 86 static std::unique_ptr<FakeOutputSurface> CreateDelegatingSoftware(
86 scoped_ptr<SoftwareOutputDevice> software_device) { 87 std::unique_ptr<SoftwareOutputDevice> software_device) {
87 return make_scoped_ptr( 88 return base::WrapUnique(
88 new FakeOutputSurface(std::move(software_device), true)); 89 new FakeOutputSurface(std::move(software_device), true));
89 } 90 }
90 91
91 static scoped_ptr<FakeOutputSurface> CreateNoRequireSyncPoint( 92 static std::unique_ptr<FakeOutputSurface> CreateNoRequireSyncPoint(
92 scoped_ptr<TestWebGraphicsContext3D> context) { 93 std::unique_ptr<TestWebGraphicsContext3D> context) {
93 scoped_ptr<FakeOutputSurface> surface(Create3d(std::move(context))); 94 std::unique_ptr<FakeOutputSurface> surface(Create3d(std::move(context)));
94 surface->capabilities_.delegated_sync_points_required = false; 95 surface->capabilities_.delegated_sync_points_required = false;
95 return surface; 96 return surface;
96 } 97 }
97 98
98 static scoped_ptr<FakeOutputSurface> CreateOffscreen( 99 static std::unique_ptr<FakeOutputSurface> CreateOffscreen(
99 scoped_ptr<TestWebGraphicsContext3D> context) { 100 std::unique_ptr<TestWebGraphicsContext3D> context) {
100 scoped_ptr<FakeOutputSurface> surface(new FakeOutputSurface( 101 std::unique_ptr<FakeOutputSurface> surface(new FakeOutputSurface(
101 TestContextProvider::Create(std::move(context)), false)); 102 TestContextProvider::Create(std::move(context)), false));
102 surface->capabilities_.uses_default_gl_framebuffer = false; 103 surface->capabilities_.uses_default_gl_framebuffer = false;
103 return surface; 104 return surface;
104 } 105 }
105 106
106 void set_max_frames_pending(int max) { 107 void set_max_frames_pending(int max) {
107 capabilities_.max_frames_pending = max; 108 capabilities_.max_frames_pending = max;
108 } 109 }
109 110
110 CompositorFrame& last_sent_frame() { return last_sent_frame_; } 111 CompositorFrame& last_sent_frame() { return last_sent_frame_; }
(...skipping 26 matching lines...) Expand all
137 138
138 void set_has_external_stencil_test(bool has_test) { 139 void set_has_external_stencil_test(bool has_test) {
139 has_external_stencil_test_ = has_test; 140 has_external_stencil_test_ = has_test;
140 } 141 }
141 142
142 void set_suspended_for_recycle(bool suspended) { 143 void set_suspended_for_recycle(bool suspended) {
143 suspended_for_recycle_ = suspended; 144 suspended_for_recycle_ = suspended;
144 } 145 }
145 146
146 void SetMemoryPolicyToSetAtBind( 147 void SetMemoryPolicyToSetAtBind(
147 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind); 148 std::unique_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind);
148 149
149 gfx::Rect last_swap_rect() const { 150 gfx::Rect last_swap_rect() const {
150 return last_swap_rect_; 151 return last_swap_rect_;
151 } 152 }
152 153
153 protected: 154 protected:
154 FakeOutputSurface( 155 FakeOutputSurface(
155 scoped_refptr<ContextProvider> context_provider, 156 scoped_refptr<ContextProvider> context_provider,
156 bool delegated_rendering); 157 bool delegated_rendering);
157 158
158 FakeOutputSurface(scoped_refptr<ContextProvider> context_provider, 159 FakeOutputSurface(scoped_refptr<ContextProvider> context_provider,
159 scoped_refptr<ContextProvider> worker_context_provider, 160 scoped_refptr<ContextProvider> worker_context_provider,
160 bool delegated_rendering); 161 bool delegated_rendering);
161 162
162 FakeOutputSurface(scoped_ptr<SoftwareOutputDevice> software_device, 163 FakeOutputSurface(std::unique_ptr<SoftwareOutputDevice> software_device,
163 bool delegated_rendering); 164 bool delegated_rendering);
164 165
165 FakeOutputSurface( 166 FakeOutputSurface(scoped_refptr<ContextProvider> context_provider,
166 scoped_refptr<ContextProvider> context_provider, 167 std::unique_ptr<SoftwareOutputDevice> software_device,
167 scoped_ptr<SoftwareOutputDevice> software_device, 168 bool delegated_rendering);
168 bool delegated_rendering);
169 169
170 OutputSurfaceClient* client_; 170 OutputSurfaceClient* client_;
171 CompositorFrame last_sent_frame_; 171 CompositorFrame last_sent_frame_;
172 size_t num_sent_frames_; 172 size_t num_sent_frames_;
173 bool has_external_stencil_test_; 173 bool has_external_stencil_test_;
174 bool suspended_for_recycle_; 174 bool suspended_for_recycle_;
175 unsigned framebuffer_; 175 unsigned framebuffer_;
176 TransferableResourceArray resources_held_by_parent_; 176 TransferableResourceArray resources_held_by_parent_;
177 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind_; 177 std::unique_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind_;
178 OverlayCandidateValidator* overlay_candidate_validator_; 178 OverlayCandidateValidator* overlay_candidate_validator_;
179 gfx::Rect last_swap_rect_; 179 gfx::Rect last_swap_rect_;
180 }; 180 };
181 181
182 } // namespace cc 182 } // namespace cc
183 183
184 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ 184 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_
OLDNEW
« no previous file with comments | « cc/test/fake_mask_layer_impl.cc ('k') | cc/test/fake_output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698