OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <queue> | 9 #include <queue> |
10 | 10 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 virtual void OnSwapCompositorFrame( | 168 virtual void OnSwapCompositorFrame( |
169 uint32 output_surface_id, | 169 uint32 output_surface_id, |
170 scoped_ptr<cc::CompositorFrame> frame) OVERRIDE; | 170 scoped_ptr<cc::CompositorFrame> frame) OVERRIDE; |
171 virtual void OnOverscrolled(gfx::Vector2dF accumulated_overscroll, | 171 virtual void OnOverscrolled(gfx::Vector2dF accumulated_overscroll, |
172 gfx::Vector2dF current_fling_velocity) OVERRIDE; | 172 gfx::Vector2dF current_fling_velocity) OVERRIDE; |
173 virtual void DidStopFlinging() OVERRIDE; | 173 virtual void DidStopFlinging() OVERRIDE; |
174 virtual void ShowDisambiguationPopup(const gfx::Rect& target_rect, | 174 virtual void ShowDisambiguationPopup(const gfx::Rect& target_rect, |
175 const SkBitmap& zoomed_bitmap) OVERRIDE; | 175 const SkBitmap& zoomed_bitmap) OVERRIDE; |
176 virtual scoped_ptr<SyntheticGestureTarget> CreateSyntheticGestureTarget() | 176 virtual scoped_ptr<SyntheticGestureTarget> CreateSyntheticGestureTarget() |
177 OVERRIDE; | 177 OVERRIDE; |
| 178 virtual void LockCompositingSurface() OVERRIDE; |
| 179 virtual void UnlockCompositingSurface() OVERRIDE; |
178 | 180 |
179 // Implementation of BrowserAccessibilityDelegate: | 181 // Implementation of BrowserAccessibilityDelegate: |
180 virtual void SetAccessibilityFocus(int acc_obj_id) OVERRIDE; | 182 virtual void SetAccessibilityFocus(int acc_obj_id) OVERRIDE; |
181 virtual void AccessibilityDoDefaultAction(int acc_obj_id) OVERRIDE; | 183 virtual void AccessibilityDoDefaultAction(int acc_obj_id) OVERRIDE; |
182 virtual void AccessibilityScrollToMakeVisible( | 184 virtual void AccessibilityScrollToMakeVisible( |
183 int acc_obj_id, gfx::Rect subfocus) OVERRIDE; | 185 int acc_obj_id, gfx::Rect subfocus) OVERRIDE; |
184 virtual void AccessibilityScrollToPoint( | 186 virtual void AccessibilityScrollToPoint( |
185 int acc_obj_id, gfx::Point point) OVERRIDE; | 187 int acc_obj_id, gfx::Point point) OVERRIDE; |
186 virtual void AccessibilitySetTextSelection( | 188 virtual void AccessibilitySetTextSelection( |
187 int acc_obj_id, int start_offset, int end_offset) OVERRIDE; | 189 int acc_obj_id, int start_offset, int end_offset) OVERRIDE; |
(...skipping 25 matching lines...) Expand all Loading... |
213 void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event); | 215 void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event); |
214 void SendGestureEvent(const blink::WebGestureEvent& event); | 216 void SendGestureEvent(const blink::WebGestureEvent& event); |
215 void SendBeginFrame(const cc::BeginFrameArgs& args); | 217 void SendBeginFrame(const cc::BeginFrameArgs& args); |
216 | 218 |
217 void OnTextInputStateChanged(const ViewHostMsg_TextInputState_Params& params); | 219 void OnTextInputStateChanged(const ViewHostMsg_TextInputState_Params& params); |
218 void OnDidChangeBodyBackgroundColor(SkColor color); | 220 void OnDidChangeBodyBackgroundColor(SkColor color); |
219 void OnStartContentIntent(const GURL& content_url); | 221 void OnStartContentIntent(const GURL& content_url); |
220 void OnSetNeedsBeginFrame(bool enabled); | 222 void OnSetNeedsBeginFrame(bool enabled); |
221 void OnSmartClipDataExtracted(const base::string16& result); | 223 void OnSmartClipDataExtracted(const base::string16& result); |
222 | 224 |
223 void LockResources(); | |
224 void UnlockResources(); | |
225 | |
226 long GetNativeImeAdapter(); | 225 long GetNativeImeAdapter(); |
227 | 226 |
228 void WasResized(); | 227 void WasResized(); |
229 | 228 |
230 void GetScaledContentBitmap( | 229 void GetScaledContentBitmap( |
231 float scale, | 230 float scale, |
232 SkBitmap::Config bitmap_config, | 231 SkBitmap::Config bitmap_config, |
233 gfx::Rect src_subrect, | 232 gfx::Rect src_subrect, |
234 const base::Callback<void(bool, const SkBitmap&)>& result_callback); | 233 const base::Callback<void(bool, const SkBitmap&)>& result_callback); |
235 | 234 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 289 |
291 // DevTools ScreenCast support for Android WebView. | 290 // DevTools ScreenCast support for Android WebView. |
292 void SynchronousCopyContents( | 291 void SynchronousCopyContents( |
293 const gfx::Rect& src_subrect_in_pixel, | 292 const gfx::Rect& src_subrect_in_pixel, |
294 const gfx::Size& dst_size_in_pixel, | 293 const gfx::Size& dst_size_in_pixel, |
295 const base::Callback<void(bool, const SkBitmap&)>& callback, | 294 const base::Callback<void(bool, const SkBitmap&)>& callback, |
296 const SkBitmap::Config config); | 295 const SkBitmap::Config config); |
297 | 296 |
298 bool IsReadbackConfigSupported(SkBitmap::Config bitmap_config); | 297 bool IsReadbackConfigSupported(SkBitmap::Config bitmap_config); |
299 | 298 |
| 299 // If we have locks on a frame during a ContentViewCore swap or a context |
| 300 // lost, the frame is no longer valid and we can safely release all the locks. |
| 301 // Use this method to release all the locks. |
| 302 void ReleaseLocksOnSurface(); |
| 303 |
| 304 // Drop any incoming frames from the renderer when there are locks on the |
| 305 // current frame. |
| 306 void RetainFrame(uint32 output_surface_id, |
| 307 scoped_ptr<cc::CompositorFrame> frame); |
| 308 |
| 309 void InternalSwapCompositorFrame(uint32 output_surface_id, |
| 310 scoped_ptr<cc::CompositorFrame> frame); |
| 311 |
300 // The model object. | 312 // The model object. |
301 RenderWidgetHostImpl* host_; | 313 RenderWidgetHostImpl* host_; |
302 | 314 |
303 // Used to track whether this render widget needs a BeginFrame. | 315 // Used to track whether this render widget needs a BeginFrame. |
304 bool needs_begin_frame_; | 316 bool needs_begin_frame_; |
305 | 317 |
306 bool is_showing_; | 318 bool is_showing_; |
307 | 319 |
308 // ContentViewCoreImpl is our interface to the view system. | 320 // ContentViewCoreImpl is our interface to the view system. |
309 ContentViewCoreImpl* content_view_core_; | 321 ContentViewCoreImpl* content_view_core_; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 | 367 |
356 // Size to use if we have no backing ContentViewCore | 368 // Size to use if we have no backing ContentViewCore |
357 gfx::Size default_size_; | 369 gfx::Size default_size_; |
358 | 370 |
359 const bool using_synchronous_compositor_; | 371 const bool using_synchronous_compositor_; |
360 | 372 |
361 scoped_ptr<DelegatedFrameEvictor> frame_evictor_; | 373 scoped_ptr<DelegatedFrameEvictor> frame_evictor_; |
362 | 374 |
363 bool using_delegated_renderer_; | 375 bool using_delegated_renderer_; |
364 | 376 |
| 377 size_t locks_on_frame_count_; |
| 378 |
| 379 struct LastFrameInfo { |
| 380 LastFrameInfo(uint32 output_id, |
| 381 scoped_ptr<cc::CompositorFrame> output_frame); |
| 382 ~LastFrameInfo(); |
| 383 uint32 output_surface_id; |
| 384 scoped_ptr<cc::CompositorFrame> frame; |
| 385 }; |
| 386 |
| 387 scoped_ptr<LastFrameInfo> last_frame_info_; |
| 388 |
365 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); | 389 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); |
366 }; | 390 }; |
367 | 391 |
368 } // namespace content | 392 } // namespace content |
369 | 393 |
370 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ | 394 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ |
OLD | NEW |