| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 void OnLayerRecreated(ui::Layer* old_layer, ui::Layer* new_layer) override; | 112 void OnLayerRecreated(ui::Layer* old_layer, ui::Layer* new_layer) override; |
| 113 | 113 |
| 114 // ImageTransportFactoryObserver implementation. | 114 // ImageTransportFactoryObserver implementation. |
| 115 void OnLostResources() override; | 115 void OnLostResources() override; |
| 116 | 116 |
| 117 // DelegatedFrameEvictorClient implementation. | 117 // DelegatedFrameEvictorClient implementation. |
| 118 void EvictDelegatedFrame() override; | 118 void EvictDelegatedFrame() override; |
| 119 | 119 |
| 120 // cc::SurfaceFactoryClient implementation. | 120 // cc::SurfaceFactoryClient implementation. |
| 121 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | 121 void ReturnResources(const cc::ReturnedResourceArray& resources) override; |
| 122 void WillDrawSurface(const cc::SurfaceId& id, | 122 void WillDrawSurface(const cc::LocalFrameId& id, |
| 123 const gfx::Rect& damage_rect) override; | 123 const gfx::Rect& damage_rect) override; |
| 124 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; | 124 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; |
| 125 | 125 |
| 126 bool CanCopyToBitmap() const; | 126 bool CanCopyToBitmap() const; |
| 127 | 127 |
| 128 // Public interface exposed to RenderWidgetHostView. | 128 // Public interface exposed to RenderWidgetHostView. |
| 129 | 129 |
| 130 void SwapDelegatedFrame(uint32_t compositor_frame_sink_id, | 130 void SwapDelegatedFrame(uint32_t compositor_frame_sink_id, |
| 131 cc::CompositorFrame frame); | 131 cc::CompositorFrame frame); |
| 132 void ClearDelegatedFrame(); | 132 void ClearDelegatedFrame(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 // Given a RenderWidgetHostViewBase that renders to a Surface that is | 170 // Given a RenderWidgetHostViewBase that renders to a Surface that is |
| 171 // contained within this class' Surface, find the relative transform between | 171 // contained within this class' Surface, find the relative transform between |
| 172 // the Surfaces and apply it to a point. If a Surface has not yet been | 172 // the Surfaces and apply it to a point. If a Surface has not yet been |
| 173 // created this returns the same point with no transform applied. | 173 // created this returns the same point with no transform applied. |
| 174 gfx::Point TransformPointToCoordSpaceForView( | 174 gfx::Point TransformPointToCoordSpaceForView( |
| 175 const gfx::Point& point, | 175 const gfx::Point& point, |
| 176 RenderWidgetHostViewBase* target_view); | 176 RenderWidgetHostViewBase* target_view); |
| 177 | 177 |
| 178 // Exposed for tests. | 178 // Exposed for tests. |
| 179 cc::SurfaceId SurfaceIdForTesting() const { return surface_id_; } | 179 cc::SurfaceId SurfaceIdForTesting() const { |
| 180 return cc::SurfaceId(frame_sink_id_, local_frame_id_); |
| 181 } |
| 182 |
| 183 const cc::LocalFrameId& LocalFrameIdForTesting() const { |
| 184 return local_frame_id_; |
| 185 } |
| 186 |
| 180 void OnCompositingDidCommitForTesting(ui::Compositor* compositor) { | 187 void OnCompositingDidCommitForTesting(ui::Compositor* compositor) { |
| 181 OnCompositingDidCommit(compositor); | 188 OnCompositingDidCommit(compositor); |
| 182 } | 189 } |
| 183 bool ReleasedFrontLockActiveForTesting() const { | 190 bool ReleasedFrontLockActiveForTesting() const { |
| 184 return !!released_front_lock_.get(); | 191 return !!released_front_lock_.get(); |
| 185 } | 192 } |
| 186 void SetRequestCopyOfOutputCallbackForTesting( | 193 void SetRequestCopyOfOutputCallbackForTesting( |
| 187 const base::Callback<void(std::unique_ptr<cc::CopyOutputRequest>)>& | 194 const base::Callback<void(std::unique_ptr<cc::CopyOutputRequest>)>& |
| 188 callback) { | 195 callback) { |
| 189 request_copy_of_output_callback_for_testing_ = callback; | 196 request_copy_of_output_callback_for_testing_ = callback; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 249 |
| 243 void SendReclaimCompositorResources(uint32_t compositor_frame_sink_id, | 250 void SendReclaimCompositorResources(uint32_t compositor_frame_sink_id, |
| 244 bool is_swap_ack); | 251 bool is_swap_ack); |
| 245 void SurfaceDrawn(uint32_t compositor_frame_sink_id); | 252 void SurfaceDrawn(uint32_t compositor_frame_sink_id); |
| 246 | 253 |
| 247 // Called to consult the current |frame_subscriber_|, to determine and maybe | 254 // Called to consult the current |frame_subscriber_|, to determine and maybe |
| 248 // initiate a copy-into-video-frame request. | 255 // initiate a copy-into-video-frame request. |
| 249 void AttemptFrameSubscriberCapture(const gfx::Rect& damage_rect); | 256 void AttemptFrameSubscriberCapture(const gfx::Rect& damage_rect); |
| 250 | 257 |
| 251 const cc::FrameSinkId frame_sink_id_; | 258 const cc::FrameSinkId frame_sink_id_; |
| 259 cc::LocalFrameId local_frame_id_; |
| 252 DelegatedFrameHostClient* const client_; | 260 DelegatedFrameHostClient* const client_; |
| 253 ui::Compositor* compositor_; | 261 ui::Compositor* compositor_; |
| 254 | 262 |
| 255 // The vsync manager we are observing for changes, if any. | 263 // The vsync manager we are observing for changes, if any. |
| 256 scoped_refptr<ui::CompositorVSyncManager> vsync_manager_; | 264 scoped_refptr<ui::CompositorVSyncManager> vsync_manager_; |
| 257 | 265 |
| 258 // 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 |
| 259 // call to SetVSyncParameters(). | 267 // call to SetVSyncParameters(). |
| 260 base::TimeTicks vsync_timebase_; | 268 base::TimeTicks vsync_timebase_; |
| 261 base::TimeDelta vsync_interval_; | 269 base::TimeDelta vsync_interval_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 279 | 287 |
| 280 std::unique_ptr<ui::Layer> right_gutter_; | 288 std::unique_ptr<ui::Layer> right_gutter_; |
| 281 std::unique_ptr<ui::Layer> bottom_gutter_; | 289 std::unique_ptr<ui::Layer> bottom_gutter_; |
| 282 | 290 |
| 283 // This is the last root background color from a swapped frame. | 291 // This is the last root background color from a swapped frame. |
| 284 SkColor background_color_; | 292 SkColor background_color_; |
| 285 | 293 |
| 286 // State for rendering into a Surface. | 294 // State for rendering into a Surface. |
| 287 std::unique_ptr<cc::SurfaceIdAllocator> id_allocator_; | 295 std::unique_ptr<cc::SurfaceIdAllocator> id_allocator_; |
| 288 std::unique_ptr<cc::SurfaceFactory> surface_factory_; | 296 std::unique_ptr<cc::SurfaceFactory> surface_factory_; |
| 289 cc::SurfaceId surface_id_; | |
| 290 gfx::Size current_surface_size_; | 297 gfx::Size current_surface_size_; |
| 291 float current_scale_factor_; | 298 float current_scale_factor_; |
| 292 cc::ReturnedResourceArray surface_returned_resources_; | 299 cc::ReturnedResourceArray surface_returned_resources_; |
| 293 | 300 |
| 294 // This lock is the one waiting for a frame of the right size to come back | 301 // This lock is the one waiting for a frame of the right size to come back |
| 295 // from the renderer/GPU process. It is set from the moment the aura window | 302 // from the renderer/GPU process. It is set from the moment the aura window |
| 296 // got resized, to the moment we committed the renderer frame of the same | 303 // got resized, to the moment we committed the renderer frame of the same |
| 297 // size. It keeps track of the size we expect from the renderer, and locks the | 304 // size. It keeps track of the size we expect from the renderer, and locks the |
| 298 // compositor, as well as the UI for a short time to give a chance to the | 305 // compositor, as well as the UI for a short time to give a chance to the |
| 299 // renderer of producing a frame of the right size. | 306 // renderer of producing a frame of the right size. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 330 // YUV readback pipeline. | 337 // YUV readback pipeline. |
| 331 std::unique_ptr<display_compositor::ReadbackYUVInterface> | 338 std::unique_ptr<display_compositor::ReadbackYUVInterface> |
| 332 yuv_readback_pipeline_; | 339 yuv_readback_pipeline_; |
| 333 | 340 |
| 334 std::unique_ptr<DelegatedFrameEvictor> delegated_frame_evictor_; | 341 std::unique_ptr<DelegatedFrameEvictor> delegated_frame_evictor_; |
| 335 }; | 342 }; |
| 336 | 343 |
| 337 } // namespace content | 344 } // namespace content |
| 338 | 345 |
| 339 #endif // CONTENT_BROWSER_RENDERER_HOST_DELEGATED_FRAME_HOST_H_ | 346 #endif // CONTENT_BROWSER_RENDERER_HOST_DELEGATED_FRAME_HOST_H_ |
| OLD | NEW |