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

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

Issue 2452483002: Move GpuMemoryBufferManager and SharedBitmapManager to CompositorFrameSink (Closed)
Patch Set: compile fixes Created 4 years, 1 month 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_COMPOSITOR_FRAME_SINK_H_ 5 #ifndef CC_OUTPUT_COMPOSITOR_FRAME_SINK_H_
6 #define CC_OUTPUT_COMPOSITOR_FRAME_SINK_H_ 6 #define CC_OUTPUT_COMPOSITOR_FRAME_SINK_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 12 matching lines...) Expand all
23 class LatencyInfo; 23 class LatencyInfo;
24 } 24 }
25 25
26 namespace gfx { 26 namespace gfx {
27 class ColorSpace; 27 class ColorSpace;
28 class Rect; 28 class Rect;
29 class Size; 29 class Size;
30 class Transform; 30 class Transform;
31 } 31 }
32 32
33 namespace gpu {
34 class GpuMemoryBufferManager;
35 }
36
33 namespace cc { 37 namespace cc {
34 38
35 class CompositorFrame; 39 class CompositorFrame;
36 struct ManagedMemoryPolicy; 40 struct ManagedMemoryPolicy;
37 class CompositorFrameSinkClient; 41 class CompositorFrameSinkClient;
42 class SharedBitmapManager;
38 43
39 // An interface for submitting CompositorFrames to a display compositor 44 // An interface for submitting CompositorFrames to a display compositor
40 // which will compose frames from multiple CompositorFrameSinks to show 45 // which will compose frames from multiple CompositorFrameSinks to show
41 // on screen to the user. 46 // on screen to the user.
42 // If a context_provider() is present, frames should be submitted with 47 // If a context_provider() is present, frames should be submitted with
43 // OpenGL resources (created with the context_provider()). If not, then 48 // OpenGL resources (created with the context_provider()). If not, then
44 // SharedBitmap resources should be used. 49 // SharedBitmap resources should be used.
45 class CC_EXPORT CompositorFrameSink { 50 class CC_EXPORT CompositorFrameSink {
46 public: 51 public:
47 struct Capabilities { 52 struct Capabilities {
48 Capabilities() = default; 53 Capabilities() = default;
49 54
50 // Whether ForceReclaimResources can be called to reclaim all resources 55 // Whether ForceReclaimResources can be called to reclaim all resources
51 // from the CompositorFrameSink. 56 // from the CompositorFrameSink.
52 bool can_force_reclaim_resources = false; 57 bool can_force_reclaim_resources = false;
53 // True if sync points for resources are needed when swapping delegated 58 // True if sync points for resources are needed when swapping delegated
54 // frames. 59 // frames.
55 bool delegated_sync_points_required = true; 60 bool delegated_sync_points_required = true;
56 }; 61 };
57 62
58 // Constructor for GL-based and/or software resources. 63 // Constructor for GL-based and/or software resources.
64 // gpu_memory_buffer_manager and shared_bitmap_manager must outlive the
65 // CompositorFrameSink.
66 // shared_bitmap_manager is optional (won't be used) if context_provider is
danakj 2016/10/27 21:00:34 Maybe we should have 2 constructors at this point?
piman 2016/10/28 00:58:36 So, that's what we used to have in the past iirc.
67 // present.
68 // gpu_memory_buffer_manager is optional (won't be used) if context_provider
69 // is not present.
59 CompositorFrameSink(scoped_refptr<ContextProvider> context_provider, 70 CompositorFrameSink(scoped_refptr<ContextProvider> context_provider,
60 scoped_refptr<ContextProvider> worker_context_provider); 71 scoped_refptr<ContextProvider> worker_context_provider,
72 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
73 SharedBitmapManager* shared_bitmap_manager);
61 74
62 // Constructor for Vulkan-based resources. 75 // Constructor for Vulkan-based resources.
63 explicit CompositorFrameSink( 76 explicit CompositorFrameSink(
64 scoped_refptr<VulkanContextProvider> vulkan_context_provider); 77 scoped_refptr<VulkanContextProvider> vulkan_context_provider);
65 78
66 virtual ~CompositorFrameSink(); 79 virtual ~CompositorFrameSink();
67 80
68 // Called by the compositor on the compositor thread. This is a place where 81 // Called by the compositor on the compositor thread. This is a place where
69 // thread-specific data for the output surface can be initialized, since from 82 // thread-specific data for the output surface can be initialized, since from
70 // this point to when DetachFromClient() is called the output surface will 83 // this point to when DetachFromClient() is called the output surface will
(...skipping 15 matching lines...) Expand all
86 99
87 // The ContextProviders may be null if frames should be submitted with 100 // The ContextProviders may be null if frames should be submitted with
88 // software SharedBitmap resources. 101 // software SharedBitmap resources.
89 ContextProvider* context_provider() const { return context_provider_.get(); } 102 ContextProvider* context_provider() const { return context_provider_.get(); }
90 ContextProvider* worker_context_provider() const { 103 ContextProvider* worker_context_provider() const {
91 return worker_context_provider_.get(); 104 return worker_context_provider_.get();
92 } 105 }
93 VulkanContextProvider* vulkan_context_provider() const { 106 VulkanContextProvider* vulkan_context_provider() const {
94 return vulkan_context_provider_.get(); 107 return vulkan_context_provider_.get();
95 } 108 }
109 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() const {
110 return gpu_memory_buffer_manager_;
111 }
112 SharedBitmapManager* shared_bitmap_manager() const {
113 return shared_bitmap_manager_;
114 }
96 115
97 // If supported, this causes a ReclaimResources for all resources that are 116 // If supported, this causes a ReclaimResources for all resources that are
98 // currently in use. 117 // currently in use.
99 virtual void ForceReclaimResources() {} 118 virtual void ForceReclaimResources() {}
100 119
101 // Support for a pull-model where draws are requested by the output surface. 120 // Support for a pull-model where draws are requested by the output surface.
102 // 121 //
103 // CompositorFrameSink::Invalidate is called by the compositor to notify that 122 // CompositorFrameSink::Invalidate is called by the compositor to notify that
104 // there's new content. 123 // there's new content.
105 virtual void Invalidate() {} 124 virtual void Invalidate() {}
106 125
107 // For successful swaps, the implementation must call 126 // For successful swaps, the implementation must call
108 // DidReceiveCompositorFrameAck() asynchronously when the frame has been 127 // DidReceiveCompositorFrameAck() asynchronously when the frame has been
109 // processed in order to unthrottle the next frame. 128 // processed in order to unthrottle the next frame.
110 virtual void SubmitCompositorFrame(CompositorFrame frame) = 0; 129 virtual void SubmitCompositorFrame(CompositorFrame frame) = 0;
111 130
112 protected: 131 protected:
113 // Bound to the ContextProvider to hear about when it is lost and inform the 132 // Bound to the ContextProvider to hear about when it is lost and inform the
114 // |client_|. 133 // |client_|.
115 void DidLoseCompositorFrameSink(); 134 void DidLoseCompositorFrameSink();
116 135
117 CompositorFrameSinkClient* client_ = nullptr; 136 CompositorFrameSinkClient* client_ = nullptr;
118 137
119 struct CompositorFrameSink::Capabilities capabilities_; 138 struct CompositorFrameSink::Capabilities capabilities_;
120 scoped_refptr<ContextProvider> context_provider_; 139 scoped_refptr<ContextProvider> context_provider_;
121 scoped_refptr<ContextProvider> worker_context_provider_; 140 scoped_refptr<ContextProvider> worker_context_provider_;
122 scoped_refptr<VulkanContextProvider> vulkan_context_provider_; 141 scoped_refptr<VulkanContextProvider> vulkan_context_provider_;
142 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
143 SharedBitmapManager* shared_bitmap_manager_;
123 base::ThreadChecker client_thread_checker_; 144 base::ThreadChecker client_thread_checker_;
124 145
125 private: 146 private:
126 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSink); 147 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSink);
127 }; 148 };
128 149
129 } // namespace cc 150 } // namespace cc
130 151
131 #endif // CC_OUTPUT_COMPOSITOR_FRAME_SINK_H_ 152 #endif // CC_OUTPUT_COMPOSITOR_FRAME_SINK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698