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

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

Issue 2352963002: cc: Make most of cc::OutputSurface abstract. (Closed)
Patch Set: outputsurface-cleanup: rebase Created 4 years, 2 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/output/overlay_unittest.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"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 return surface; 60 return surface;
61 } 61 }
62 62
63 void set_max_frames_pending(int max) { 63 void set_max_frames_pending(int max) {
64 capabilities_.max_frames_pending = max; 64 capabilities_.max_frames_pending = max;
65 } 65 }
66 66
67 CompositorFrame* last_sent_frame() { return last_sent_frame_.get(); } 67 CompositorFrame* last_sent_frame() { return last_sent_frame_.get(); }
68 size_t num_sent_frames() { return num_sent_frames_; } 68 size_t num_sent_frames() { return num_sent_frames_; }
69 69
70 OutputSurfaceClient* client() { return client_; }
71
72 bool BindToClient(OutputSurfaceClient* client) override;
73 void EnsureBackbuffer() override {}
74 void DiscardBackbuffer() override {}
75 void BindFramebuffer() override;
70 void SwapBuffers(CompositorFrame frame) override; 76 void SwapBuffers(CompositorFrame frame) override;
71 77 uint32_t GetFramebufferCopyTextureFormat() override;
72 OutputSurfaceClient* client() { return client_; } 78 bool HasExternalStencilTest() const override;
73 bool BindToClient(OutputSurfaceClient* client) override; 79 void ApplyExternalStencil() override {}
74 void DetachFromClient() override; 80 bool SurfaceIsSuspendForRecycle() const override;
81 OverlayCandidateValidator* GetOverlayCandidateValidator() const override;
82 bool IsDisplayedAsOverlayPlane() const override;
83 unsigned GetOverlayTextureId() const override;
75 84
76 void set_framebuffer(GLint framebuffer, GLenum format) { 85 void set_framebuffer(GLint framebuffer, GLenum format) {
77 framebuffer_ = framebuffer; 86 framebuffer_ = framebuffer;
78 framebuffer_format_ = format; 87 framebuffer_format_ = format;
79 } 88 }
80 void BindFramebuffer() override;
81 uint32_t GetFramebufferCopyTextureFormat() override;
82 89
83 const TransferableResourceArray& resources_held_by_parent() {
84 return resources_held_by_parent_;
85 }
86
87 bool HasExternalStencilTest() const override;
88
89 bool SurfaceIsSuspendForRecycle() const override;
90
91 OverlayCandidateValidator* GetOverlayCandidateValidator() const override;
92 void SetOverlayCandidateValidator(OverlayCandidateValidator* validator) { 90 void SetOverlayCandidateValidator(OverlayCandidateValidator* validator) {
93 overlay_candidate_validator_ = validator; 91 overlay_candidate_validator_ = validator;
94 } 92 }
95 93
96 void set_has_external_stencil_test(bool has_test) { 94 void set_has_external_stencil_test(bool has_test) {
97 has_external_stencil_test_ = has_test; 95 has_external_stencil_test_ = has_test;
98 } 96 }
99 97
100 void set_suspended_for_recycle(bool suspended) { 98 void set_suspended_for_recycle(bool suspended) {
101 suspended_for_recycle_ = suspended; 99 suspended_for_recycle_ = suspended;
102 } 100 }
103 101
104 gfx::Rect last_swap_rect() const { 102 gfx::Rect last_swap_rect() const {
105 DCHECK(last_swap_rect_valid_); 103 DCHECK(last_swap_rect_valid_);
106 return last_swap_rect_; 104 return last_swap_rect_;
107 } 105 }
108 106
109 void ReturnResourcesHeldByParent(); 107 void ReturnResourcesHeldByParent();
110 108
109 const TransferableResourceArray& resources_held_by_parent() {
110 return resources_held_by_parent_;
111 }
112
111 protected: 113 protected:
112 explicit FakeOutputSurface(scoped_refptr<ContextProvider> context_provider); 114 explicit FakeOutputSurface(scoped_refptr<ContextProvider> context_provider);
113 explicit FakeOutputSurface( 115 explicit FakeOutputSurface(
114 std::unique_ptr<SoftwareOutputDevice> software_device); 116 std::unique_ptr<SoftwareOutputDevice> software_device);
115 117
116 OutputSurfaceClient* client_ = nullptr; 118 OutputSurfaceClient* client_ = nullptr;
117 std::unique_ptr<CompositorFrame> last_sent_frame_; 119 std::unique_ptr<CompositorFrame> last_sent_frame_;
118 size_t num_sent_frames_ = 0; 120 size_t num_sent_frames_ = 0;
119 bool has_external_stencil_test_ = false; 121 bool has_external_stencil_test_ = false;
120 bool suspended_for_recycle_ = false; 122 bool suspended_for_recycle_ = false;
121 GLint framebuffer_ = 0; 123 GLint framebuffer_ = 0;
122 GLenum framebuffer_format_ = 0; 124 GLenum framebuffer_format_ = 0;
123 TransferableResourceArray resources_held_by_parent_; 125 TransferableResourceArray resources_held_by_parent_;
124 OverlayCandidateValidator* overlay_candidate_validator_ = nullptr; 126 OverlayCandidateValidator* overlay_candidate_validator_ = nullptr;
125 bool last_swap_rect_valid_ = false; 127 bool last_swap_rect_valid_ = false;
126 gfx::Rect last_swap_rect_; 128 gfx::Rect last_swap_rect_;
127 }; 129 };
128 130
129 } // namespace cc 131 } // namespace cc
130 132
131 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ 133 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_
OLDNEW
« no previous file with comments | « cc/output/overlay_unittest.cc ('k') | cc/test/fake_output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698