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

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

Issue 2349743004: cc: Remove things from OutputSurface and CompositorFrameSink. (Closed)
Patch Set: delete-stuff-cfs: comment-and-rebase 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
« no previous file with comments | « cc/test/fake_layer_tree_host_impl_client.h ('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/memory/ptr_util.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "cc/output/begin_frame_args.h" 14 #include "cc/output/begin_frame_args.h"
15 #include "cc/output/compositor_frame.h" 15 #include "cc/output/compositor_frame.h"
16 #include "cc/output/output_surface.h" 16 #include "cc/output/output_surface.h"
17 #include "cc/output/software_output_device.h" 17 #include "cc/output/software_output_device.h"
18 #include "cc/test/test_context_provider.h" 18 #include "cc/test/test_context_provider.h"
19 #include "cc/test/test_gles2_interface.h" 19 #include "cc/test/test_gles2_interface.h"
20 #include "cc/test/test_web_graphics_context_3d.h" 20 #include "cc/test/test_web_graphics_context_3d.h"
21 21
22 namespace cc { 22 namespace cc {
23 23
24 class FakeOutputSurface : public OutputSurface { 24 class FakeOutputSurface : public OutputSurface {
25 public: 25 public:
26 ~FakeOutputSurface() override; 26 ~FakeOutputSurface() override;
27 27
28 static std::unique_ptr<FakeOutputSurface> Create3d() { 28 static std::unique_ptr<FakeOutputSurface> Create3d() {
29 return base::WrapUnique( 29 return base::WrapUnique(
30 new FakeOutputSurface(TestContextProvider::Create(), nullptr, false)); 30 new FakeOutputSurface(TestContextProvider::Create()));
31 } 31 }
32 32
33 static std::unique_ptr<FakeOutputSurface> Create3d( 33 static std::unique_ptr<FakeOutputSurface> Create3d(
34 scoped_refptr<ContextProvider> context_provider) { 34 scoped_refptr<ContextProvider> context_provider) {
35 return base::WrapUnique( 35 return base::WrapUnique(new FakeOutputSurface(context_provider));
36 new FakeOutputSurface(context_provider, nullptr, false));
37 }
38
39 static std::unique_ptr<FakeOutputSurface> Create3d(
40 scoped_refptr<ContextProvider> context_provider,
41 scoped_refptr<ContextProvider> worker_context_provider) {
42 return base::WrapUnique(new FakeOutputSurface(
43 context_provider, worker_context_provider, false));
44 } 36 }
45 37
46 static std::unique_ptr<FakeOutputSurface> Create3d( 38 static std::unique_ptr<FakeOutputSurface> Create3d(
47 std::unique_ptr<TestGLES2Interface> gl) { 39 std::unique_ptr<TestGLES2Interface> gl) {
48 return base::WrapUnique(new FakeOutputSurface( 40 return base::WrapUnique(
49 TestContextProvider::Create(std::move(gl)), nullptr, false)); 41 new FakeOutputSurface(TestContextProvider::Create(std::move(gl))));
50 } 42 }
51 43
52 static std::unique_ptr<FakeOutputSurface> Create3d( 44 static std::unique_ptr<FakeOutputSurface> Create3d(
53 std::unique_ptr<TestWebGraphicsContext3D> context) { 45 std::unique_ptr<TestWebGraphicsContext3D> context) {
54 return base::WrapUnique(new FakeOutputSurface( 46 return base::WrapUnique(
55 TestContextProvider::Create(std::move(context)), nullptr, false)); 47 new FakeOutputSurface(TestContextProvider::Create(std::move(context))));
56 } 48 }
57 49
58 static std::unique_ptr<FakeOutputSurface> CreateSoftware( 50 static std::unique_ptr<FakeOutputSurface> CreateSoftware(
59 std::unique_ptr<SoftwareOutputDevice> software_device) { 51 std::unique_ptr<SoftwareOutputDevice> software_device) {
60 return base::WrapUnique(new FakeOutputSurface( 52 return base::WrapUnique(new FakeOutputSurface(std::move(software_device)));
61 nullptr, nullptr, std::move(software_device), false));
62 }
63
64 static std::unique_ptr<FakeOutputSurface> CreateNoRequireSyncPoint(
65 std::unique_ptr<TestWebGraphicsContext3D> context) {
66 std::unique_ptr<FakeOutputSurface> surface(Create3d(std::move(context)));
67 surface->capabilities_.delegated_sync_points_required = false;
68 return surface;
69 } 53 }
70 54
71 static std::unique_ptr<FakeOutputSurface> CreateOffscreen( 55 static std::unique_ptr<FakeOutputSurface> CreateOffscreen(
72 std::unique_ptr<TestWebGraphicsContext3D> context) { 56 std::unique_ptr<TestWebGraphicsContext3D> context) {
73 std::unique_ptr<FakeOutputSurface> surface( 57 auto surface = base::WrapUnique(
74 new FakeOutputSurface(TestContextProvider::Create(std::move(context)), 58 new FakeOutputSurface(TestContextProvider::Create(std::move(context))));
75 TestContextProvider::CreateWorker(), false));
76 surface->capabilities_.uses_default_gl_framebuffer = false; 59 surface->capabilities_.uses_default_gl_framebuffer = false;
77 return surface; 60 return surface;
78 } 61 }
79 62
80 void set_max_frames_pending(int max) { 63 void set_max_frames_pending(int max) {
81 capabilities_.max_frames_pending = max; 64 capabilities_.max_frames_pending = max;
82 } 65 }
83 66
84 CompositorFrame* last_sent_frame() { return last_sent_frame_.get(); } 67 CompositorFrame* last_sent_frame() { return last_sent_frame_.get(); }
85 size_t num_sent_frames() { return num_sent_frames_; } 68 size_t num_sent_frames() { return num_sent_frames_; }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 102 }
120 103
121 gfx::Rect last_swap_rect() const { 104 gfx::Rect last_swap_rect() const {
122 DCHECK(last_swap_rect_valid_); 105 DCHECK(last_swap_rect_valid_);
123 return last_swap_rect_; 106 return last_swap_rect_;
124 } 107 }
125 108
126 void ReturnResourcesHeldByParent(); 109 void ReturnResourcesHeldByParent();
127 110
128 protected: 111 protected:
129 FakeOutputSurface(scoped_refptr<ContextProvider> context_provider, 112 explicit FakeOutputSurface(scoped_refptr<ContextProvider> context_provider);
130 scoped_refptr<ContextProvider> worker_context_provider, 113 explicit FakeOutputSurface(
131 bool delegated_rendering); 114 std::unique_ptr<SoftwareOutputDevice> software_device);
132
133 FakeOutputSurface(scoped_refptr<ContextProvider> context_provider,
134 scoped_refptr<ContextProvider> worker_context_provider,
135 std::unique_ptr<SoftwareOutputDevice> software_device,
136 bool delegated_rendering);
137 115
138 OutputSurfaceClient* client_ = nullptr; 116 OutputSurfaceClient* client_ = nullptr;
139 std::unique_ptr<CompositorFrame> last_sent_frame_; 117 std::unique_ptr<CompositorFrame> last_sent_frame_;
140 size_t num_sent_frames_ = 0; 118 size_t num_sent_frames_ = 0;
141 bool has_external_stencil_test_ = false; 119 bool has_external_stencil_test_ = false;
142 bool suspended_for_recycle_ = false; 120 bool suspended_for_recycle_ = false;
143 GLint framebuffer_ = 0; 121 GLint framebuffer_ = 0;
144 GLenum framebuffer_format_ = 0; 122 GLenum framebuffer_format_ = 0;
145 TransferableResourceArray resources_held_by_parent_; 123 TransferableResourceArray resources_held_by_parent_;
146 OverlayCandidateValidator* overlay_candidate_validator_ = nullptr; 124 OverlayCandidateValidator* overlay_candidate_validator_ = nullptr;
147 bool last_swap_rect_valid_ = false; 125 bool last_swap_rect_valid_ = false;
148 gfx::Rect last_swap_rect_; 126 gfx::Rect last_swap_rect_;
149 }; 127 };
150 128
151 } // namespace cc 129 } // namespace cc
152 130
153 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ 131 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_
OLDNEW
« no previous file with comments | « cc/test/fake_layer_tree_host_impl_client.h ('k') | cc/test/fake_output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698