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

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

Issue 1016033006: Enable BeginFrame scheduling on aura (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix mac build Created 5 years, 9 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 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 "cc/surfaces/surface_factory_client.h"
12 #include "content/browser/compositor/image_transport_factory.h" 12 #include "content/browser/compositor/image_transport_factory.h"
13 #include "content/browser/compositor/owned_mailbox.h" 13 #include "content/browser/compositor/owned_mailbox.h"
14 #include "content/browser/renderer_host/delegated_frame_evictor.h" 14 #include "content/browser/renderer_host/delegated_frame_evictor.h"
15 #include "content/browser/renderer_host/dip_util.h" 15 #include "content/browser/renderer_host/dip_util.h"
16 #include "content/browser/renderer_host/render_widget_host_impl.h" 16 #include "content/browser/renderer_host/render_widget_host_impl.h"
17 #include "content/browser/renderer_host/render_widget_host_view_base.h" 17 #include "content/browser/renderer_host/render_widget_host_view_base.h"
18 #include "content/public/browser/render_process_host.h" 18 #include "content/public/browser/render_process_host.h"
19 #include "ui/compositor/compositor.h" 19 #include "ui/compositor/compositor.h"
20 #include "ui/compositor/compositor_observer.h" 20 #include "ui/compositor/compositor_observer.h"
21 #include "ui/compositor/compositor_vsync_manager.h"
22 #include "ui/compositor/layer.h" 21 #include "ui/compositor/layer.h"
23 #include "ui/compositor/layer_owner_delegate.h" 22 #include "ui/compositor/layer_owner_delegate.h"
24 #include "ui/gfx/geometry/rect_conversions.h" 23 #include "ui/gfx/geometry/rect_conversions.h"
25 24
26 namespace cc { 25 namespace cc {
27 class SurfaceFactory; 26 class SurfaceFactory;
28 enum class SurfaceDrawStatus; 27 enum class SurfaceDrawStatus;
29 } 28 }
30 29
31 namespace media { 30 namespace media {
(...skipping 22 matching lines...) Expand all
54 bool defer_compositor_lock) = 0; 53 bool defer_compositor_lock) = 0;
55 virtual void DelegatedFrameHostResizeLockWasReleased() = 0; 54 virtual void DelegatedFrameHostResizeLockWasReleased() = 0;
56 55
57 virtual void DelegatedFrameHostSendCompositorSwapAck( 56 virtual void DelegatedFrameHostSendCompositorSwapAck(
58 int output_surface_id, 57 int output_surface_id,
59 const cc::CompositorFrameAck& ack) = 0; 58 const cc::CompositorFrameAck& ack) = 0;
60 virtual void DelegatedFrameHostSendReclaimCompositorResources( 59 virtual void DelegatedFrameHostSendReclaimCompositorResources(
61 int output_surface_id, 60 int output_surface_id,
62 const cc::CompositorFrameAck& ack) = 0; 61 const cc::CompositorFrameAck& ack) = 0;
63 virtual void DelegatedFrameHostOnLostCompositorResources() = 0; 62 virtual void DelegatedFrameHostOnLostCompositorResources() = 0;
64
65 virtual void DelegatedFrameHostUpdateVSyncParameters(
66 const base::TimeTicks& timebase,
67 const base::TimeDelta& interval) = 0;
68 }; 63 };
69 64
70 // The DelegatedFrameHost is used to host all of the RenderWidgetHostView state 65 // The DelegatedFrameHost is used to host all of the RenderWidgetHostView state
71 // and functionality that is associated with delegated frames being sent from 66 // and functionality that is associated with delegated frames being sent from
72 // the RenderWidget. The DelegatedFrameHost will push these changes through to 67 // the RenderWidget. The DelegatedFrameHost will push these changes through to
73 // the ui::Compositor associated with its DelegatedFrameHostClient. 68 // the ui::Compositor associated with its DelegatedFrameHostClient.
74 class CONTENT_EXPORT DelegatedFrameHost 69 class CONTENT_EXPORT DelegatedFrameHost
75 : public ui::CompositorObserver, 70 : public ui::CompositorObserver,
76 public ui::CompositorVSyncManager::Observer,
77 public ui::LayerOwnerDelegate, 71 public ui::LayerOwnerDelegate,
78 public ImageTransportFactoryObserver, 72 public ImageTransportFactoryObserver,
79 public DelegatedFrameEvictorClient, 73 public DelegatedFrameEvictorClient,
80 public cc::DelegatedFrameResourceCollectionClient, 74 public cc::DelegatedFrameResourceCollectionClient,
81 public cc::SurfaceFactoryClient, 75 public cc::SurfaceFactoryClient,
82 public base::SupportsWeakPtr<DelegatedFrameHost> { 76 public base::SupportsWeakPtr<DelegatedFrameHost> {
83 public: 77 public:
84 DelegatedFrameHost(DelegatedFrameHostClient* client); 78 DelegatedFrameHost(DelegatedFrameHostClient* client);
85 ~DelegatedFrameHost() override; 79 ~DelegatedFrameHost() override;
86 80
87 bool CanCopyToBitmap() const; 81 bool CanCopyToBitmap() const;
88 82
89 // Public interface exposed to RenderWidgetHostView. 83 // Public interface exposed to RenderWidgetHostView.
90 void SwapDelegatedFrame( 84 void SwapDelegatedFrame(
91 uint32 output_surface_id, 85 uint32 output_surface_id,
92 scoped_ptr<cc::DelegatedFrameData> frame_data, 86 scoped_ptr<cc::DelegatedFrameData> frame_data,
93 float frame_device_scale_factor, 87 float frame_device_scale_factor,
94 const std::vector<ui::LatencyInfo>& latency_info); 88 const std::vector<ui::LatencyInfo>& latency_info);
95 void WasHidden(); 89 void WasHidden();
96 void WasShown(const ui::LatencyInfo& latency_info); 90 void WasShown(const ui::LatencyInfo& latency_info);
97 void WasResized(); 91 void WasResized();
98 bool HasSavedFrame(); 92 bool HasSavedFrame();
99 gfx::Size GetRequestedRendererSize() const; 93 gfx::Size GetRequestedRendererSize() const;
100 void SetCompositor(ui::Compositor* compositor); 94 void SetCompositor(ui::Compositor* compositor);
101 void ResetCompositor(); 95 void ResetCompositor();
96 void UpdateVSyncParameters(base::TimeTicks timebase,
97 base::TimeDelta interval);
102 void CopyFromCompositingSurface(const gfx::Rect& src_subrect, 98 void CopyFromCompositingSurface(const gfx::Rect& src_subrect,
103 const gfx::Size& output_size, 99 const gfx::Size& output_size,
104 ReadbackRequestCallback& callback, 100 ReadbackRequestCallback& callback,
105 const SkColorType color_type); 101 const SkColorType color_type);
106 void CopyFromCompositingSurfaceToVideoFrame( 102 void CopyFromCompositingSurfaceToVideoFrame(
107 const gfx::Rect& src_subrect, 103 const gfx::Rect& src_subrect,
108 const scoped_refptr<media::VideoFrame>& target, 104 const scoped_refptr<media::VideoFrame>& target,
109 const base::Callback<void(bool)>& callback); 105 const base::Callback<void(bool)>& callback);
110 bool CanCopyToVideoFrame() const; 106 bool CanCopyToVideoFrame() const;
111 bool CanSubscribeFrame() const; 107 bool CanSubscribeFrame() const;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 147
152 // Overridden from ui::CompositorObserver: 148 // Overridden from ui::CompositorObserver:
153 void OnCompositingDidCommit(ui::Compositor* compositor) override; 149 void OnCompositingDidCommit(ui::Compositor* compositor) override;
154 void OnCompositingStarted(ui::Compositor* compositor, 150 void OnCompositingStarted(ui::Compositor* compositor,
155 base::TimeTicks start_time) override; 151 base::TimeTicks start_time) override;
156 void OnCompositingEnded(ui::Compositor* compositor) override; 152 void OnCompositingEnded(ui::Compositor* compositor) override;
157 void OnCompositingAborted(ui::Compositor* compositor) override; 153 void OnCompositingAborted(ui::Compositor* compositor) override;
158 void OnCompositingLockStateChanged(ui::Compositor* compositor) override; 154 void OnCompositingLockStateChanged(ui::Compositor* compositor) override;
159 void OnCompositingShuttingDown(ui::Compositor* compositor) override; 155 void OnCompositingShuttingDown(ui::Compositor* compositor) override;
160 156
161 // Overridden from ui::CompositorVSyncManager::Observer:
162 void OnUpdateVSyncParameters(base::TimeTicks timebase,
163 base::TimeDelta interval) override;
164
165 // Overridden from ui::LayerOwnerObserver: 157 // Overridden from ui::LayerOwnerObserver:
166 void OnLayerRecreated(ui::Layer* old_layer, ui::Layer* new_layer) override; 158 void OnLayerRecreated(ui::Layer* old_layer, ui::Layer* new_layer) override;
167 159
168 // Overridden from ImageTransportFactoryObserver: 160 // Overridden from ImageTransportFactoryObserver:
169 void OnLostResources() override; 161 void OnLostResources() override;
170 162
171 bool ShouldSkipFrame(gfx::Size size_in_dip) const; 163 bool ShouldSkipFrame(gfx::Size size_in_dip) const;
172 164
173 // Lazily grab a resize lock if the aura window size doesn't match the current 165 // Lazily grab a resize lock if the aura window size doesn't match the current
174 // frame size, to give time to the renderer. 166 // frame size, to give time to the renderer.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 232
241 DelegatedFrameHostClient* const client_; 233 DelegatedFrameHostClient* const client_;
242 ui::Compositor* compositor_; 234 ui::Compositor* compositor_;
243 235
244 // True if this renders into a Surface, false if it renders into a delegated 236 // True if this renders into a Surface, false if it renders into a delegated
245 // layer. 237 // layer.
246 bool use_surfaces_; 238 bool use_surfaces_;
247 239
248 std::vector<base::Closure> on_compositing_did_commit_callbacks_; 240 std::vector<base::Closure> on_compositing_did_commit_callbacks_;
249 241
250 // The vsync manager we are observing for changes, if any.
251 scoped_refptr<ui::CompositorVSyncManager> vsync_manager_;
252
253 // The current VSync timebase and interval. These are zero until the first 242 // The current VSync timebase and interval. These are zero until the first
254 // call to OnUpdateVSyncParameters(). 243 // call to UpdateVSyncParameters().
255 base::TimeTicks vsync_timebase_; 244 base::TimeTicks vsync_timebase_;
256 base::TimeDelta vsync_interval_; 245 base::TimeDelta vsync_interval_;
257 246
258 // With delegated renderer, this is the last output surface, used to 247 // With delegated renderer, this is the last output surface, used to
259 // disambiguate resources with the same id coming from different output 248 // disambiguate resources with the same id coming from different output
260 // surfaces. 249 // surfaces.
261 uint32 last_output_surface_id_; 250 uint32 last_output_surface_id_;
262 251
263 // The number of delegated frame acks that are pending, to delay resource 252 // The number of delegated frame acks that are pending, to delay resource
264 // returns until the acks are sent. 253 // returns until the acks are sent.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 // YUV readback pipeline. 324 // YUV readback pipeline.
336 scoped_ptr<content::ReadbackYUVInterface> 325 scoped_ptr<content::ReadbackYUVInterface>
337 yuv_readback_pipeline_; 326 yuv_readback_pipeline_;
338 327
339 scoped_ptr<DelegatedFrameEvictor> delegated_frame_evictor_; 328 scoped_ptr<DelegatedFrameEvictor> delegated_frame_evictor_;
340 }; 329 };
341 330
342 } // namespace content 331 } // namespace content
343 332
344 #endif // CONTENT_BROWSER_COMPOSITOR_DELEGATED_FRAME_HOST_H_ 333 #endif // CONTENT_BROWSER_COMPOSITOR_DELEGATED_FRAME_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698