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

Side by Side Diff: cc/test/fake_compositor_frame_sink.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/surfaces/display.cc ('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
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_COMPOSITOR_FRAME_SINK_H_ 5 #ifndef CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_H_
6 #define CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_H_ 6 #define CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_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/compositor_frame_sink.h" 16 #include "cc/output/compositor_frame_sink.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 FakeCompositorFrameSink : public CompositorFrameSink { 24 class FakeCompositorFrameSink : public CompositorFrameSink {
25 public: 25 public:
26 ~FakeCompositorFrameSink() override; 26 ~FakeCompositorFrameSink() override;
27 27
28 static std::unique_ptr<FakeCompositorFrameSink> Create3d() { 28 static std::unique_ptr<FakeCompositorFrameSink> Create3d() {
29 return base::WrapUnique( 29 return base::WrapUnique(new FakeCompositorFrameSink(
30 new FakeCompositorFrameSink(TestContextProvider::Create(), 30 TestContextProvider::Create(), TestContextProvider::CreateWorker()));
31 TestContextProvider::CreateWorker(), true));
32 } 31 }
33 32
34 static std::unique_ptr<FakeCompositorFrameSink> Create3d( 33 static std::unique_ptr<FakeCompositorFrameSink> Create3d(
35 scoped_refptr<TestContextProvider> context_provider) { 34 scoped_refptr<TestContextProvider> context_provider) {
36 return base::WrapUnique(new FakeCompositorFrameSink( 35 return base::WrapUnique(new FakeCompositorFrameSink(
37 context_provider, TestContextProvider::CreateWorker(), true)); 36 context_provider, TestContextProvider::CreateWorker()));
38 } 37 }
39 38
40 static std::unique_ptr<FakeCompositorFrameSink> Create3d( 39 static std::unique_ptr<FakeCompositorFrameSink> Create3d(
41 std::unique_ptr<TestWebGraphicsContext3D> context) { 40 std::unique_ptr<TestWebGraphicsContext3D> context) {
42 return base::WrapUnique(new FakeCompositorFrameSink( 41 return base::WrapUnique(new FakeCompositorFrameSink(
43 TestContextProvider::Create(std::move(context)), 42 TestContextProvider::Create(std::move(context)),
44 TestContextProvider::CreateWorker(), true)); 43 TestContextProvider::CreateWorker()));
45 } 44 }
46 45
47 static std::unique_ptr<FakeCompositorFrameSink> CreateSoftware() { 46 static std::unique_ptr<FakeCompositorFrameSink> CreateSoftware() {
48 return base::WrapUnique( 47 return base::WrapUnique(new FakeCompositorFrameSink(nullptr, nullptr));
49 new FakeCompositorFrameSink(nullptr, nullptr, nullptr, true));
50 }
51
52 void set_max_frames_pending(int max) {
53 capabilities_.max_frames_pending = max;
54 } 48 }
55 49
56 CompositorFrame* last_sent_frame() { return last_sent_frame_.get(); } 50 CompositorFrame* last_sent_frame() { return last_sent_frame_.get(); }
57 size_t num_sent_frames() { return num_sent_frames_; } 51 size_t num_sent_frames() { return num_sent_frames_; }
58 52
59 void SwapBuffers(CompositorFrame frame) override; 53 void SwapBuffers(CompositorFrame frame) override;
60 54
61 CompositorFrameSinkClient* client() { return client_; } 55 CompositorFrameSinkClient* client() { return client_; }
62 bool BindToClient(CompositorFrameSinkClient* client) override; 56 bool BindToClient(CompositorFrameSinkClient* client) override;
63 void DetachFromClient() override; 57 void DetachFromClient() override;
64 58
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() { 59 const TransferableResourceArray& resources_held_by_parent() {
73 return resources_held_by_parent_; 60 return resources_held_by_parent_;
74 } 61 }
75 62
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 { 63 gfx::Rect last_swap_rect() const {
94 DCHECK(last_swap_rect_valid_); 64 DCHECK(last_swap_rect_valid_);
95 return last_swap_rect_; 65 return last_swap_rect_;
96 } 66 }
97 67
98 void ReturnResourcesHeldByParent(); 68 void ReturnResourcesHeldByParent();
99 69
100 protected: 70 protected:
101 FakeCompositorFrameSink( 71 FakeCompositorFrameSink(
102 scoped_refptr<ContextProvider> context_provider, 72 scoped_refptr<ContextProvider> context_provider,
103 scoped_refptr<ContextProvider> worker_context_provider, 73 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 74
112 CompositorFrameSinkClient* client_ = nullptr; 75 CompositorFrameSinkClient* client_ = nullptr;
113 std::unique_ptr<CompositorFrame> last_sent_frame_; 76 std::unique_ptr<CompositorFrame> last_sent_frame_;
114 size_t num_sent_frames_ = 0; 77 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_; 78 TransferableResourceArray resources_held_by_parent_;
120 OverlayCandidateValidator* overlay_candidate_validator_ = nullptr;
121 bool last_swap_rect_valid_ = false; 79 bool last_swap_rect_valid_ = false;
122 gfx::Rect last_swap_rect_; 80 gfx::Rect last_swap_rect_;
123 }; 81 };
124 82
125 } // namespace cc 83 } // namespace cc
126 84
127 #endif // CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_H_ 85 #endif // CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_H_
OLDNEW
« no previous file with comments | « cc/surfaces/display.cc ('k') | cc/test/fake_compositor_frame_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698