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

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

Issue 775143003: cc: Implement unified BeginFrame on aura (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move common logic to DelegatedFrameHost Created 6 years 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/base/compositor/compositor_begin_frame_observer.h"
19 #include "ui/compositor/compositor.h" 20 #include "ui/compositor/compositor.h"
20 #include "ui/compositor/compositor_observer.h" 21 #include "ui/compositor/compositor_observer.h"
21 #include "ui/compositor/compositor_vsync_manager.h" 22 #include "ui/compositor/compositor_vsync_manager.h"
22 #include "ui/compositor/layer.h" 23 #include "ui/compositor/layer.h"
23 #include "ui/compositor/layer_owner_delegate.h" 24 #include "ui/compositor/layer_owner_delegate.h"
24 #include "ui/gfx/rect_conversions.h" 25 #include "ui/gfx/rect_conversions.h"
25 26
26 namespace cc { 27 namespace cc {
27 class SurfaceFactory; 28 class SurfaceFactory;
29 struct BeginFrameArgs;
28 } 30 }
29 31
30 namespace media { 32 namespace media {
31 class VideoFrame; 33 class VideoFrame;
32 } 34 }
33 35
34 namespace content { 36 namespace content {
35 37
36 class DelegatedFrameHost; 38 class DelegatedFrameHost;
37 class ReadbackYUVInterface; 39 class ReadbackYUVInterface;
(...skipping 27 matching lines...) Expand all
65 virtual bool ShouldCreateResizeLock(); 67 virtual bool ShouldCreateResizeLock();
66 virtual void RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request); 68 virtual void RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request);
67 }; 69 };
68 70
69 // The DelegatedFrameHost is used to host all of the RenderWidgetHostView state 71 // The DelegatedFrameHost is used to host all of the RenderWidgetHostView state
70 // and functionality that is associated with delegated frames being sent from 72 // and functionality that is associated with delegated frames being sent from
71 // the RenderWidget. The DelegatedFrameHost will push these changes through to 73 // the RenderWidget. The DelegatedFrameHost will push these changes through to
72 // the ui::Compositor associated with its DelegatedFrameHostClient. 74 // the ui::Compositor associated with its DelegatedFrameHostClient.
73 class CONTENT_EXPORT DelegatedFrameHost 75 class CONTENT_EXPORT DelegatedFrameHost
74 : public ui::CompositorObserver, 76 : public ui::CompositorObserver,
77 public ui::CompositorBeginFrameObserver,
75 public ui::CompositorVSyncManager::Observer, 78 public ui::CompositorVSyncManager::Observer,
76 public ui::LayerOwnerDelegate, 79 public ui::LayerOwnerDelegate,
77 public ImageTransportFactoryObserver, 80 public ImageTransportFactoryObserver,
78 public DelegatedFrameEvictorClient, 81 public DelegatedFrameEvictorClient,
79 public cc::DelegatedFrameResourceCollectionClient, 82 public cc::DelegatedFrameResourceCollectionClient,
80 public cc::SurfaceFactoryClient, 83 public cc::SurfaceFactoryClient,
81 public base::SupportsWeakPtr<DelegatedFrameHost> { 84 public base::SupportsWeakPtr<DelegatedFrameHost> {
82 public: 85 public:
83 DelegatedFrameHost(DelegatedFrameHostClient* client); 86 DelegatedFrameHost(DelegatedFrameHostClient* client);
84 ~DelegatedFrameHost() override; 87 ~DelegatedFrameHost() override;
(...skipping 20 matching lines...) Expand all
105 void CopyFromCompositingSurfaceToVideoFrame( 108 void CopyFromCompositingSurfaceToVideoFrame(
106 const gfx::Rect& src_subrect, 109 const gfx::Rect& src_subrect,
107 const scoped_refptr<media::VideoFrame>& target, 110 const scoped_refptr<media::VideoFrame>& target,
108 const base::Callback<void(bool)>& callback); 111 const base::Callback<void(bool)>& callback);
109 bool CanCopyToVideoFrame() const; 112 bool CanCopyToVideoFrame() const;
110 bool CanSubscribeFrame() const; 113 bool CanSubscribeFrame() const;
111 void BeginFrameSubscription( 114 void BeginFrameSubscription(
112 scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber); 115 scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber);
113 void EndFrameSubscription(); 116 void EndFrameSubscription();
114 bool HasFrameSubscriber() const { return frame_subscriber_; } 117 bool HasFrameSubscriber() const { return frame_subscriber_; }
118 void OnSetNeedsBeginFrames(bool needs_begin_frames);
115 119
116 // Exposed for tests. 120 // Exposed for tests.
117 cc::DelegatedFrameProvider* FrameProviderForTesting() const { 121 cc::DelegatedFrameProvider* FrameProviderForTesting() const {
118 return frame_provider_.get(); 122 return frame_provider_.get();
119 } 123 }
120 cc::SurfaceId SurfaceIdForTesting() const { return surface_id_; } 124 cc::SurfaceId SurfaceIdForTesting() const { return surface_id_; }
121 void OnCompositingDidCommitForTesting(ui::Compositor* compositor) { 125 void OnCompositingDidCommitForTesting(ui::Compositor* compositor) {
122 OnCompositingDidCommit(compositor); 126 OnCompositingDidCommit(compositor);
123 } 127 }
124 bool ShouldCreateResizeLockForTesting() { return ShouldCreateResizeLock(); } 128 bool ShouldCreateResizeLockForTesting() { return ShouldCreateResizeLock(); }
(...skipping 12 matching lines...) Expand all
137 141
138 RenderWidgetHostViewFrameSubscriber* frame_subscriber() const { 142 RenderWidgetHostViewFrameSubscriber* frame_subscriber() const {
139 return frame_subscriber_.get(); 143 return frame_subscriber_.get();
140 } 144 }
141 bool ShouldCreateResizeLock(); 145 bool ShouldCreateResizeLock();
142 void RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request); 146 void RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request);
143 147
144 void LockResources(); 148 void LockResources();
145 void UnlockResources(); 149 void UnlockResources();
146 150
151 void StartObservingBeginFrames();
152 void StopObservingBeginFrames();
153
154 void SetVSyncParams(base::TimeTicks timebase, base::TimeDelta interval);
155
147 // Overridden from ui::CompositorObserver: 156 // Overridden from ui::CompositorObserver:
148 void OnCompositingDidCommit(ui::Compositor* compositor) override; 157 void OnCompositingDidCommit(ui::Compositor* compositor) override;
149 void OnCompositingStarted(ui::Compositor* compositor, 158 void OnCompositingStarted(ui::Compositor* compositor,
150 base::TimeTicks start_time) override; 159 base::TimeTicks start_time) override;
151 void OnCompositingEnded(ui::Compositor* compositor) override; 160 void OnCompositingEnded(ui::Compositor* compositor) override;
152 void OnCompositingAborted(ui::Compositor* compositor) override; 161 void OnCompositingAborted(ui::Compositor* compositor) override;
153 void OnCompositingLockStateChanged(ui::Compositor* compositor) override; 162 void OnCompositingLockStateChanged(ui::Compositor* compositor) override;
154 163
164 // Overridden from ui::CompositorBeginFrameObserver:
165 void OnSendBeginFrame(const cc::BeginFrameArgs& args) override;
166
155 // Overridden from ui::CompositorVSyncManager::Observer: 167 // Overridden from ui::CompositorVSyncManager::Observer:
156 void OnUpdateVSyncParameters(base::TimeTicks timebase, 168 void OnUpdateVSyncParameters(base::TimeTicks timebase,
157 base::TimeDelta interval) override; 169 base::TimeDelta interval) override;
158 170
159 // Overridden from ui::LayerOwnerObserver: 171 // Overridden from ui::LayerOwnerObserver:
160 void OnLayerRecreated(ui::Layer* old_layer, ui::Layer* new_layer) override; 172 void OnLayerRecreated(ui::Layer* old_layer, ui::Layer* new_layer) override;
161 173
162 // Overridden from ImageTransportFactoryObserver: 174 // Overridden from ImageTransportFactoryObserver:
163 void OnLostResources() override; 175 void OnLostResources() override;
164 176
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 312
301 // Subscriber that listens to frame presentation events. 313 // Subscriber that listens to frame presentation events.
302 scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_; 314 scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_;
303 std::vector<scoped_refptr<OwnedMailbox> > idle_frame_subscriber_textures_; 315 std::vector<scoped_refptr<OwnedMailbox> > idle_frame_subscriber_textures_;
304 316
305 // YUV readback pipeline. 317 // YUV readback pipeline.
306 scoped_ptr<content::ReadbackYUVInterface> 318 scoped_ptr<content::ReadbackYUVInterface>
307 yuv_readback_pipeline_; 319 yuv_readback_pipeline_;
308 320
309 scoped_ptr<DelegatedFrameEvictor> delegated_frame_evictor_; 321 scoped_ptr<DelegatedFrameEvictor> delegated_frame_evictor_;
322
323 // True when unified BeginFrame scheduing is used.
324 bool begin_frame_scheduling_enabled_;
325
326 // True when RenderWidget needs a BeginFrame.
327 bool needs_begin_frames_;
328
329 // Pass |last_begin_frame_args_| to compositor when |this| is added as a
330 // CompositorBeginFrameObserver. With this, Compositor can determine whether
331 // latest BeginFrameArgs can be used immediately or not.
332 cc::BeginFrameArgs last_begin_frame_args_;
310 }; 333 };
311 334
312 } // namespace content 335 } // namespace content
313 336
314 #endif // CONTENT_BROWSER_COMPOSITOR_DELEGATED_FRAME_HOST_H_ 337 #endif // CONTENT_BROWSER_COMPOSITOR_DELEGATED_FRAME_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698