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

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

Issue 1535833002: Delete CC. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-5
Patch Set: rebase Created 4 years, 10 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_external_begin_frame_source.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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CC_TEST_FAKE_OUTPUT_SURFACE_H_
6 #define CC_TEST_FAKE_OUTPUT_SURFACE_H_
7
8 #include "base/callback.h"
9 #include "base/logging.h"
10 #include "base/time/time.h"
11 #include "cc/output/begin_frame_args.h"
12 #include "cc/output/compositor_frame.h"
13 #include "cc/output/output_surface.h"
14 #include "cc/output/software_output_device.h"
15 #include "cc/test/test_context_provider.h"
16 #include "cc/test/test_web_graphics_context_3d.h"
17
18 namespace cc {
19
20 class FakeOutputSurface : public OutputSurface {
21 public:
22 ~FakeOutputSurface() override;
23
24 static scoped_ptr<FakeOutputSurface> Create3d() {
25 return make_scoped_ptr(new FakeOutputSurface(
26 TestContextProvider::Create(), TestContextProvider::Create(), false));
27 }
28
29 static scoped_ptr<FakeOutputSurface> Create3d(
30 scoped_refptr<ContextProvider> context_provider) {
31 return make_scoped_ptr(new FakeOutputSurface(context_provider, false));
32 }
33
34 static scoped_ptr<FakeOutputSurface> Create3d(
35 scoped_refptr<ContextProvider> context_provider,
36 scoped_refptr<ContextProvider> worker_context_provider) {
37 return make_scoped_ptr(new FakeOutputSurface(
38 context_provider, worker_context_provider, false));
39 }
40
41 static scoped_ptr<FakeOutputSurface> Create3d(
42 scoped_ptr<TestWebGraphicsContext3D> context) {
43 return make_scoped_ptr(new FakeOutputSurface(
44 TestContextProvider::Create(context.Pass()), false));
45 }
46
47 static scoped_ptr<FakeOutputSurface> CreateSoftware(
48 scoped_ptr<SoftwareOutputDevice> software_device) {
49 return make_scoped_ptr(new FakeOutputSurface(software_device.Pass(),
50 false));
51 }
52
53 static scoped_ptr<FakeOutputSurface> CreateDelegating3d() {
54 return make_scoped_ptr(new FakeOutputSurface(
55 TestContextProvider::Create(), TestContextProvider::Create(), true));
56 }
57
58 static scoped_ptr<FakeOutputSurface> CreateDelegating3d(
59 scoped_refptr<TestContextProvider> context_provider) {
60 return make_scoped_ptr(new FakeOutputSurface(context_provider, true));
61 }
62
63 static scoped_ptr<FakeOutputSurface> CreateDelegating3d(
64 scoped_ptr<TestWebGraphicsContext3D> context) {
65 return make_scoped_ptr(new FakeOutputSurface(
66 TestContextProvider::Create(context.Pass()), true));
67 }
68
69 static scoped_ptr<FakeOutputSurface> CreateDelegatingSoftware(
70 scoped_ptr<SoftwareOutputDevice> software_device) {
71 return make_scoped_ptr(
72 new FakeOutputSurface(software_device.Pass(), true));
73 }
74
75 static scoped_ptr<FakeOutputSurface> CreateDeferredGL(
76 scoped_ptr<SoftwareOutputDevice> software_device,
77 bool delegated_rendering) {
78 scoped_ptr<FakeOutputSurface> result(
79 new FakeOutputSurface(software_device.Pass(), delegated_rendering));
80 result->capabilities_.deferred_gl_initialization = true;
81 return result.Pass();
82 }
83
84 static scoped_ptr<FakeOutputSurface> CreateAlwaysDrawAndSwap3d() {
85 scoped_ptr<FakeOutputSurface> surface(Create3d());
86 surface->capabilities_.draw_and_swap_full_viewport_every_frame = true;
87 return surface.Pass();
88 }
89
90 static scoped_ptr<FakeOutputSurface> CreateOffscreen(
91 scoped_ptr<TestWebGraphicsContext3D> context) {
92 scoped_ptr<FakeOutputSurface> surface(new FakeOutputSurface(
93 TestContextProvider::Create(context.Pass()), false));
94 surface->capabilities_.uses_default_gl_framebuffer = false;
95 return surface.Pass();
96 }
97
98 CompositorFrame& last_sent_frame() { return last_sent_frame_; }
99 size_t num_sent_frames() { return num_sent_frames_; }
100
101 void SwapBuffers(CompositorFrame* frame) override;
102
103 bool BindToClient(OutputSurfaceClient* client) override;
104
105 void set_framebuffer(unsigned framebuffer) { framebuffer_ = framebuffer; }
106 void BindFramebuffer() override;
107
108 using OutputSurface::ReleaseGL;
109 using OutputSurface::InitializeAndSetContext3d;
110
111 void SetTreeActivationCallback(const base::Closure& callback);
112
113 const TransferableResourceArray& resources_held_by_parent() {
114 return resources_held_by_parent_;
115 }
116
117 void ReturnResource(unsigned id, CompositorFrameAck* ack);
118
119 bool HasExternalStencilTest() const override;
120
121 void set_has_external_stencil_test(bool has_test) {
122 has_external_stencil_test_ = has_test;
123 }
124
125 gfx::Rect last_swap_rect() const {
126 return last_swap_rect_;
127 }
128
129 protected:
130 FakeOutputSurface(
131 scoped_refptr<ContextProvider> context_provider,
132 bool delegated_rendering);
133
134 FakeOutputSurface(scoped_refptr<ContextProvider> context_provider,
135 scoped_refptr<ContextProvider> worker_context_provider,
136 bool delegated_rendering);
137
138 FakeOutputSurface(scoped_ptr<SoftwareOutputDevice> software_device,
139 bool delegated_rendering);
140
141 FakeOutputSurface(
142 scoped_refptr<ContextProvider> context_provider,
143 scoped_ptr<SoftwareOutputDevice> software_device,
144 bool delegated_rendering);
145
146 OutputSurfaceClient* client_;
147 CompositorFrame last_sent_frame_;
148 size_t num_sent_frames_;
149 bool has_external_stencil_test_;
150 unsigned framebuffer_;
151 TransferableResourceArray resources_held_by_parent_;
152 gfx::Rect last_swap_rect_;
153 };
154
155 } // namespace cc
156
157 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_
OLDNEW
« no previous file with comments | « cc/test/fake_external_begin_frame_source.cc ('k') | cc/test/fake_output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698