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

Side by Side Diff: content/browser/compositor/delegated_frame_host.h

Issue 417943004: Use Surfaces to hold delegated renderer contents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/compositor/delegated_frame_host.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 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
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
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
260 // State for rendering into a Surface.
261 scoped_ptr<cc::SurfaceIdAllocator> id_allocator_;
262 scoped_ptr<cc::SurfaceFactory> surface_factory_;
263 cc::SurfaceId surface_id_;
264 gfx::Size current_surface_size_;
265 cc::ReturnedResourceArray surface_returned_resources_;
266
246 // This lock is the one waiting for a frame of the right size to come back 267 // 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 268 // 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 269 // 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 270 // 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 271 // 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. 272 // renderer of producing a frame of the right size.
252 scoped_ptr<ResizeLock> resize_lock_; 273 scoped_ptr<ResizeLock> resize_lock_;
253 274
254 // Keeps track of the current frame size. 275 // Keeps track of the current frame size.
255 gfx::Size current_frame_size_in_dip_; 276 gfx::Size current_frame_size_in_dip_;
(...skipping 21 matching lines...) Expand all
277 // YUV readback pipeline. 298 // YUV readback pipeline.
278 scoped_ptr<content::ReadbackYUVInterface> 299 scoped_ptr<content::ReadbackYUVInterface>
279 yuv_readback_pipeline_; 300 yuv_readback_pipeline_;
280 301
281 scoped_ptr<DelegatedFrameEvictor> delegated_frame_evictor_; 302 scoped_ptr<DelegatedFrameEvictor> delegated_frame_evictor_;
282 }; 303 };
283 304
284 } // namespace content 305 } // namespace content
285 306
286 #endif // CONTENT_BROWSER_COMPOSITOR_DELEGATED_FRAME_HOST_H_ 307 #endif // CONTENT_BROWSER_COMPOSITOR_DELEGATED_FRAME_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/compositor/delegated_frame_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698