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

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

Issue 2002303002: Consolidate OutputSurface constructors into GL vs Vulkan. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: outputsurface-constructors: ozonesmallerdiff 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
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 OutputSurface(scoped_refptr<ContextProvider> context_provider, 49 // Constructor for GL-based and/or software compositing.
50 scoped_refptr<ContextProvider> worker_context_provider, 50 explicit OutputSurface(scoped_refptr<ContextProvider> context_provider,
piman 2016/05/23 23:12:38 nit: no need for explicit?
danakj 2016/05/23 23:16:01 Kinda but actually I think you can hit multi-param
51 scoped_refptr<VulkanContextProvider> vulkan_context_provider, 51 scoped_refptr<ContextProvider> worker_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);
57 53
58 OutputSurface(scoped_refptr<ContextProvider> context_provider, 54 // Constructor for Vulkan-based compositing.
59 std::unique_ptr<SoftwareOutputDevice> software_device); 55 explicit OutputSurface(
56 scoped_refptr<VulkanContextProvider> vulkan_context_provider);
60 57
61 ~OutputSurface() override; 58 ~OutputSurface() override;
62 59
63 struct Capabilities { 60 struct Capabilities {
64 Capabilities() 61 Capabilities()
65 : delegated_rendering(false), 62 : delegated_rendering(false),
66 max_frames_pending(1), 63 max_frames_pending(1),
67 adjust_deadline_for_parent(true), 64 adjust_deadline_for_parent(true),
68 uses_default_gl_framebuffer(true), 65 uses_default_gl_framebuffer(true),
69 flipped_output_surface(false), 66 flipped_output_surface(false),
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 virtual void SetWorkerContextShouldAggressivelyFreeResources(bool is_visible); 162 virtual void SetWorkerContextShouldAggressivelyFreeResources(bool is_visible);
166 163
167 // If this returns true, then the surface will not attempt to draw. 164 // If this returns true, then the surface will not attempt to draw.
168 virtual bool SurfaceIsSuspendForRecycle() const; 165 virtual bool SurfaceIsSuspendForRecycle() const;
169 166
170 // base::trace_event::MemoryDumpProvider implementation. 167 // base::trace_event::MemoryDumpProvider implementation.
171 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, 168 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
172 base::trace_event::ProcessMemoryDump* pmd) override; 169 base::trace_event::ProcessMemoryDump* pmd) override;
173 170
174 protected: 171 protected:
175 OutputSurfaceClient* client_; 172 void PostSwapBuffersComplete();
176 173
177 void PostSwapBuffersComplete(); 174 OutputSurfaceClient* client_ = nullptr;
178 175
179 struct OutputSurface::Capabilities capabilities_; 176 struct OutputSurface::Capabilities capabilities_;
180 scoped_refptr<ContextProvider> context_provider_; 177 scoped_refptr<ContextProvider> context_provider_;
181 scoped_refptr<ContextProvider> worker_context_provider_; 178 scoped_refptr<ContextProvider> worker_context_provider_;
182 scoped_refptr<VulkanContextProvider> vulkan_context_provider_; 179 scoped_refptr<VulkanContextProvider> vulkan_context_provider_;
183 std::unique_ptr<SoftwareOutputDevice> software_device_; 180 std::unique_ptr<SoftwareOutputDevice> software_device_;
184 gfx::Size surface_size_; 181 gfx::Size surface_size_;
185 float device_scale_factor_; 182 float device_scale_factor_ = -1;
186 bool has_alpha_; 183 bool has_alpha_ = true;
187 base::ThreadChecker client_thread_checker_; 184 base::ThreadChecker client_thread_checker_;
188 185
189 void SetNeedsRedrawRect(const gfx::Rect& damage_rect); 186 void SetNeedsRedrawRect(const gfx::Rect& damage_rect);
190 void ReclaimResources(const CompositorFrameAck* ack); 187 void ReclaimResources(const CompositorFrameAck* ack);
191 void SetExternalStencilTest(bool enabled); 188 void SetExternalStencilTest(bool enabled);
192 void DetachFromClientInternal(); 189 void DetachFromClientInternal();
193 190
194 private: 191 private:
195 bool external_stencil_test_enabled_; 192 bool external_stencil_test_enabled_ = false;
196 193
197 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; 194 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_;
198 195
199 DISALLOW_COPY_AND_ASSIGN(OutputSurface); 196 DISALLOW_COPY_AND_ASSIGN(OutputSurface);
200 }; 197 };
201 198
202 } // namespace cc 199 } // namespace cc
203 200
204 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ 201 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698