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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // OnSwapCompositorFrame, 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 bool OnMessageReceived(const IPC::Message& msg) override; | |
73 void InitAsChild(gfx::NativeView parent_view) override; | 72 void InitAsChild(gfx::NativeView parent_view) override; |
74 RenderWidgetHost* GetRenderWidgetHost() const override; | 73 RenderWidgetHost* GetRenderWidgetHost() const override; |
75 void SetSize(const gfx::Size& size) override; | 74 void SetSize(const gfx::Size& size) override; |
76 void SetBounds(const gfx::Rect& rect) override; | 75 void SetBounds(const gfx::Rect& rect) override; |
77 void Focus() override; | 76 void Focus() override; |
78 bool HasFocus() const override; | 77 bool HasFocus() const override; |
79 bool IsSurfaceAvailableForCopy() const override; | 78 bool IsSurfaceAvailableForCopy() const override; |
80 void Show() override; | 79 void Show() override; |
81 void Hide() override; | 80 void Hide() override; |
82 bool IsShowing() override; | 81 bool IsShowing() override; |
83 gfx::Rect GetViewBounds() const override; | 82 gfx::Rect GetViewBounds() const override; |
84 gfx::Size GetVisibleViewportSize() const override; | 83 gfx::Size GetVisibleViewportSize() const override; |
85 gfx::Vector2dF GetLastScrollOffset() const override; | 84 gfx::Vector2dF GetLastScrollOffset() const override; |
86 gfx::NativeView GetNativeView() const override; | 85 gfx::NativeView GetNativeView() const override; |
87 gfx::NativeViewAccessible GetNativeViewAccessible() override; | 86 gfx::NativeViewAccessible GetNativeViewAccessible() override; |
88 void SetBackgroundColor(SkColor color) override; | 87 void SetBackgroundColor(SkColor color) override; |
89 gfx::Size GetPhysicalBackingSize() const override; | 88 gfx::Size GetPhysicalBackingSize() const override; |
90 bool IsMouseLocked() override; | 89 bool IsMouseLocked() override; |
| 90 void SetNeedsBeginFrames(bool needs_begin_frames) override; |
91 | 91 |
92 // RenderWidgetHostViewBase implementation. | 92 // RenderWidgetHostViewBase implementation. |
93 void InitAsPopup(RenderWidgetHostView* parent_host_view, | 93 void InitAsPopup(RenderWidgetHostView* parent_host_view, |
94 const gfx::Rect& bounds) override; | 94 const gfx::Rect& bounds) override; |
95 void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override; | 95 void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override; |
96 void UpdateCursor(const WebCursor& cursor) override; | 96 void UpdateCursor(const WebCursor& cursor) override; |
97 void SetIsLoading(bool is_loading) override; | 97 void SetIsLoading(bool is_loading) override; |
98 void RenderProcessGone(base::TerminationStatus status, | 98 void RenderProcessGone(base::TerminationStatus status, |
99 int error_code) override; | 99 int error_code) override; |
100 void Destroy() override; | 100 void Destroy() override; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
163 // cc::SurfaceFactoryClient implementation. | 163 // cc::SurfaceFactoryClient implementation. |
164 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | 164 void ReturnResources(const cc::ReturnedResourceArray& resources) override; |
165 void SetBeginFrameSource(cc::BeginFrameSource* source) override; | 165 void SetBeginFrameSource(cc::BeginFrameSource* source) override; |
166 | 166 |
167 // cc::BeginFrameObserver implementation. | 167 // cc::BeginFrameObserver implementation. |
168 void OnBeginFrame(const cc::BeginFrameArgs& args) override; | 168 void OnBeginFrame(const cc::BeginFrameArgs& args) override; |
169 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override; | 169 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override; |
170 void OnBeginFrameSourcePausedChanged(bool paused) override; | 170 void OnBeginFrameSourcePausedChanged(bool paused) override; |
171 | 171 |
172 void OnSetNeedsBeginFrames(bool needs_begin_frames); | |
173 | |
174 // Declared 'public' instead of 'protected' here to allow derived classes | 172 // Declared 'public' instead of 'protected' here to allow derived classes |
175 // to Bind() to it. | 173 // to Bind() to it. |
176 void SurfaceDrawn(uint32_t output_surface_id); | 174 void SurfaceDrawn(uint32_t output_surface_id); |
177 | 175 |
178 // Exposed for tests. | 176 // Exposed for tests. |
179 bool IsChildFrameForTesting() const override; | 177 bool IsChildFrameForTesting() const override; |
180 cc::SurfaceId SurfaceIdForTesting() const override; | 178 cc::SurfaceId SurfaceIdForTesting() const override; |
181 CrossProcessFrameConnector* FrameConnectorForTesting() const { | 179 CrossProcessFrameConnector* FrameConnectorForTesting() const { |
182 return frame_connector_; | 180 return frame_connector_; |
183 } | 181 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 const SkColorType preferred_color_type); | 232 const SkColorType preferred_color_type); |
235 | 233 |
236 using FrameSwappedCallbackList = std::deque<std::unique_ptr<base::Closure>>; | 234 using FrameSwappedCallbackList = std::deque<std::unique_ptr<base::Closure>>; |
237 // Since frame-drawn callbacks are "fire once", we use std::deque to make | 235 // Since frame-drawn callbacks are "fire once", we use std::deque to make |
238 // it convenient to swap() when processing the list. | 236 // it convenient to swap() when processing the list. |
239 FrameSwappedCallbackList frame_swapped_callbacks_; | 237 FrameSwappedCallbackList frame_swapped_callbacks_; |
240 | 238 |
241 // The begin frame source being observed. Null if none. | 239 // The begin frame source being observed. Null if none. |
242 cc::BeginFrameSource* begin_frame_source_; | 240 cc::BeginFrameSource* begin_frame_source_; |
243 cc::BeginFrameArgs last_begin_frame_args_; | 241 cc::BeginFrameArgs last_begin_frame_args_; |
244 bool observing_begin_frame_source_; | |
245 // The surface client ID of the parent RenderWidgetHostView. 0 if none. | 242 // The surface client ID of the parent RenderWidgetHostView. 0 if none. |
246 uint32_t parent_surface_client_id_; | 243 uint32_t parent_surface_client_id_; |
247 | 244 |
248 base::WeakPtrFactory<RenderWidgetHostViewChildFrame> weak_factory_; | 245 base::WeakPtrFactory<RenderWidgetHostViewChildFrame> weak_factory_; |
249 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrame); | 246 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrame); |
250 }; | 247 }; |
251 | 248 |
252 } // namespace content | 249 } // namespace content |
253 | 250 |
254 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_ | 251 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_ |
OLD | NEW |