| 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_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_ |
| 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 public NON_EXPORTED_BASE(cc::CompositorFrameSinkSupportClient) { | 54 public NON_EXPORTED_BASE(cc::CompositorFrameSinkSupportClient) { |
| 55 public: | 55 public: |
| 56 static RenderWidgetHostViewChildFrame* Create(RenderWidgetHost* widget); | 56 static RenderWidgetHostViewChildFrame* Create(RenderWidgetHost* widget); |
| 57 ~RenderWidgetHostViewChildFrame() override; | 57 ~RenderWidgetHostViewChildFrame() override; |
| 58 | 58 |
| 59 void SetCrossProcessFrameConnector( | 59 void SetCrossProcessFrameConnector( |
| 60 CrossProcessFrameConnector* frame_connector); | 60 CrossProcessFrameConnector* frame_connector); |
| 61 | 61 |
| 62 // This functions registers single-use callbacks that want to be notified when | 62 // This functions registers single-use callbacks that want to be notified when |
| 63 // the next frame is swapped. The callback is triggered by | 63 // the next frame is swapped. The callback is triggered by |
| 64 // OnSwapCompositorFrame, which is the appropriate time to request pixel | 64 // ProcessCompositorFrame, which is the appropriate time to request pixel |
| 65 // readback for the frame that is about to be drawn. Once called, the callback | 65 // readback for the frame that is about to be drawn. Once called, the callback |
| 66 // pointer is released. | 66 // pointer is released. |
| 67 // TODO(wjmaclean): We should consider making this available in other view | 67 // TODO(wjmaclean): We should consider making this available in other view |
| 68 // types, such as RenderWidgetHostViewAura. | 68 // types, such as RenderWidgetHostViewAura. |
| 69 void RegisterFrameSwappedCallback(std::unique_ptr<base::Closure> callback); | 69 void RegisterFrameSwappedCallback(std::unique_ptr<base::Closure> callback); |
| 70 | 70 |
| 71 // RenderWidgetHostView implementation. | 71 // RenderWidgetHostView implementation. |
| 72 void InitAsChild(gfx::NativeView parent_view) override; | 72 void InitAsChild(gfx::NativeView parent_view) override; |
| 73 RenderWidgetHost* GetRenderWidgetHost() const override; | 73 RenderWidgetHost* GetRenderWidgetHost() const override; |
| 74 void SetSize(const gfx::Size& size) override; | 74 void SetSize(const gfx::Size& size) override; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 99 void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override; | 99 void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override; |
| 100 void UpdateCursor(const WebCursor& cursor) override; | 100 void UpdateCursor(const WebCursor& cursor) override; |
| 101 void SetIsLoading(bool is_loading) override; | 101 void SetIsLoading(bool is_loading) override; |
| 102 void RenderProcessGone(base::TerminationStatus status, | 102 void RenderProcessGone(base::TerminationStatus status, |
| 103 int error_code) override; | 103 int error_code) override; |
| 104 void Destroy() override; | 104 void Destroy() override; |
| 105 void SetTooltipText(const base::string16& tooltip_text) override; | 105 void SetTooltipText(const base::string16& tooltip_text) override; |
| 106 bool HasAcceleratedSurface(const gfx::Size& desired_size) override; | 106 bool HasAcceleratedSurface(const gfx::Size& desired_size) override; |
| 107 void GestureEventAck(const blink::WebGestureEvent& event, | 107 void GestureEventAck(const blink::WebGestureEvent& event, |
| 108 InputEventAckState ack_result) override; | 108 InputEventAckState ack_result) override; |
| 109 void OnSwapCompositorFrame(uint32_t compositor_frame_sink_id, | 109 void DidCreateNewRendererCompositorFrameSink() override; |
| 110 const cc::LocalSurfaceId& local_surface_id, | 110 void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, |
| 111 cc::CompositorFrame frame) override; | 111 cc::CompositorFrame frame) override; |
| 112 void OnBeginFrameDidNotSwap(const cc::BeginFrameAck& ack) override; | 112 void OnBeginFrameDidNotSwap(const cc::BeginFrameAck& ack) override; |
| 113 // Since the URL of content rendered by this class is not displayed in | 113 // Since the URL of content rendered by this class is not displayed in |
| 114 // the URL bar, this method does not need an implementation. | 114 // the URL bar, this method does not need an implementation. |
| 115 void ClearCompositorFrame() override {} | 115 void ClearCompositorFrame() override {} |
| 116 gfx::Rect GetBoundsInRootWindow() override; | 116 gfx::Rect GetBoundsInRootWindow() override; |
| 117 void ProcessAckedTouchEvent(const TouchEventWithLatencyInfo& touch, | 117 void ProcessAckedTouchEvent(const TouchEventWithLatencyInfo& touch, |
| 118 InputEventAckState ack_result) override; | 118 InputEventAckState ack_result) override; |
| 119 bool LockMouse() override; | 119 bool LockMouse() override; |
| 120 void UnlockMouse() override; | 120 void UnlockMouse() override; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 protected: | 187 protected: |
| 188 friend class RenderWidgetHostView; | 188 friend class RenderWidgetHostView; |
| 189 friend class RenderWidgetHostViewChildFrameTest; | 189 friend class RenderWidgetHostViewChildFrameTest; |
| 190 friend class RenderWidgetHostViewGuestSurfaceTest; | 190 friend class RenderWidgetHostViewGuestSurfaceTest; |
| 191 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewChildFrameTest, | 191 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewChildFrameTest, |
| 192 ForwardsBeginFrameAcks); | 192 ForwardsBeginFrameAcks); |
| 193 | 193 |
| 194 explicit RenderWidgetHostViewChildFrame(RenderWidgetHost* widget); | 194 explicit RenderWidgetHostViewChildFrame(RenderWidgetHost* widget); |
| 195 void Init(); | 195 void Init(); |
| 196 | 196 |
| 197 void ProcessCompositorFrame(uint32_t compositor_frame_sink_id, | 197 void ProcessCompositorFrame(const cc::LocalSurfaceId& local_surface_id, |
| 198 const cc::LocalSurfaceId& local_surface_id, | |
| 199 cc::CompositorFrame frame); | 198 cc::CompositorFrame frame); |
| 200 | 199 |
| 201 void SendSurfaceInfoToEmbedder(); | 200 void SendSurfaceInfoToEmbedder(); |
| 202 | 201 |
| 203 // Clears current compositor surface, if one is in use. | 202 // Clears current compositor surface, if one is in use. |
| 204 void ClearCompositorSurfaceIfNecessary(); | 203 void ClearCompositorSurfaceIfNecessary(); |
| 205 | 204 |
| 206 void ProcessFrameSwappedCallbacks(); | 205 void ProcessFrameSwappedCallbacks(); |
| 207 | 206 |
| 208 // The last scroll offset of the view. | 207 // The last scroll offset of the view. |
| 209 gfx::Vector2dF last_scroll_offset_; | 208 gfx::Vector2dF last_scroll_offset_; |
| 210 | 209 |
| 211 // Members will become private when RenderWidgetHostViewGuest is removed. | 210 // Members will become private when RenderWidgetHostViewGuest is removed. |
| 212 // The model object. | 211 // The model object. |
| 213 RenderWidgetHostImpl* host_; | 212 RenderWidgetHostImpl* host_; |
| 214 | 213 |
| 215 // The ID for FrameSink associated with this view. | 214 // The ID for FrameSink associated with this view. |
| 216 cc::FrameSinkId frame_sink_id_; | 215 cc::FrameSinkId frame_sink_id_; |
| 217 | 216 |
| 218 // Surface-related state. | 217 // Surface-related state. |
| 219 std::unique_ptr<cc::CompositorFrameSinkSupport> support_; | 218 std::unique_ptr<cc::CompositorFrameSinkSupport> support_; |
| 220 cc::LocalSurfaceId local_surface_id_; | 219 cc::LocalSurfaceId local_surface_id_; |
| 221 uint32_t next_surface_sequence_; | 220 uint32_t next_surface_sequence_; |
| 222 uint32_t last_compositor_frame_sink_id_; | |
| 223 gfx::Size current_surface_size_; | 221 gfx::Size current_surface_size_; |
| 224 float current_surface_scale_factor_; | 222 float current_surface_scale_factor_; |
| 225 gfx::Rect last_screen_rect_; | 223 gfx::Rect last_screen_rect_; |
| 226 | 224 |
| 227 // frame_connector_ provides a platform abstraction. Messages | 225 // frame_connector_ provides a platform abstraction. Messages |
| 228 // sent through it are routed to the embedding renderer process. | 226 // sent through it are routed to the embedding renderer process. |
| 229 CrossProcessFrameConnector* frame_connector_; | 227 CrossProcessFrameConnector* frame_connector_; |
| 230 | 228 |
| 231 base::WeakPtr<RenderWidgetHostViewChildFrame> AsWeakPtr() { | 229 base::WeakPtr<RenderWidgetHostViewChildFrame> AsWeakPtr() { |
| 232 return weak_factory_.GetWeakPtr(); | 230 return weak_factory_.GetWeakPtr(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 257 | 255 |
| 258 bool has_frame_ = false; | 256 bool has_frame_ = false; |
| 259 | 257 |
| 260 base::WeakPtrFactory<RenderWidgetHostViewChildFrame> weak_factory_; | 258 base::WeakPtrFactory<RenderWidgetHostViewChildFrame> weak_factory_; |
| 261 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrame); | 259 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrame); |
| 262 }; | 260 }; |
| 263 | 261 |
| 264 } // namespace content | 262 } // namespace content |
| 265 | 263 |
| 266 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_ | 264 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_ |
| OLD | NEW |