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

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

Issue 2009443002: Revert of Consolidate OutputSurface constructors into GL vs Vulkan. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/gl_renderer_unittest.cc ('k') | cc/output/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_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 28 matching lines...) Expand all
39 39
40 // Represents the output surface for a compositor. The compositor owns 40 // Represents the output surface for a compositor. The compositor owns
41 // and manages its destruction. Its lifetime is: 41 // and manages its destruction. Its lifetime is:
42 // 1. Created on the main thread by the LayerTreeHost through its client. 42 // 1. Created on the main thread by the LayerTreeHost through its client.
43 // 2. Passed to the compositor thread and bound to a client via BindToClient. 43 // 2. Passed to the compositor thread and bound to a client via BindToClient.
44 // From here on, it will only be used on the compositor thread. 44 // From here on, it will only be used on the compositor thread.
45 // 3. If the 3D context is lost, then the compositor will delete the output 45 // 3. If the 3D context is lost, then the compositor will delete the output
46 // surface (on the compositor thread) and go back to step 1. 46 // surface (on the compositor thread) and go back to step 1.
47 class CC_EXPORT OutputSurface : public base::trace_event::MemoryDumpProvider { 47 class CC_EXPORT OutputSurface : public base::trace_event::MemoryDumpProvider {
48 public: 48 public:
49 // Constructor for GL-based and/or software compositing. 49 OutputSurface(scoped_refptr<ContextProvider> context_provider,
50 explicit OutputSurface(scoped_refptr<ContextProvider> context_provider, 50 scoped_refptr<ContextProvider> worker_context_provider,
51 scoped_refptr<ContextProvider> worker_context_provider, 51 scoped_refptr<VulkanContextProvider> vulkan_context_provider,
52 std::unique_ptr<SoftwareOutputDevice> software_device); 52 std::unique_ptr<SoftwareOutputDevice> software_device);
53 OutputSurface(scoped_refptr<ContextProvider> context_provider,
54 scoped_refptr<ContextProvider> worker_context_provider);
55 explicit OutputSurface(scoped_refptr<ContextProvider> context_provider);
56 explicit OutputSurface(std::unique_ptr<SoftwareOutputDevice> software_device);
53 57
54 // Constructor for Vulkan-based compositing. 58 OutputSurface(scoped_refptr<ContextProvider> context_provider,
55 explicit OutputSurface( 59 std::unique_ptr<SoftwareOutputDevice> software_device);
56 scoped_refptr<VulkanContextProvider> vulkan_context_provider);
57 60
58 ~OutputSurface() override; 61 ~OutputSurface() override;
59 62
60 struct Capabilities { 63 struct Capabilities {
61 Capabilities() 64 Capabilities()
62 : delegated_rendering(false), 65 : delegated_rendering(false),
63 max_frames_pending(1), 66 max_frames_pending(1),
64 adjust_deadline_for_parent(true), 67 adjust_deadline_for_parent(true),
65 uses_default_gl_framebuffer(true), 68 uses_default_gl_framebuffer(true),
66 flipped_output_surface(false), 69 flipped_output_surface(false),
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 virtual void SetWorkerContextShouldAggressivelyFreeResources(bool is_visible); 165 virtual void SetWorkerContextShouldAggressivelyFreeResources(bool is_visible);
163 166
164 // If this returns true, then the surface will not attempt to draw. 167 // If this returns true, then the surface will not attempt to draw.
165 virtual bool SurfaceIsSuspendForRecycle() const; 168 virtual bool SurfaceIsSuspendForRecycle() const;
166 169
167 // base::trace_event::MemoryDumpProvider implementation. 170 // base::trace_event::MemoryDumpProvider implementation.
168 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, 171 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
169 base::trace_event::ProcessMemoryDump* pmd) override; 172 base::trace_event::ProcessMemoryDump* pmd) override;
170 173
171 protected: 174 protected:
175 OutputSurfaceClient* client_;
176
172 void PostSwapBuffersComplete(); 177 void PostSwapBuffersComplete();
173 178
174 OutputSurfaceClient* client_ = nullptr;
175
176 struct OutputSurface::Capabilities capabilities_; 179 struct OutputSurface::Capabilities capabilities_;
177 scoped_refptr<ContextProvider> context_provider_; 180 scoped_refptr<ContextProvider> context_provider_;
178 scoped_refptr<ContextProvider> worker_context_provider_; 181 scoped_refptr<ContextProvider> worker_context_provider_;
179 scoped_refptr<VulkanContextProvider> vulkan_context_provider_; 182 scoped_refptr<VulkanContextProvider> vulkan_context_provider_;
180 std::unique_ptr<SoftwareOutputDevice> software_device_; 183 std::unique_ptr<SoftwareOutputDevice> software_device_;
181 gfx::Size surface_size_; 184 gfx::Size surface_size_;
182 float device_scale_factor_ = -1; 185 float device_scale_factor_;
183 bool has_alpha_ = true; 186 bool has_alpha_;
184 base::ThreadChecker client_thread_checker_; 187 base::ThreadChecker client_thread_checker_;
185 188
186 void SetNeedsRedrawRect(const gfx::Rect& damage_rect); 189 void SetNeedsRedrawRect(const gfx::Rect& damage_rect);
187 void ReclaimResources(const CompositorFrameAck* ack); 190 void ReclaimResources(const CompositorFrameAck* ack);
188 void SetExternalStencilTest(bool enabled); 191 void SetExternalStencilTest(bool enabled);
189 void DetachFromClientInternal(); 192 void DetachFromClientInternal();
190 193
191 private: 194 private:
192 bool external_stencil_test_enabled_ = false; 195 bool external_stencil_test_enabled_;
193 196
194 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; 197 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_;
195 198
196 DISALLOW_COPY_AND_ASSIGN(OutputSurface); 199 DISALLOW_COPY_AND_ASSIGN(OutputSurface);
197 }; 200 };
198 201
199 } // namespace cc 202 } // namespace cc
200 203
201 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ 204 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_
OLDNEW
« no previous file with comments | « cc/output/gl_renderer_unittest.cc ('k') | cc/output/output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698