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

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: address dana's comment 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 SetVSyncParameters(base::TimeTicks timebase, base::TimeDelta interval);
brianderson 2015/03/25 20:25:54 Can we keep this UpdateVSyncParameters to keep it
danakj 2015/03/25 20:31:19 What other places are you thinking of? Update soun
102 void CopyFromCompositingSurface(const gfx::Rect& src_subrect, 97 void CopyFromCompositingSurface(const gfx::Rect& src_subrect,
103 const gfx::Size& output_size, 98 const gfx::Size& output_size,
104 ReadbackRequestCallback& callback, 99 ReadbackRequestCallback& callback,
105 const SkColorType color_type); 100 const SkColorType color_type);
106 void CopyFromCompositingSurfaceToVideoFrame( 101 void CopyFromCompositingSurfaceToVideoFrame(
107 const gfx::Rect& src_subrect, 102 const gfx::Rect& src_subrect,
108 const scoped_refptr<media::VideoFrame>& target, 103 const scoped_refptr<media::VideoFrame>& target,
109 const base::Callback<void(bool)>& callback); 104 const base::Callback<void(bool)>& callback);
110 bool CanCopyToVideoFrame() const; 105 bool CanCopyToVideoFrame() const;
111 bool CanSubscribeFrame() const; 106 bool CanSubscribeFrame() const;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 146
152 // Overridden from ui::CompositorObserver: 147 // Overridden from ui::CompositorObserver:
153 void OnCompositingDidCommit(ui::Compositor* compositor) override; 148 void OnCompositingDidCommit(ui::Compositor* compositor) override;
154 void OnCompositingStarted(ui::Compositor* compositor, 149 void OnCompositingStarted(ui::Compositor* compositor,
155 base::TimeTicks start_time) override; 150 base::TimeTicks start_time) override;
156 void OnCompositingEnded(ui::Compositor* compositor) override; 151 void OnCompositingEnded(ui::Compositor* compositor) override;
157 void OnCompositingAborted(ui::Compositor* compositor) override; 152 void OnCompositingAborted(ui::Compositor* compositor) override;
158 void OnCompositingLockStateChanged(ui::Compositor* compositor) override; 153 void OnCompositingLockStateChanged(ui::Compositor* compositor) override;
159 void OnCompositingShuttingDown(ui::Compositor* compositor) override; 154 void OnCompositingShuttingDown(ui::Compositor* compositor) override;
160 155
161 // Overridden from ui::CompositorVSyncManager::Observer:
162 void OnUpdateVSyncParameters(base::TimeTicks timebase,
163 base::TimeDelta interval) override;
164
165 // Overridden from ui::LayerOwnerObserver: 156 // Overridden from ui::LayerOwnerObserver:
166 void OnLayerRecreated(ui::Layer* old_layer, ui::Layer* new_layer) override; 157 void OnLayerRecreated(ui::Layer* old_layer, ui::Layer* new_layer) override;
167 158
168 // Overridden from ImageTransportFactoryObserver: 159 // Overridden from ImageTransportFactoryObserver:
169 void OnLostResources() override; 160 void OnLostResources() override;
170 161
171 bool ShouldSkipFrame(gfx::Size size_in_dip) const; 162 bool ShouldSkipFrame(gfx::Size size_in_dip) const;
172 163
173 // Lazily grab a resize lock if the aura window size doesn't match the current 164 // Lazily grab a resize lock if the aura window size doesn't match the current
174 // frame size, to give time to the renderer. 165 // frame size, to give time to the renderer.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 231
241 DelegatedFrameHostClient* const client_; 232 DelegatedFrameHostClient* const client_;
242 ui::Compositor* compositor_; 233 ui::Compositor* compositor_;
243 234
244 // True if this renders into a Surface, false if it renders into a delegated 235 // True if this renders into a Surface, false if it renders into a delegated
245 // layer. 236 // layer.
246 bool use_surfaces_; 237 bool use_surfaces_;
247 238
248 std::vector<base::Closure> on_compositing_did_commit_callbacks_; 239 std::vector<base::Closure> on_compositing_did_commit_callbacks_;
249 240
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 241 // The current VSync timebase and interval. These are zero until the first
254 // call to OnUpdateVSyncParameters(). 242 // call to UpdateVSyncParameters().
255 base::TimeTicks vsync_timebase_; 243 base::TimeTicks vsync_timebase_;
256 base::TimeDelta vsync_interval_; 244 base::TimeDelta vsync_interval_;
257 245
258 // With delegated renderer, this is the last output surface, used to 246 // With delegated renderer, this is the last output surface, used to
259 // disambiguate resources with the same id coming from different output 247 // disambiguate resources with the same id coming from different output
260 // surfaces. 248 // surfaces.
261 uint32 last_output_surface_id_; 249 uint32 last_output_surface_id_;
262 250
263 // The number of delegated frame acks that are pending, to delay resource 251 // The number of delegated frame acks that are pending, to delay resource
264 // returns until the acks are sent. 252 // returns until the acks are sent.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 // YUV readback pipeline. 323 // YUV readback pipeline.
336 scoped_ptr<content::ReadbackYUVInterface> 324 scoped_ptr<content::ReadbackYUVInterface>
337 yuv_readback_pipeline_; 325 yuv_readback_pipeline_;
338 326
339 scoped_ptr<DelegatedFrameEvictor> delegated_frame_evictor_; 327 scoped_ptr<DelegatedFrameEvictor> delegated_frame_evictor_;
340 }; 328 };
341 329
342 } // namespace content 330 } // namespace content
343 331
344 #endif // CONTENT_BROWSER_COMPOSITOR_DELEGATED_FRAME_HOST_H_ 332 #endif // CONTENT_BROWSER_COMPOSITOR_DELEGATED_FRAME_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698