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

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

Issue 1040813002: Revert of Enable BeginFrame scheduling on aura (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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"
21 #include "ui/compositor/layer.h" 22 #include "ui/compositor/layer.h"
22 #include "ui/compositor/layer_owner_delegate.h" 23 #include "ui/compositor/layer_owner_delegate.h"
23 #include "ui/gfx/geometry/rect_conversions.h" 24 #include "ui/gfx/geometry/rect_conversions.h"
24 25
25 namespace cc { 26 namespace cc {
26 class SurfaceFactory; 27 class SurfaceFactory;
27 enum class SurfaceDrawStatus; 28 enum class SurfaceDrawStatus;
28 } 29 }
29 30
30 namespace media { 31 namespace media {
(...skipping 22 matching lines...) Expand all
53 bool defer_compositor_lock) = 0; 54 bool defer_compositor_lock) = 0;
54 virtual void DelegatedFrameHostResizeLockWasReleased() = 0; 55 virtual void DelegatedFrameHostResizeLockWasReleased() = 0;
55 56
56 virtual void DelegatedFrameHostSendCompositorSwapAck( 57 virtual void DelegatedFrameHostSendCompositorSwapAck(
57 int output_surface_id, 58 int output_surface_id,
58 const cc::CompositorFrameAck& ack) = 0; 59 const cc::CompositorFrameAck& ack) = 0;
59 virtual void DelegatedFrameHostSendReclaimCompositorResources( 60 virtual void DelegatedFrameHostSendReclaimCompositorResources(
60 int output_surface_id, 61 int output_surface_id,
61 const cc::CompositorFrameAck& ack) = 0; 62 const cc::CompositorFrameAck& ack) = 0;
62 virtual void DelegatedFrameHostOnLostCompositorResources() = 0; 63 virtual void DelegatedFrameHostOnLostCompositorResources() = 0;
64
65 virtual void DelegatedFrameHostUpdateVSyncParameters(
66 const base::TimeTicks& timebase,
67 const base::TimeDelta& interval) = 0;
63 }; 68 };
64 69
65 // The DelegatedFrameHost is used to host all of the RenderWidgetHostView state 70 // The DelegatedFrameHost is used to host all of the RenderWidgetHostView state
66 // and functionality that is associated with delegated frames being sent from 71 // and functionality that is associated with delegated frames being sent from
67 // the RenderWidget. The DelegatedFrameHost will push these changes through to 72 // the RenderWidget. The DelegatedFrameHost will push these changes through to
68 // the ui::Compositor associated with its DelegatedFrameHostClient. 73 // the ui::Compositor associated with its DelegatedFrameHostClient.
69 class CONTENT_EXPORT DelegatedFrameHost 74 class CONTENT_EXPORT DelegatedFrameHost
70 : public ui::CompositorObserver, 75 : public ui::CompositorObserver,
76 public ui::CompositorVSyncManager::Observer,
71 public ui::LayerOwnerDelegate, 77 public ui::LayerOwnerDelegate,
72 public ImageTransportFactoryObserver, 78 public ImageTransportFactoryObserver,
73 public DelegatedFrameEvictorClient, 79 public DelegatedFrameEvictorClient,
74 public cc::DelegatedFrameResourceCollectionClient, 80 public cc::DelegatedFrameResourceCollectionClient,
75 public cc::SurfaceFactoryClient, 81 public cc::SurfaceFactoryClient,
76 public base::SupportsWeakPtr<DelegatedFrameHost> { 82 public base::SupportsWeakPtr<DelegatedFrameHost> {
77 public: 83 public:
78 DelegatedFrameHost(DelegatedFrameHostClient* client); 84 DelegatedFrameHost(DelegatedFrameHostClient* client);
79 ~DelegatedFrameHost() override; 85 ~DelegatedFrameHost() override;
80 86
81 bool CanCopyToBitmap() const; 87 bool CanCopyToBitmap() const;
82 88
83 // Public interface exposed to RenderWidgetHostView. 89 // Public interface exposed to RenderWidgetHostView.
84 void SwapDelegatedFrame( 90 void SwapDelegatedFrame(
85 uint32 output_surface_id, 91 uint32 output_surface_id,
86 scoped_ptr<cc::DelegatedFrameData> frame_data, 92 scoped_ptr<cc::DelegatedFrameData> frame_data,
87 float frame_device_scale_factor, 93 float frame_device_scale_factor,
88 const std::vector<ui::LatencyInfo>& latency_info); 94 const std::vector<ui::LatencyInfo>& latency_info);
89 void WasHidden(); 95 void WasHidden();
90 void WasShown(const ui::LatencyInfo& latency_info); 96 void WasShown(const ui::LatencyInfo& latency_info);
91 void WasResized(); 97 void WasResized();
92 bool HasSavedFrame(); 98 bool HasSavedFrame();
93 gfx::Size GetRequestedRendererSize() const; 99 gfx::Size GetRequestedRendererSize() const;
94 void SetCompositor(ui::Compositor* compositor); 100 void SetCompositor(ui::Compositor* compositor);
95 void ResetCompositor(); 101 void ResetCompositor();
96 void SetVSyncParameters(base::TimeTicks timebase, base::TimeDelta interval);
97 void CopyFromCompositingSurface(const gfx::Rect& src_subrect, 102 void CopyFromCompositingSurface(const gfx::Rect& src_subrect,
98 const gfx::Size& output_size, 103 const gfx::Size& output_size,
99 ReadbackRequestCallback& callback, 104 ReadbackRequestCallback& callback,
100 const SkColorType color_type); 105 const SkColorType color_type);
101 void CopyFromCompositingSurfaceToVideoFrame( 106 void CopyFromCompositingSurfaceToVideoFrame(
102 const gfx::Rect& src_subrect, 107 const gfx::Rect& src_subrect,
103 const scoped_refptr<media::VideoFrame>& target, 108 const scoped_refptr<media::VideoFrame>& target,
104 const base::Callback<void(bool)>& callback); 109 const base::Callback<void(bool)>& callback);
105 bool CanCopyToVideoFrame() const; 110 bool CanCopyToVideoFrame() const;
106 bool CanSubscribeFrame() const; 111 bool CanSubscribeFrame() const;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 149
145 // Overridden from ui::CompositorObserver: 150 // Overridden from ui::CompositorObserver:
146 void OnCompositingDidCommit(ui::Compositor* compositor) override; 151 void OnCompositingDidCommit(ui::Compositor* compositor) override;
147 void OnCompositingStarted(ui::Compositor* compositor, 152 void OnCompositingStarted(ui::Compositor* compositor,
148 base::TimeTicks start_time) override; 153 base::TimeTicks start_time) override;
149 void OnCompositingEnded(ui::Compositor* compositor) override; 154 void OnCompositingEnded(ui::Compositor* compositor) override;
150 void OnCompositingAborted(ui::Compositor* compositor) override; 155 void OnCompositingAborted(ui::Compositor* compositor) override;
151 void OnCompositingLockStateChanged(ui::Compositor* compositor) override; 156 void OnCompositingLockStateChanged(ui::Compositor* compositor) override;
152 void OnCompositingShuttingDown(ui::Compositor* compositor) override; 157 void OnCompositingShuttingDown(ui::Compositor* compositor) override;
153 158
159 // Overridden from ui::CompositorVSyncManager::Observer:
160 void OnUpdateVSyncParameters(base::TimeTicks timebase,
161 base::TimeDelta interval) override;
162
154 // Overridden from ui::LayerOwnerObserver: 163 // Overridden from ui::LayerOwnerObserver:
155 void OnLayerRecreated(ui::Layer* old_layer, ui::Layer* new_layer) override; 164 void OnLayerRecreated(ui::Layer* old_layer, ui::Layer* new_layer) override;
156 165
157 // Overridden from ImageTransportFactoryObserver: 166 // Overridden from ImageTransportFactoryObserver:
158 void OnLostResources() override; 167 void OnLostResources() override;
159 168
160 bool ShouldSkipFrame(gfx::Size size_in_dip) const; 169 bool ShouldSkipFrame(gfx::Size size_in_dip) const;
161 170
162 // Lazily grab a resize lock if the aura window size doesn't match the current 171 // Lazily grab a resize lock if the aura window size doesn't match the current
163 // frame size, to give time to the renderer. 172 // frame size, to give time to the renderer.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 232
224 DelegatedFrameHostClient* const client_; 233 DelegatedFrameHostClient* const client_;
225 ui::Compositor* compositor_; 234 ui::Compositor* compositor_;
226 235
227 // 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
228 // layer. 237 // layer.
229 bool use_surfaces_; 238 bool use_surfaces_;
230 239
231 std::vector<base::Closure> on_compositing_did_commit_callbacks_; 240 std::vector<base::Closure> on_compositing_did_commit_callbacks_;
232 241
242 // The vsync manager we are observing for changes, if any.
243 scoped_refptr<ui::CompositorVSyncManager> vsync_manager_;
244
233 // The current VSync timebase and interval. These are zero until the first 245 // The current VSync timebase and interval. These are zero until the first
234 // call to UpdateVSyncParameters(). 246 // call to OnUpdateVSyncParameters().
235 base::TimeTicks vsync_timebase_; 247 base::TimeTicks vsync_timebase_;
236 base::TimeDelta vsync_interval_; 248 base::TimeDelta vsync_interval_;
237 249
238 // With delegated renderer, this is the last output surface, used to 250 // With delegated renderer, this is the last output surface, used to
239 // disambiguate resources with the same id coming from different output 251 // disambiguate resources with the same id coming from different output
240 // surfaces. 252 // surfaces.
241 uint32 last_output_surface_id_; 253 uint32 last_output_surface_id_;
242 254
243 // The number of delegated frame acks that are pending, to delay resource 255 // The number of delegated frame acks that are pending, to delay resource
244 // returns until the acks are sent. 256 // returns until the acks are sent.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 // YUV readback pipeline. 316 // YUV readback pipeline.
305 scoped_ptr<content::ReadbackYUVInterface> 317 scoped_ptr<content::ReadbackYUVInterface>
306 yuv_readback_pipeline_; 318 yuv_readback_pipeline_;
307 319
308 scoped_ptr<DelegatedFrameEvictor> delegated_frame_evictor_; 320 scoped_ptr<DelegatedFrameEvictor> delegated_frame_evictor_;
309 }; 321 };
310 322
311 } // namespace content 323 } // namespace content
312 324
313 #endif // CONTENT_BROWSER_COMPOSITOR_DELEGATED_FRAME_HOST_H_ 325 #endif // CONTENT_BROWSER_COMPOSITOR_DELEGATED_FRAME_HOST_H_
OLDNEW
« no previous file with comments | « content/browser/compositor/browser_compositor_output_surface.cc ('k') | content/browser/compositor/delegated_frame_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698