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

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

Issue 2337913003: Fork cc::OutputSurface into cc::CompositorFrameSink. (Closed)
Patch Set: cfsfork: android-vulkan 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_channel_impl.h ('k') | cc/test/fake_compositor_frame_sink.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_COMPOSITOR_FRAME_SINK_H_
6 #define CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_H_
7
8 #include <stddef.h>
9
10 #include "base/callback.h"
11 #include "base/logging.h"
12 #include "base/memory/ptr_util.h"
13 #include "base/time/time.h"
14 #include "cc/output/begin_frame_args.h"
15 #include "cc/output/compositor_frame.h"
16 #include "cc/output/compositor_frame_sink.h"
17 #include "cc/output/software_output_device.h"
18 #include "cc/test/test_context_provider.h"
19 #include "cc/test/test_gles2_interface.h"
20 #include "cc/test/test_web_graphics_context_3d.h"
21
22 namespace cc {
23
24 class FakeCompositorFrameSink : public CompositorFrameSink {
25 public:
26 ~FakeCompositorFrameSink() override;
27
28 static std::unique_ptr<FakeCompositorFrameSink> Create3d() {
29 return base::WrapUnique(
30 new FakeCompositorFrameSink(TestContextProvider::Create(),
31 TestContextProvider::CreateWorker(), true));
32 }
33
34 static std::unique_ptr<FakeCompositorFrameSink> Create3d(
35 scoped_refptr<TestContextProvider> context_provider) {
36 return base::WrapUnique(new FakeCompositorFrameSink(
37 context_provider, TestContextProvider::CreateWorker(), true));
38 }
39
40 static std::unique_ptr<FakeCompositorFrameSink> Create3d(
41 std::unique_ptr<TestWebGraphicsContext3D> context) {
42 return base::WrapUnique(new FakeCompositorFrameSink(
43 TestContextProvider::Create(std::move(context)),
44 TestContextProvider::CreateWorker(), true));
45 }
46
47 static std::unique_ptr<FakeCompositorFrameSink> CreateSoftware() {
48 return base::WrapUnique(
49 new FakeCompositorFrameSink(nullptr, nullptr, nullptr, true));
50 }
51
52 void set_max_frames_pending(int max) {
53 capabilities_.max_frames_pending = max;
54 }
55
56 CompositorFrame* last_sent_frame() { return last_sent_frame_.get(); }
57 size_t num_sent_frames() { return num_sent_frames_; }
58
59 void SwapBuffers(CompositorFrame frame) override;
60
61 CompositorFrameSinkClient* client() { return client_; }
62 bool BindToClient(CompositorFrameSinkClient* client) override;
63 void DetachFromClient() override;
64
65 void set_framebuffer(GLint framebuffer, GLenum format) {
66 framebuffer_ = framebuffer;
67 framebuffer_format_ = format;
68 }
69 void BindFramebuffer() override;
70 uint32_t GetFramebufferCopyTextureFormat() override;
71
72 const TransferableResourceArray& resources_held_by_parent() {
73 return resources_held_by_parent_;
74 }
75
76 bool HasExternalStencilTest() const override;
77
78 bool SurfaceIsSuspendForRecycle() const override;
79
80 OverlayCandidateValidator* GetOverlayCandidateValidator() const override;
81 void SetOverlayCandidateValidator(OverlayCandidateValidator* validator) {
82 overlay_candidate_validator_ = validator;
83 }
84
85 void set_has_external_stencil_test(bool has_test) {
86 has_external_stencil_test_ = has_test;
87 }
88
89 void set_suspended_for_recycle(bool suspended) {
90 suspended_for_recycle_ = suspended;
91 }
92
93 gfx::Rect last_swap_rect() const {
94 DCHECK(last_swap_rect_valid_);
95 return last_swap_rect_;
96 }
97
98 void ReturnResourcesHeldByParent();
99
100 protected:
101 FakeCompositorFrameSink(
102 scoped_refptr<ContextProvider> context_provider,
103 scoped_refptr<ContextProvider> worker_context_provider,
104 bool delegated_rendering);
105
106 FakeCompositorFrameSink(
107 scoped_refptr<ContextProvider> context_provider,
108 scoped_refptr<ContextProvider> worker_context_provider,
109 std::unique_ptr<SoftwareOutputDevice> software_device,
110 bool delegated_rendering);
111
112 CompositorFrameSinkClient* client_ = nullptr;
113 std::unique_ptr<CompositorFrame> last_sent_frame_;
114 size_t num_sent_frames_ = 0;
115 bool has_external_stencil_test_ = false;
116 bool suspended_for_recycle_ = false;
117 GLint framebuffer_ = 0;
118 GLenum framebuffer_format_ = 0;
119 TransferableResourceArray resources_held_by_parent_;
120 OverlayCandidateValidator* overlay_candidate_validator_ = nullptr;
121 bool last_swap_rect_valid_ = false;
122 gfx::Rect last_swap_rect_;
123 };
124
125 } // namespace cc
126
127 #endif // CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_H_
OLDNEW
« no previous file with comments | « cc/test/fake_channel_impl.h ('k') | cc/test/fake_compositor_frame_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698