OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_BROWSER_COMPOSITOR_DELEGATED_FRAME_HOST_H_ | 5 #ifndef CONTENT_BROWSER_COMPOSITOR_DELEGATED_FRAME_HOST_H_ |
6 #define CONTENT_BROWSER_COMPOSITOR_DELEGATED_FRAME_HOST_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_DELEGATED_FRAME_HOST_H_ |
7 | 7 |
8 #include "cc/layers/delegated_frame_provider.h" | 8 #include "cc/layers/delegated_frame_provider.h" |
9 #include "cc/layers/delegated_frame_resource_collection.h" | 9 #include "cc/layers/delegated_frame_resource_collection.h" |
10 #include "cc/output/copy_output_result.h" | 10 #include "cc/output/copy_output_result.h" |
11 #include "cc/surfaces/surface_factory_client.h" | |
11 #include "content/browser/compositor/image_transport_factory.h" | 12 #include "content/browser/compositor/image_transport_factory.h" |
12 #include "content/browser/compositor/owned_mailbox.h" | 13 #include "content/browser/compositor/owned_mailbox.h" |
13 #include "content/browser/renderer_host/delegated_frame_evictor.h" | 14 #include "content/browser/renderer_host/delegated_frame_evictor.h" |
14 #include "content/browser/renderer_host/dip_util.h" | 15 #include "content/browser/renderer_host/dip_util.h" |
15 #include "content/browser/renderer_host/render_widget_host_impl.h" | 16 #include "content/browser/renderer_host/render_widget_host_impl.h" |
16 #include "content/public/browser/render_process_host.h" | 17 #include "content/public/browser/render_process_host.h" |
17 #include "ui/compositor/compositor.h" | 18 #include "ui/compositor/compositor.h" |
18 #include "ui/compositor/compositor_observer.h" | 19 #include "ui/compositor/compositor_observer.h" |
19 #include "ui/compositor/compositor_vsync_manager.h" | 20 #include "ui/compositor/compositor_vsync_manager.h" |
20 #include "ui/compositor/layer.h" | 21 #include "ui/compositor/layer.h" |
21 #include "ui/compositor/layer_owner_delegate.h" | 22 #include "ui/compositor/layer_owner_delegate.h" |
22 #include "ui/gfx/rect_conversions.h" | 23 #include "ui/gfx/rect_conversions.h" |
23 | 24 |
25 namespace cc { | |
26 class SurfaceFactory; | |
27 } | |
28 | |
24 namespace media { | 29 namespace media { |
25 class VideoFrame; | 30 class VideoFrame; |
26 } | 31 } |
27 | 32 |
28 namespace content { | 33 namespace content { |
29 | 34 |
30 class DelegatedFrameHost; | 35 class DelegatedFrameHost; |
31 class ReadbackYUVInterface; | 36 class ReadbackYUVInterface; |
32 class RenderWidgetHostViewFrameSubscriber; | 37 class RenderWidgetHostViewFrameSubscriber; |
33 class RenderWidgetHostImpl; | 38 class RenderWidgetHostImpl; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 // and functionality that is associated with delegated frames being sent from | 70 // and functionality that is associated with delegated frames being sent from |
66 // the RenderWidget. The DelegatedFrameHost will push these changes through to | 71 // the RenderWidget. The DelegatedFrameHost will push these changes through to |
67 // the ui::Compositor associated with its DelegatedFrameHostClient. | 72 // the ui::Compositor associated with its DelegatedFrameHostClient. |
68 class CONTENT_EXPORT DelegatedFrameHost | 73 class CONTENT_EXPORT DelegatedFrameHost |
69 : public ui::CompositorObserver, | 74 : public ui::CompositorObserver, |
70 public ui::CompositorVSyncManager::Observer, | 75 public ui::CompositorVSyncManager::Observer, |
71 public ui::LayerOwnerDelegate, | 76 public ui::LayerOwnerDelegate, |
72 public ImageTransportFactoryObserver, | 77 public ImageTransportFactoryObserver, |
73 public DelegatedFrameEvictorClient, | 78 public DelegatedFrameEvictorClient, |
74 public cc::DelegatedFrameResourceCollectionClient, | 79 public cc::DelegatedFrameResourceCollectionClient, |
80 public cc::SurfaceFactoryClient, | |
75 public base::SupportsWeakPtr<DelegatedFrameHost> { | 81 public base::SupportsWeakPtr<DelegatedFrameHost> { |
76 public: | 82 public: |
77 DelegatedFrameHost(DelegatedFrameHostClient* client); | 83 DelegatedFrameHost(DelegatedFrameHostClient* client); |
78 virtual ~DelegatedFrameHost(); | 84 virtual ~DelegatedFrameHost(); |
79 | 85 |
80 bool CanCopyToBitmap() const; | 86 bool CanCopyToBitmap() const; |
81 | 87 |
82 // Public interface exposed to RenderWidgetHostView. | 88 // Public interface exposed to RenderWidgetHostView. |
83 void SwapDelegatedFrame( | 89 void SwapDelegatedFrame( |
84 uint32 output_surface_id, | 90 uint32 output_surface_id, |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 | 211 |
206 void SendDelegatedFrameAck(uint32 output_surface_id); | 212 void SendDelegatedFrameAck(uint32 output_surface_id); |
207 void SendReturnedDelegatedResources(uint32 output_surface_id); | 213 void SendReturnedDelegatedResources(uint32 output_surface_id); |
208 | 214 |
209 // DelegatedFrameEvictorClient implementation. | 215 // DelegatedFrameEvictorClient implementation. |
210 virtual void EvictDelegatedFrame() OVERRIDE; | 216 virtual void EvictDelegatedFrame() OVERRIDE; |
211 | 217 |
212 // cc::DelegatedFrameProviderClient implementation. | 218 // cc::DelegatedFrameProviderClient implementation. |
213 virtual void UnusedResourcesAreAvailable() OVERRIDE; | 219 virtual void UnusedResourcesAreAvailable() OVERRIDE; |
214 | 220 |
221 // cc::SurfaceFactoryClient implementation. | |
222 virtual void ReturnResources( | |
223 const cc::ReturnedResourceArray& resources) OVERRIDE; | |
224 | |
215 void DidReceiveFrameFromRenderer(); | 225 void DidReceiveFrameFromRenderer(); |
216 | 226 |
217 DelegatedFrameHostClient* client_; | 227 DelegatedFrameHostClient* client_; |
218 | 228 |
229 // True if this renders into a Surface, false if it renders into a delegated | |
230 // layer. | |
231 bool use_surfaces_; | |
232 | |
219 std::vector<base::Closure> on_compositing_did_commit_callbacks_; | 233 std::vector<base::Closure> on_compositing_did_commit_callbacks_; |
220 | 234 |
221 // The vsync manager we are observing for changes, if any. | 235 // The vsync manager we are observing for changes, if any. |
222 scoped_refptr<ui::CompositorVSyncManager> vsync_manager_; | 236 scoped_refptr<ui::CompositorVSyncManager> vsync_manager_; |
223 | 237 |
224 // With delegated renderer, this is the last output surface, used to | 238 // With delegated renderer, this is the last output surface, used to |
225 // disambiguate resources with the same id coming from different output | 239 // disambiguate resources with the same id coming from different output |
226 // surfaces. | 240 // surfaces. |
227 uint32 last_output_surface_id_; | 241 uint32 last_output_surface_id_; |
228 | 242 |
229 // The number of delegated frame acks that are pending, to delay resource | 243 // The number of delegated frame acks that are pending, to delay resource |
230 // returns until the acks are sent. | 244 // returns until the acks are sent. |
231 int pending_delegated_ack_count_; | 245 int pending_delegated_ack_count_; |
232 | 246 |
233 // True after a delegated frame has been skipped, until a frame is not | 247 // True after a delegated frame has been skipped, until a frame is not |
234 // skipped. | 248 // skipped. |
235 bool skipped_frames_; | 249 bool skipped_frames_; |
236 std::vector<ui::LatencyInfo> skipped_latency_info_list_; | 250 std::vector<ui::LatencyInfo> skipped_latency_info_list_; |
237 | 251 |
238 // Holds delegated resources that have been given to a DelegatedFrameProvider, | 252 // Holds delegated resources that have been given to a DelegatedFrameProvider, |
239 // and gives back resources when they are no longer in use for return to the | 253 // and gives back resources when they are no longer in use for return to the |
240 // renderer. | 254 // renderer. |
241 scoped_refptr<cc::DelegatedFrameResourceCollection> resource_collection_; | 255 scoped_refptr<cc::DelegatedFrameResourceCollection> resource_collection_; |
242 | 256 |
243 // Provides delegated frame updates to the cc::DelegatedRendererLayer. | 257 // Provides delegated frame updates to the cc::DelegatedRendererLayer. |
244 scoped_refptr<cc::DelegatedFrameProvider> frame_provider_; | 258 scoped_refptr<cc::DelegatedFrameProvider> frame_provider_; |
245 | 259 |
ccameron
2014/07/25 22:28:05
Might wanna throw a comment saying "State for rend
| |
260 scoped_ptr<cc::SurfaceIdAllocator> id_allocator_; | |
261 scoped_ptr<cc::SurfaceFactory> surface_factory_; | |
262 cc::SurfaceId surface_id_; | |
263 gfx::Size current_surface_size_; | |
264 cc::ReturnedResourceArray surface_returned_resources_; | |
265 | |
246 // This lock is the one waiting for a frame of the right size to come back | 266 // This lock is the one waiting for a frame of the right size to come back |
247 // from the renderer/GPU process. It is set from the moment the aura window | 267 // from the renderer/GPU process. It is set from the moment the aura window |
248 // got resized, to the moment we committed the renderer frame of the same | 268 // got resized, to the moment we committed the renderer frame of the same |
249 // size. It keeps track of the size we expect from the renderer, and locks the | 269 // size. It keeps track of the size we expect from the renderer, and locks the |
250 // compositor, as well as the UI for a short time to give a chance to the | 270 // compositor, as well as the UI for a short time to give a chance to the |
251 // renderer of producing a frame of the right size. | 271 // renderer of producing a frame of the right size. |
252 scoped_ptr<ResizeLock> resize_lock_; | 272 scoped_ptr<ResizeLock> resize_lock_; |
253 | 273 |
254 // Keeps track of the current frame size. | 274 // Keeps track of the current frame size. |
255 gfx::Size current_frame_size_in_dip_; | 275 gfx::Size current_frame_size_in_dip_; |
(...skipping 21 matching lines...) Expand all Loading... | |
277 // YUV readback pipeline. | 297 // YUV readback pipeline. |
278 scoped_ptr<content::ReadbackYUVInterface> | 298 scoped_ptr<content::ReadbackYUVInterface> |
279 yuv_readback_pipeline_; | 299 yuv_readback_pipeline_; |
280 | 300 |
281 scoped_ptr<DelegatedFrameEvictor> delegated_frame_evictor_; | 301 scoped_ptr<DelegatedFrameEvictor> delegated_frame_evictor_; |
282 }; | 302 }; |
283 | 303 |
284 } // namespace content | 304 } // namespace content |
285 | 305 |
286 #endif // CONTENT_BROWSER_COMPOSITOR_DELEGATED_FRAME_HOST_H_ | 306 #endif // CONTENT_BROWSER_COMPOSITOR_DELEGATED_FRAME_HOST_H_ |
OLD | NEW |