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

Side by Side Diff: blimp/client/core/compositor/blimp_compositor.h

Issue 2337913003: Fork cc::OutputSurface into cc::CompositorFrameSink. (Closed)
Patch Set: cfsfork: ccperftests2 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_H_ 5 #ifndef BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_H_
6 #define BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_H_ 6 #define BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "blimp/client/core/compositor/blimp_output_surface.h" 12 #include "blimp/client/core/compositor/blimp_compositor_frame_sink_proxy.h"
13 #include "blimp/client/core/input/blimp_input_manager.h" 13 #include "blimp/client/core/input/blimp_input_manager.h"
14 #include "blimp/client/public/compositor/compositor_dependencies.h" 14 #include "blimp/client/public/compositor/compositor_dependencies.h"
15 #include "cc/surfaces/surface_factory_client.h" 15 #include "cc/surfaces/surface_factory_client.h"
16 #include "cc/trees/layer_tree_host.h" 16 #include "cc/trees/layer_tree_host.h"
17 #include "cc/trees/layer_tree_host_client.h" 17 #include "cc/trees/layer_tree_host_client.h"
18 #include "cc/trees/layer_tree_settings.h" 18 #include "cc/trees/layer_tree_settings.h"
19 #include "cc/trees/remote_proto_channel.h" 19 #include "cc/trees/remote_proto_channel.h"
20 #include "ui/gfx/geometry/size.h" 20 #include "ui/gfx/geometry/size.h"
21 #include "ui/gfx/native_widget_types.h" 21 #include "ui/gfx/native_widget_types.h"
22 22
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // performs the compositing work for the remote server LayerTreeHost. The server 74 // performs the compositing work for the remote server LayerTreeHost. The server
75 // LayerTreeHost for a BlimpCompositor is owned by the 75 // LayerTreeHost for a BlimpCompositor is owned by the
76 // content::RenderWidgetCompositor. Thus, each BlimpCompositor is tied to a 76 // content::RenderWidgetCompositor. Thus, each BlimpCompositor is tied to a
77 // RenderWidget, identified by a custom |render_widget_id| generated on the 77 // RenderWidget, identified by a custom |render_widget_id| generated on the
78 // engine. The lifetime of this compositor is controlled by its corresponding 78 // engine. The lifetime of this compositor is controlled by its corresponding
79 // RenderWidget. 79 // RenderWidget.
80 // This class should only be accessed from the main thread. 80 // This class should only be accessed from the main thread.
81 class BlimpCompositor : public cc::LayerTreeHostClient, 81 class BlimpCompositor : public cc::LayerTreeHostClient,
82 public cc::RemoteProtoChannel, 82 public cc::RemoteProtoChannel,
83 public BlimpInputManagerClient, 83 public BlimpInputManagerClient,
84 public BlimpOutputSurfaceClient, 84 public BlimpCompositorFrameSinkProxy,
85 public cc::SurfaceFactoryClient { 85 public cc::SurfaceFactoryClient {
86 public: 86 public:
87 BlimpCompositor(const int render_widget_id, 87 BlimpCompositor(const int render_widget_id,
88 BlimpCompositorDependencies* compositor_dependencies, 88 BlimpCompositorDependencies* compositor_dependencies,
89 BlimpCompositorClient* client); 89 BlimpCompositorClient* client);
90 90
91 ~BlimpCompositor() override; 91 ~BlimpCompositor() override;
92 92
93 virtual void SetVisible(bool visible); 93 virtual void SetVisible(bool visible);
94 94
(...skipping 18 matching lines...) Expand all
113 void WillBeginMainFrame() override {} 113 void WillBeginMainFrame() override {}
114 void DidBeginMainFrame() override {} 114 void DidBeginMainFrame() override {}
115 void BeginMainFrame(const cc::BeginFrameArgs& args) override {} 115 void BeginMainFrame(const cc::BeginFrameArgs& args) override {}
116 void BeginMainFrameNotExpectedSoon() override {} 116 void BeginMainFrameNotExpectedSoon() override {}
117 void UpdateLayerTreeHost() override {} 117 void UpdateLayerTreeHost() override {}
118 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, 118 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
119 const gfx::Vector2dF& outer_delta, 119 const gfx::Vector2dF& outer_delta,
120 const gfx::Vector2dF& elastic_overscroll_delta, 120 const gfx::Vector2dF& elastic_overscroll_delta,
121 float page_scale, 121 float page_scale,
122 float top_controls_delta) override {} 122 float top_controls_delta) override {}
123 void RequestNewOutputSurface() override; 123 void RequestNewCompositorFrameSink() override;
124 void DidInitializeOutputSurface() override; 124 void DidInitializeCompositorFrameSink() override;
125 // TODO(khushalsagar): Need to handle context initialization failures. 125 // TODO(khushalsagar): Need to handle context initialization failures.
126 void DidFailToInitializeOutputSurface() override {} 126 void DidFailToInitializeCompositorFrameSink() override {}
127 void WillCommit() override {} 127 void WillCommit() override {}
128 void DidCommit() override {} 128 void DidCommit() override {}
129 void DidCommitAndDrawFrame() override; 129 void DidCommitAndDrawFrame() override;
130 void DidCompleteSwapBuffers() override {} 130 void DidCompleteSwapBuffers() override {}
131 void DidCompletePageScaleAnimation() override {} 131 void DidCompletePageScaleAnimation() override {}
132 132
133 // RemoteProtoChannel implementation. 133 // RemoteProtoChannel implementation.
134 void SetProtoReceiver(ProtoReceiver* receiver) override; 134 void SetProtoReceiver(ProtoReceiver* receiver) override;
135 void SendCompositorProto(const cc::proto::CompositorMessage& proto) override; 135 void SendCompositorProto(const cc::proto::CompositorMessage& proto) override;
136 136
137 // BlimpInputManagerClient implementation. 137 // BlimpInputManagerClient implementation.
138 void SendWebGestureEvent( 138 void SendWebGestureEvent(
139 const blink::WebGestureEvent& gesture_event) override; 139 const blink::WebGestureEvent& gesture_event) override;
140 140
141 // BlimpOutputSurfaceClient implementation. 141 // BlimpCompositorFrameSinkProxy implementation.
142 void BindToOutputSurface( 142 void BindToProxyClient(
143 base::WeakPtr<BlimpOutputSurface> output_surface) override; 143 base::WeakPtr<BlimpCompositorFrameSinkProxyClient> proxy_client) override;
144 void SwapCompositorFrame(cc::CompositorFrame frame) override; 144 void SwapCompositorFrame(cc::CompositorFrame frame) override;
145 void UnbindOutputSurface() override; 145 void UnbindProxyClient() override;
146 146
147 // SurfaceFactoryClient implementation. 147 // SurfaceFactoryClient implementation.
148 void ReturnResources(const cc::ReturnedResourceArray& resources) override; 148 void ReturnResources(const cc::ReturnedResourceArray& resources) override;
149 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override {} 149 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override {}
150 150
151 // Called when the a ContextProvider has been created by the 151 // Called when the a ContextProvider has been created by the
152 // CompositorDependencies class. If |host_| is waiting on an OutputSurface 152 // CompositorDependencies class. If |host_| is waiting on an
153 // CompositorFrameSink
Khushal 2016/09/14 03:10:35 The comment looks off?
danakj 2016/09/14 17:17:12 Done.
153 // this will build one for it. 154 // this will build one for it.
154 void OnContextProvidersCreated( 155 void OnContextProvidersCreated(
155 const scoped_refptr<cc::ContextProvider>& compositor_context_provider, 156 const scoped_refptr<cc::ContextProvider>& compositor_context_provider,
156 const scoped_refptr<cc::ContextProvider>& worker_context_provider); 157 const scoped_refptr<cc::ContextProvider>& worker_context_provider);
157 158
158 // Helper method to get the embedder dependencies. 159 // Helper method to get the embedder dependencies.
159 CompositorDependencies* GetEmbedderDeps(); 160 CompositorDependencies* GetEmbedderDeps();
160 161
161 // TODO(khushalsagar): Move all of this to the |DocumentView| or another 162 // TODO(khushalsagar): Move all of this to the |DocumentView| or another
162 // platform specific class. So we use the DelegatedFrameHostAndroid like the 163 // platform specific class. So we use the DelegatedFrameHostAndroid like the
(...skipping 10 matching lines...) Expand all
173 174
174 // The unique identifier for the render widget for this compositor. 175 // The unique identifier for the render widget for this compositor.
175 const int render_widget_id_; 176 const int render_widget_id_;
176 177
177 BlimpCompositorClient* client_; 178 BlimpCompositorClient* client_;
178 179
179 BlimpCompositorDependencies* compositor_dependencies_; 180 BlimpCompositorDependencies* compositor_dependencies_;
180 181
181 std::unique_ptr<cc::LayerTreeHostInterface> host_; 182 std::unique_ptr<cc::LayerTreeHostInterface> host_;
182 183
183 // The SurfaceFactory is bound to the lifetime of the BlimpOutputSurface. When 184 // The SurfaceFactory is bound to the lifetime of the |proxy_client_|. When
184 // detached, the surface factory will be destroyed. 185 // detached, the surface factory will be destroyed.
185 std::unique_ptr<cc::SurfaceFactory> surface_factory_; 186 std::unique_ptr<cc::SurfaceFactory> surface_factory_;
186 base::WeakPtr<BlimpOutputSurface> output_surface_; 187 base::WeakPtr<BlimpCompositorFrameSinkProxyClient> proxy_client_;
187 188
188 // Whether or not |host_| has asked for an output surface. 189 // Whether or not |host_| has asked for a new CompositorFrameSink.
189 bool output_surface_request_pending_; 190 bool compositor_frame_sink_request_pending_;
190 191
191 // Data for the current frame. 192 // Data for the current frame.
192 cc::SurfaceId surface_id_; 193 cc::SurfaceId surface_id_;
193 gfx::Size current_surface_size_; 194 gfx::Size current_surface_size_;
194 195
195 base::ThreadChecker thread_checker_; 196 base::ThreadChecker thread_checker_;
196 197
197 // Surfaces related stuff and layer which holds the delegated content from the 198 // Surfaces related stuff and layer which holds the delegated content from the
198 // compositor. 199 // compositor.
199 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; 200 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_;
(...skipping 12 matching lines...) Expand all
212 213
213 base::WeakPtrFactory<BlimpCompositor> weak_ptr_factory_; 214 base::WeakPtrFactory<BlimpCompositor> weak_ptr_factory_;
214 215
215 DISALLOW_COPY_AND_ASSIGN(BlimpCompositor); 216 DISALLOW_COPY_AND_ASSIGN(BlimpCompositor);
216 }; 217 };
217 218
218 } // namespace client 219 } // namespace client
219 } // namespace blimp 220 } // namespace blimp
220 221
221 #endif // BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_H_ 222 #endif // BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698