| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // suggested color from the current page background. | 62 // suggested color from the current page background. |
| 63 virtual SkColor DelegatedFrameHostGetGutterColor(SkColor color) const = 0; | 63 virtual SkColor DelegatedFrameHostGetGutterColor(SkColor color) const = 0; |
| 64 virtual gfx::Size DelegatedFrameHostDesiredSizeInDIP() const = 0; | 64 virtual gfx::Size DelegatedFrameHostDesiredSizeInDIP() const = 0; |
| 65 | 65 |
| 66 virtual bool DelegatedFrameCanCreateResizeLock() const = 0; | 66 virtual bool DelegatedFrameCanCreateResizeLock() const = 0; |
| 67 virtual std::unique_ptr<ResizeLock> DelegatedFrameHostCreateResizeLock( | 67 virtual std::unique_ptr<ResizeLock> DelegatedFrameHostCreateResizeLock( |
| 68 bool defer_compositor_lock) = 0; | 68 bool defer_compositor_lock) = 0; |
| 69 virtual void DelegatedFrameHostResizeLockWasReleased() = 0; | 69 virtual void DelegatedFrameHostResizeLockWasReleased() = 0; |
| 70 | 70 |
| 71 virtual void DelegatedFrameHostSendReclaimCompositorResources( | 71 virtual void DelegatedFrameHostSendReclaimCompositorResources( |
| 72 int output_surface_id, | 72 int compositor_frame_sink_id, |
| 73 bool is_swap_ack, | 73 bool is_swap_ack, |
| 74 const cc::ReturnedResourceArray& resources) = 0; | 74 const cc::ReturnedResourceArray& resources) = 0; |
| 75 virtual void DelegatedFrameHostOnLostCompositorResources() = 0; | 75 virtual void DelegatedFrameHostOnLostCompositorResources() = 0; |
| 76 | 76 |
| 77 virtual void SetBeginFrameSource(cc::BeginFrameSource* source) = 0; | 77 virtual void SetBeginFrameSource(cc::BeginFrameSource* source) = 0; |
| 78 virtual bool IsAutoResizeEnabled() const = 0; | 78 virtual bool IsAutoResizeEnabled() const = 0; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 // The DelegatedFrameHost is used to host all of the RenderWidgetHostView state | 81 // The DelegatedFrameHost is used to host all of the RenderWidgetHostView state |
| 82 // and functionality that is associated with delegated frames being sent from | 82 // and functionality that is associated with delegated frames being sent from |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // cc::SurfaceFactoryClient implementation. | 119 // cc::SurfaceFactoryClient implementation. |
| 120 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | 120 void ReturnResources(const cc::ReturnedResourceArray& resources) override; |
| 121 void WillDrawSurface(const cc::SurfaceId& id, | 121 void WillDrawSurface(const cc::SurfaceId& id, |
| 122 const gfx::Rect& damage_rect) override; | 122 const gfx::Rect& damage_rect) override; |
| 123 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; | 123 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; |
| 124 | 124 |
| 125 bool CanCopyToBitmap() const; | 125 bool CanCopyToBitmap() const; |
| 126 | 126 |
| 127 // Public interface exposed to RenderWidgetHostView. | 127 // Public interface exposed to RenderWidgetHostView. |
| 128 | 128 |
| 129 void SwapDelegatedFrame(uint32_t output_surface_id, | 129 void SwapDelegatedFrame(uint32_t compositor_frame_sink_id, |
| 130 cc::CompositorFrame frame); | 130 cc::CompositorFrame frame); |
| 131 void ClearDelegatedFrame(); | 131 void ClearDelegatedFrame(); |
| 132 void WasHidden(); | 132 void WasHidden(); |
| 133 void WasShown(const ui::LatencyInfo& latency_info); | 133 void WasShown(const ui::LatencyInfo& latency_info); |
| 134 void WasResized(); | 134 void WasResized(); |
| 135 bool HasSavedFrame(); | 135 bool HasSavedFrame(); |
| 136 gfx::Size GetRequestedRendererSize() const; | 136 gfx::Size GetRequestedRendererSize() const; |
| 137 void SetCompositor(ui::Compositor* compositor); | 137 void SetCompositor(ui::Compositor* compositor); |
| 138 void ResetCompositor(); | 138 void ResetCompositor(); |
| 139 // Note: |src_subset| is specified in DIP dimensions while |output_size| | 139 // Note: |src_subset| is specified in DIP dimensions while |output_size| |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 base::WeakPtr<DelegatedFrameHost> rwhva, | 232 base::WeakPtr<DelegatedFrameHost> rwhva, |
| 233 const base::Callback<void(bool)>& callback, | 233 const base::Callback<void(bool)>& callback, |
| 234 scoped_refptr<OwnedMailbox> subscriber_texture, | 234 scoped_refptr<OwnedMailbox> subscriber_texture, |
| 235 std::unique_ptr<cc::SingleReleaseCallback> release_callback, | 235 std::unique_ptr<cc::SingleReleaseCallback> release_callback, |
| 236 bool result); | 236 bool result); |
| 237 static void ReturnSubscriberTexture( | 237 static void ReturnSubscriberTexture( |
| 238 base::WeakPtr<DelegatedFrameHost> rwhva, | 238 base::WeakPtr<DelegatedFrameHost> rwhva, |
| 239 scoped_refptr<OwnedMailbox> subscriber_texture, | 239 scoped_refptr<OwnedMailbox> subscriber_texture, |
| 240 const gpu::SyncToken& sync_token); | 240 const gpu::SyncToken& sync_token); |
| 241 | 241 |
| 242 void SendReclaimCompositorResources(uint32_t output_surface_id, | 242 void SendReclaimCompositorResources(uint32_t compositor_frame_sink_id, |
| 243 bool is_swap_ack); | 243 bool is_swap_ack); |
| 244 void SurfaceDrawn(uint32_t output_surface_id); | 244 void SurfaceDrawn(uint32_t compositor_frame_sink_id); |
| 245 | 245 |
| 246 // Called to consult the current |frame_subscriber_|, to determine and maybe | 246 // Called to consult the current |frame_subscriber_|, to determine and maybe |
| 247 // initiate a copy-into-video-frame request. | 247 // initiate a copy-into-video-frame request. |
| 248 void AttemptFrameSubscriberCapture(const gfx::Rect& damage_rect); | 248 void AttemptFrameSubscriberCapture(const gfx::Rect& damage_rect); |
| 249 | 249 |
| 250 DelegatedFrameHostClient* const client_; | 250 DelegatedFrameHostClient* const client_; |
| 251 ui::Compositor* compositor_; | 251 ui::Compositor* compositor_; |
| 252 | 252 |
| 253 // The vsync manager we are observing for changes, if any. | 253 // The vsync manager we are observing for changes, if any. |
| 254 scoped_refptr<ui::CompositorVSyncManager> vsync_manager_; | 254 scoped_refptr<ui::CompositorVSyncManager> vsync_manager_; |
| 255 | 255 |
| 256 // The current VSync timebase and interval. These are zero until the first | 256 // The current VSync timebase and interval. These are zero until the first |
| 257 // call to SetVSyncParameters(). | 257 // call to SetVSyncParameters(). |
| 258 base::TimeTicks vsync_timebase_; | 258 base::TimeTicks vsync_timebase_; |
| 259 base::TimeDelta vsync_interval_; | 259 base::TimeDelta vsync_interval_; |
| 260 | 260 |
| 261 // Overridable tick clock used for testing functions using current time. | 261 // Overridable tick clock used for testing functions using current time. |
| 262 std::unique_ptr<base::TickClock> tick_clock_; | 262 std::unique_ptr<base::TickClock> tick_clock_; |
| 263 | 263 |
| 264 // With delegated renderer, this is the last output surface, used to | 264 // With delegated renderer, this is the last output surface, used to |
| 265 // disambiguate resources with the same id coming from different output | 265 // disambiguate resources with the same id coming from different output |
| 266 // surfaces. | 266 // surfaces. |
| 267 uint32_t last_output_surface_id_; | 267 uint32_t last_compositor_frame_sink_id_; |
| 268 | 268 |
| 269 // The number of delegated frame acks that are pending, to delay resource | 269 // The number of delegated frame acks that are pending, to delay resource |
| 270 // returns until the acks are sent. | 270 // returns until the acks are sent. |
| 271 int pending_delegated_ack_count_; | 271 int pending_delegated_ack_count_; |
| 272 | 272 |
| 273 // True after a delegated frame has been skipped, until a frame is not | 273 // True after a delegated frame has been skipped, until a frame is not |
| 274 // skipped. | 274 // skipped. |
| 275 bool skipped_frames_; | 275 bool skipped_frames_; |
| 276 std::vector<ui::LatencyInfo> skipped_latency_info_list_; | 276 std::vector<ui::LatencyInfo> skipped_latency_info_list_; |
| 277 | 277 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 // YUV readback pipeline. | 328 // YUV readback pipeline. |
| 329 std::unique_ptr<display_compositor::ReadbackYUVInterface> | 329 std::unique_ptr<display_compositor::ReadbackYUVInterface> |
| 330 yuv_readback_pipeline_; | 330 yuv_readback_pipeline_; |
| 331 | 331 |
| 332 std::unique_ptr<DelegatedFrameEvictor> delegated_frame_evictor_; | 332 std::unique_ptr<DelegatedFrameEvictor> delegated_frame_evictor_; |
| 333 }; | 333 }; |
| 334 | 334 |
| 335 } // namespace content | 335 } // namespace content |
| 336 | 336 |
| 337 #endif // CONTENT_BROWSER_RENDERER_HOST_DELEGATED_FRAME_HOST_H_ | 337 #endif // CONTENT_BROWSER_RENDERER_HOST_DELEGATED_FRAME_HOST_H_ |
| OLD | NEW |