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

Side by Side Diff: cc/output/output_surface.h

Issue 2329623003: cc: Remove unneeded methods from OutputSurface. (Closed)
Patch Set: shrink-os-api: moreblimp 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
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_OUTPUT_OUTPUT_SURFACE_H_ 5 #ifndef CC_OUTPUT_OUTPUT_SURFACE_H_
6 #define CC_OUTPUT_OUTPUT_SURFACE_H_ 6 #define CC_OUTPUT_OUTPUT_SURFACE_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 // If this returns true, then the surface will not attempt to draw. 113 // If this returns true, then the surface will not attempt to draw.
114 virtual bool SurfaceIsSuspendForRecycle() const; 114 virtual bool SurfaceIsSuspendForRecycle() const;
115 115
116 virtual void Reshape(const gfx::Size& size, 116 virtual void Reshape(const gfx::Size& size,
117 float scale_factor, 117 float scale_factor,
118 const gfx::ColorSpace& color_space, 118 const gfx::ColorSpace& color_space,
119 bool alpha); 119 bool alpha);
120 gfx::Size SurfaceSize() const { return surface_size_; } 120 gfx::Size SurfaceSize() const { return surface_size_; }
121 121
122 virtual bool HasExternalStencilTest() const;
122 virtual void ApplyExternalStencil(); 123 virtual void ApplyExternalStencil();
123 virtual bool HasExternalStencilTest() const;
124 124
125 // ============== CONTENT COLLATOR ONLY ========================= 125 // ============== CONTENT COLLATOR ONLY =========================
126 126
127 // If supported, this causes a ReclaimResources for all resources that are 127 // If supported, this causes a ReclaimResources for all resources that are
128 // currently in use. 128 // currently in use.
129 virtual void ForceReclaimResources() {} 129 virtual void ForceReclaimResources() {}
130 130
131 virtual void BindFramebuffer(); 131 virtual void BindFramebuffer();
132 // Gives the GL internal format that should be used for calling CopyTexImage2D 132 // Gives the GL internal format that should be used for calling CopyTexImage2D
133 // when the framebuffer is bound via BindFramebuffer(). 133 // when the framebuffer is bound via BindFramebuffer().
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 return software_device_.get(); 173 return software_device_.get();
174 } 174 }
175 175
176 // The implementation may destroy or steal the contents of the CompositorFrame 176 // The implementation may destroy or steal the contents of the CompositorFrame
177 // passed in (though it will not take ownership of the CompositorFrame 177 // passed in (though it will not take ownership of the CompositorFrame
178 // itself). For successful swaps, the implementation must call 178 // itself). For successful swaps, the implementation must call
179 // DidSwapBuffersComplete() (via OnSwapBuffersComplete()) eventually. 179 // DidSwapBuffersComplete() (via OnSwapBuffersComplete()) eventually.
180 virtual void SwapBuffers(CompositorFrame frame) = 0; 180 virtual void SwapBuffers(CompositorFrame frame) = 0;
181 virtual void OnSwapBuffersComplete(); 181 virtual void OnSwapBuffersComplete();
182 182
183 // This is how LayerTreeHostImpl hears about context loss when the Display
184 // is the one listening for context loss. Also used internally for the
185 // context provider to inform the LayerTreeHostImpl or Display about loss.
186 // It would become display-compositor-only when LayerTreeHostImpl receives
187 // its contexts independently from the "OutputSurface".
188 // TODO(danakj): Be private. Subclasses should just call the client directly.
189 virtual void DidLoseOutputSurface();
190
191 // base::trace_event::MemoryDumpProvider implementation. 183 // base::trace_event::MemoryDumpProvider implementation.
192 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, 184 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
193 base::trace_event::ProcessMemoryDump* pmd) override; 185 base::trace_event::ProcessMemoryDump* pmd) override;
194 186
195 protected: 187 protected:
196 // ============== DISPLAY COMPOSITOR ONLY =======================
197
198 // Used by WebView for the display compositor only.
199 // TODO(danakj): This should go away, store the state in the subclass that
200 // uses this.
201 void SetExternalStencilTest(bool enabled);
202
203 // ============== BOTH TYPES OF COMPOSITOR ======================
204
205 // This is used by both display and delegating implementations. 188 // This is used by both display and delegating implementations.
206 void PostSwapBuffersComplete(); 189 void PostSwapBuffersComplete();
207 // TODO(danakj): Delete this. Subclasses should just call the client directly.
208 void SetNeedsRedrawRect(const gfx::Rect& damage_rect);
209 // TODO(danakj): Delete this. Subclasses should just call the client directly.
210 void ReclaimResources(const ReturnedResourceArray& resources);
211 190
212 OutputSurfaceClient* client_ = nullptr; 191 OutputSurfaceClient* client_ = nullptr;
213 192
214 struct OutputSurface::Capabilities capabilities_; 193 struct OutputSurface::Capabilities capabilities_;
215 scoped_refptr<ContextProvider> context_provider_; 194 scoped_refptr<ContextProvider> context_provider_;
216 scoped_refptr<ContextProvider> worker_context_provider_; 195 scoped_refptr<ContextProvider> worker_context_provider_;
217 scoped_refptr<VulkanContextProvider> vulkan_context_provider_; 196 scoped_refptr<VulkanContextProvider> vulkan_context_provider_;
218 std::unique_ptr<SoftwareOutputDevice> software_device_; 197 std::unique_ptr<SoftwareOutputDevice> software_device_;
219 gfx::Size surface_size_; 198 gfx::Size surface_size_;
220 float device_scale_factor_ = -1; 199 float device_scale_factor_ = -1;
221 gfx::ColorSpace device_color_space_; 200 gfx::ColorSpace device_color_space_;
222 bool has_alpha_ = true; 201 bool has_alpha_ = true;
223 gfx::ColorSpace color_space_; 202 gfx::ColorSpace color_space_;
224 base::ThreadChecker client_thread_checker_; 203 base::ThreadChecker client_thread_checker_;
225 204
226 private: 205 private:
227 void DetachFromClientInternal(); 206 void DetachFromClientInternal();
228 207
229 bool external_stencil_test_enabled_ = false; 208 // This is how LayerTreeHostImpl hears about context loss when the Display
209 // is the one listening for context loss. Also used internally for the
210 // context provider to inform the LayerTreeHostImpl or Display about loss.
211 // It would become display-compositor-only when LayerTreeHostImpl receives
212 // its contexts independently from the "OutputSurface".
213 void DidLoseOutputSurface();
214
230 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; 215 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_;
231 216
232 DISALLOW_COPY_AND_ASSIGN(OutputSurface); 217 DISALLOW_COPY_AND_ASSIGN(OutputSurface);
233 }; 218 };
234 219
235 } // namespace cc 220 } // namespace cc
236 221
237 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ 222 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698