OLD | NEW |
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_RENDERER_HOST_DELEGATED_FRAME_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_DELEGATED_FRAME_HOST_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_DELEGATED_FRAME_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_DELEGATED_FRAME_HOST_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 virtual bool DelegatedFrameCanCreateResizeLock() const = 0; | 68 virtual bool DelegatedFrameCanCreateResizeLock() const = 0; |
69 virtual std::unique_ptr<ResizeLock> DelegatedFrameHostCreateResizeLock( | 69 virtual std::unique_ptr<ResizeLock> DelegatedFrameHostCreateResizeLock( |
70 bool defer_compositor_lock) = 0; | 70 bool defer_compositor_lock) = 0; |
71 virtual void DelegatedFrameHostResizeLockWasReleased() = 0; | 71 virtual void DelegatedFrameHostResizeLockWasReleased() = 0; |
72 | 72 |
73 virtual void DelegatedFrameHostSendReclaimCompositorResources( | 73 virtual void DelegatedFrameHostSendReclaimCompositorResources( |
74 int compositor_frame_sink_id, | 74 int compositor_frame_sink_id, |
75 bool is_swap_ack, | 75 bool is_swap_ack, |
76 const cc::ReturnedResourceArray& resources) = 0; | 76 const cc::ReturnedResourceArray& resources) = 0; |
77 | 77 |
78 virtual void SetBeginFrameSource(cc::BeginFrameSource* source) = 0; | 78 virtual void OnBeginFrame(const cc::BeginFrameArgs& args) = 0; |
79 virtual bool IsAutoResizeEnabled() const = 0; | 79 virtual bool IsAutoResizeEnabled() const = 0; |
80 }; | 80 }; |
81 | 81 |
82 // The DelegatedFrameHost is used to host all of the RenderWidgetHostView state | 82 // The DelegatedFrameHost is used to host all of the RenderWidgetHostView state |
83 // and functionality that is associated with delegated frames being sent from | 83 // and functionality that is associated with delegated frames being sent from |
84 // the RenderWidget. The DelegatedFrameHost will push these changes through to | 84 // the RenderWidget. The DelegatedFrameHost will push these changes through to |
85 // the ui::Compositor associated with its DelegatedFrameHostClient. | 85 // the ui::Compositor associated with its DelegatedFrameHostClient. |
86 class CONTENT_EXPORT DelegatedFrameHost | 86 class CONTENT_EXPORT DelegatedFrameHost |
87 : public ui::CompositorObserver, | 87 : public ui::CompositorObserver, |
88 public ui::CompositorVSyncManager::Observer, | 88 public ui::CompositorVSyncManager::Observer, |
89 public ui::ContextFactoryObserver, | 89 public ui::ContextFactoryObserver, |
90 public DelegatedFrameEvictorClient, | 90 public DelegatedFrameEvictorClient, |
91 public NON_EXPORTED_BASE(cc::CompositorFrameSinkSupportClient), | 91 public NON_EXPORTED_BASE(cc::CompositorFrameSinkSupportClient), |
92 public cc::ExternalBeginFrameSourceClient, | |
93 public base::SupportsWeakPtr<DelegatedFrameHost> { | 92 public base::SupportsWeakPtr<DelegatedFrameHost> { |
94 public: | 93 public: |
95 DelegatedFrameHost(const cc::FrameSinkId& frame_sink_id, | 94 DelegatedFrameHost(const cc::FrameSinkId& frame_sink_id, |
96 DelegatedFrameHostClient* client); | 95 DelegatedFrameHostClient* client); |
97 ~DelegatedFrameHost() override; | 96 ~DelegatedFrameHost() override; |
98 | 97 |
99 // ui::CompositorObserver implementation. | 98 // ui::CompositorObserver implementation. |
100 void OnCompositingDidCommit(ui::Compositor* compositor) override; | 99 void OnCompositingDidCommit(ui::Compositor* compositor) override; |
101 void OnCompositingStarted(ui::Compositor* compositor, | 100 void OnCompositingStarted(ui::Compositor* compositor, |
102 base::TimeTicks start_time) override; | 101 base::TimeTicks start_time) override; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 166 |
168 // Given a RenderWidgetHostViewBase that renders to a Surface that is | 167 // Given a RenderWidgetHostViewBase that renders to a Surface that is |
169 // contained within this class' Surface, find the relative transform between | 168 // contained within this class' Surface, find the relative transform between |
170 // the Surfaces and apply it to a point. Returns false if a Surface has not | 169 // the Surfaces and apply it to a point. Returns false if a Surface has not |
171 // yet been created or if |target_view| is not a descendant RWHV from our | 170 // yet been created or if |target_view| is not a descendant RWHV from our |
172 // client. | 171 // client. |
173 bool TransformPointToCoordSpaceForView(const gfx::Point& point, | 172 bool TransformPointToCoordSpaceForView(const gfx::Point& point, |
174 RenderWidgetHostViewBase* target_view, | 173 RenderWidgetHostViewBase* target_view, |
175 gfx::Point* transformed_point); | 174 gfx::Point* transformed_point); |
176 | 175 |
| 176 void SetNeedsBeginFrames(bool needs_begin_frames); |
| 177 void BeginFrameDidNotSwap(const cc::BeginFrameAck& ack); |
| 178 |
177 // Exposed for tests. | 179 // Exposed for tests. |
178 cc::SurfaceId SurfaceIdForTesting() const { | 180 cc::SurfaceId SurfaceIdForTesting() const { |
179 return cc::SurfaceId(frame_sink_id_, local_surface_id_); | 181 return cc::SurfaceId(frame_sink_id_, local_surface_id_); |
180 } | 182 } |
181 | 183 |
182 bool HasFrameForTesting() const { return has_frame_; } | 184 bool HasFrameForTesting() const { return has_frame_; } |
183 | 185 |
184 void OnCompositingDidCommitForTesting(ui::Compositor* compositor) { | 186 void OnCompositingDidCommitForTesting(ui::Compositor* compositor) { |
185 OnCompositingDidCommit(compositor); | 187 OnCompositingDidCommit(compositor); |
186 } | 188 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 bool result); | 243 bool result); |
242 static void ReturnSubscriberTexture( | 244 static void ReturnSubscriberTexture( |
243 base::WeakPtr<DelegatedFrameHost> rwhva, | 245 base::WeakPtr<DelegatedFrameHost> rwhva, |
244 scoped_refptr<OwnedMailbox> subscriber_texture, | 246 scoped_refptr<OwnedMailbox> subscriber_texture, |
245 const gpu::SyncToken& sync_token); | 247 const gpu::SyncToken& sync_token); |
246 | 248 |
247 // Called to consult the current |frame_subscriber_|, to determine and maybe | 249 // Called to consult the current |frame_subscriber_|, to determine and maybe |
248 // initiate a copy-into-video-frame request. | 250 // initiate a copy-into-video-frame request. |
249 void AttemptFrameSubscriberCapture(const gfx::Rect& damage_rect); | 251 void AttemptFrameSubscriberCapture(const gfx::Rect& damage_rect); |
250 | 252 |
251 // cc::ExternalBeginFrameSource implementation. | |
252 void OnNeedsBeginFrames(bool needs_begin_frames) override; | |
253 void OnDidFinishFrame(const cc::BeginFrameAck& ack) override; | |
254 | |
255 void CreateCompositorFrameSinkSupport(); | 253 void CreateCompositorFrameSinkSupport(); |
256 void ResetCompositorFrameSinkSupport(); | 254 void ResetCompositorFrameSinkSupport(); |
257 | 255 |
| 256 void DidFinishFrame(const cc::BeginFrameAck& ack); |
| 257 |
258 const cc::FrameSinkId frame_sink_id_; | 258 const cc::FrameSinkId frame_sink_id_; |
259 cc::LocalSurfaceId local_surface_id_; | 259 cc::LocalSurfaceId local_surface_id_; |
260 DelegatedFrameHostClient* const client_; | 260 DelegatedFrameHostClient* const client_; |
261 ui::Compositor* compositor_; | 261 ui::Compositor* compositor_; |
262 | 262 |
263 // The vsync manager we are observing for changes, if any. | 263 // The vsync manager we are observing for changes, if any. |
264 scoped_refptr<ui::CompositorVSyncManager> vsync_manager_; | 264 scoped_refptr<ui::CompositorVSyncManager> vsync_manager_; |
265 | 265 |
266 // The current VSync timebase and interval. These are zero until the first | 266 // The current VSync timebase and interval. These are zero until the first |
267 // call to SetVSyncParameters(). | 267 // call to SetVSyncParameters(). |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 | 326 |
327 // Callback used to pass the output request to the layer or to a function | 327 // Callback used to pass the output request to the layer or to a function |
328 // specified by a test. | 328 // specified by a test. |
329 base::Callback<void(std::unique_ptr<cc::CopyOutputRequest>)> | 329 base::Callback<void(std::unique_ptr<cc::CopyOutputRequest>)> |
330 request_copy_of_output_callback_for_testing_; | 330 request_copy_of_output_callback_for_testing_; |
331 | 331 |
332 // YUV readback pipeline. | 332 // YUV readback pipeline. |
333 std::unique_ptr<display_compositor::ReadbackYUVInterface> | 333 std::unique_ptr<display_compositor::ReadbackYUVInterface> |
334 yuv_readback_pipeline_; | 334 yuv_readback_pipeline_; |
335 | 335 |
336 std::unique_ptr<cc::ExternalBeginFrameSource> begin_frame_source_; | |
337 bool needs_begin_frame_ = false; | 336 bool needs_begin_frame_ = false; |
338 uint32_t latest_confirmed_begin_frame_source_id_ = 0; | 337 uint32_t latest_confirmed_begin_frame_source_id_ = 0; |
339 uint64_t latest_confirmed_begin_frame_sequence_number_ = | 338 uint64_t latest_confirmed_begin_frame_sequence_number_ = |
340 cc::BeginFrameArgs::kInvalidFrameNumber; | 339 cc::BeginFrameArgs::kInvalidFrameNumber; |
341 | 340 |
342 bool has_frame_ = false; | 341 bool has_frame_ = false; |
343 | 342 |
344 std::unique_ptr<DelegatedFrameEvictor> delegated_frame_evictor_; | 343 std::unique_ptr<DelegatedFrameEvictor> delegated_frame_evictor_; |
345 }; | 344 }; |
346 | 345 |
347 } // namespace content | 346 } // namespace content |
348 | 347 |
349 #endif // CONTENT_BROWSER_RENDERER_HOST_DELEGATED_FRAME_HOST_H_ | 348 #endif // CONTENT_BROWSER_RENDERER_HOST_DELEGATED_FRAME_HOST_H_ |
OLD | NEW |