| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <queue> | 13 #include <queue> |
| 14 | 14 |
| 15 #include "base/callback.h" | 15 #include "base/callback.h" |
| 16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 17 #include "base/i18n/rtl.h" | 17 #include "base/i18n/rtl.h" |
| 18 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 20 #include "base/process/process.h" | 20 #include "base/process/process.h" |
| 21 #include "cc/input/selection.h" | 21 #include "cc/input/selection.h" |
| 22 #include "cc/layers/surface_layer.h" | |
| 23 #include "cc/output/begin_frame_args.h" | 22 #include "cc/output/begin_frame_args.h" |
| 24 #include "cc/surfaces/surface_factory_client.h" | |
| 25 #include "cc/surfaces/surface_id.h" | |
| 26 #include "content/browser/accessibility/browser_accessibility_manager.h" | 23 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 27 #include "content/browser/android/content_view_core_impl_observer.h" | 24 #include "content/browser/android/content_view_core_impl_observer.h" |
| 28 #include "content/browser/renderer_host/delegated_frame_evictor.h" | 25 #include "content/browser/renderer_host/delegated_frame_evictor.h" |
| 29 #include "content/browser/renderer_host/ime_adapter_android.h" | 26 #include "content/browser/renderer_host/ime_adapter_android.h" |
| 30 #include "content/browser/renderer_host/input/stylus_text_selector.h" | 27 #include "content/browser/renderer_host/input/stylus_text_selector.h" |
| 31 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 28 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 32 #include "content/common/content_export.h" | 29 #include "content/common/content_export.h" |
| 33 #include "content/public/browser/readback_types.h" | 30 #include "content/public/browser/readback_types.h" |
| 34 #include "gpu/command_buffer/common/mailbox.h" | 31 #include "gpu/command_buffer/common/mailbox.h" |
| 35 #include "third_party/skia/include/core/SkColor.h" | 32 #include "third_party/skia/include/core/SkColor.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 47 class SurfaceFactory; | 44 class SurfaceFactory; |
| 48 class SurfaceIdAllocator; | 45 class SurfaceIdAllocator; |
| 49 } | 46 } |
| 50 | 47 |
| 51 namespace blink { | 48 namespace blink { |
| 52 class WebExternalTextureLayer; | 49 class WebExternalTextureLayer; |
| 53 class WebTouchEvent; | 50 class WebTouchEvent; |
| 54 class WebMouseEvent; | 51 class WebMouseEvent; |
| 55 } | 52 } |
| 56 | 53 |
| 54 namespace ui { |
| 55 class DelegatedFrameHostAndroid; |
| 56 } |
| 57 |
| 57 namespace content { | 58 namespace content { |
| 58 class ContentViewCoreImpl; | 59 class ContentViewCoreImpl; |
| 59 class ContentViewCoreObserver; | 60 class ContentViewCoreObserver; |
| 60 class OverscrollControllerAndroid; | 61 class OverscrollControllerAndroid; |
| 61 class RenderWidgetHost; | 62 class RenderWidgetHost; |
| 62 class RenderWidgetHostImpl; | 63 class RenderWidgetHostImpl; |
| 63 class SynchronousCompositorHost; | 64 class SynchronousCompositorHost; |
| 64 struct DidOverscrollParams; | 65 struct DidOverscrollParams; |
| 65 struct NativeWebKeyboardEvent; | 66 struct NativeWebKeyboardEvent; |
| 66 struct TextInputState; | 67 struct TextInputState; |
| 67 | 68 |
| 68 // ----------------------------------------------------------------------------- | 69 // ----------------------------------------------------------------------------- |
| 69 // See comments in render_widget_host_view.h about this class and its members. | 70 // See comments in render_widget_host_view.h about this class and its members. |
| 70 // ----------------------------------------------------------------------------- | 71 // ----------------------------------------------------------------------------- |
| 71 class CONTENT_EXPORT RenderWidgetHostViewAndroid | 72 class CONTENT_EXPORT RenderWidgetHostViewAndroid |
| 72 : public RenderWidgetHostViewBase, | 73 : public RenderWidgetHostViewBase, |
| 73 public cc::SurfaceFactoryClient, | |
| 74 public ui::GestureProviderClient, | 74 public ui::GestureProviderClient, |
| 75 public ui::WindowAndroidObserver, | 75 public ui::WindowAndroidObserver, |
| 76 public DelegatedFrameEvictorClient, | 76 public DelegatedFrameEvictorClient, |
| 77 public StylusTextSelectorClient, | 77 public StylusTextSelectorClient, |
| 78 public ui::TouchSelectionControllerClient, | 78 public ui::TouchSelectionControllerClient, |
| 79 public content::ContentViewCoreImplObserver { | 79 public content::ContentViewCoreImplObserver { |
| 80 public: | 80 public: |
| 81 RenderWidgetHostViewAndroid(RenderWidgetHostImpl* widget, | 81 RenderWidgetHostViewAndroid(RenderWidgetHostImpl* widget, |
| 82 ContentViewCoreImpl* content_view_core); | 82 ContentViewCoreImpl* content_view_core); |
| 83 ~RenderWidgetHostViewAndroid() override; | 83 ~RenderWidgetHostViewAndroid() override; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 void DidStopFlinging() override; | 156 void DidStopFlinging() override; |
| 157 uint32_t GetSurfaceClientId() override; | 157 uint32_t GetSurfaceClientId() override; |
| 158 void ShowDisambiguationPopup(const gfx::Rect& rect_pixels, | 158 void ShowDisambiguationPopup(const gfx::Rect& rect_pixels, |
| 159 const SkBitmap& zoomed_bitmap) override; | 159 const SkBitmap& zoomed_bitmap) override; |
| 160 std::unique_ptr<SyntheticGestureTarget> CreateSyntheticGestureTarget() | 160 std::unique_ptr<SyntheticGestureTarget> CreateSyntheticGestureTarget() |
| 161 override; | 161 override; |
| 162 void LockCompositingSurface() override; | 162 void LockCompositingSurface() override; |
| 163 void UnlockCompositingSurface() override; | 163 void UnlockCompositingSurface() override; |
| 164 void OnDidNavigateMainFrameToNewPage() override; | 164 void OnDidNavigateMainFrameToNewPage() override; |
| 165 | 165 |
| 166 // cc::SurfaceFactoryClient implementation. | |
| 167 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | |
| 168 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; | |
| 169 | |
| 170 // ui::GestureProviderClient implementation. | 166 // ui::GestureProviderClient implementation. |
| 171 void OnGestureEvent(const ui::GestureEventData& gesture) override; | 167 void OnGestureEvent(const ui::GestureEventData& gesture) override; |
| 172 | 168 |
| 173 // ui::WindowAndroidObserver implementation. | 169 // ui::WindowAndroidObserver implementation. |
| 174 void OnCompositingDidCommit() override; | 170 void OnCompositingDidCommit() override; |
| 175 void OnRootWindowVisibilityChanged(bool visible) override; | 171 void OnRootWindowVisibilityChanged(bool visible) override; |
| 176 void OnAttachCompositor() override; | 172 void OnAttachCompositor() override; |
| 177 void OnDetachCompositor() override; | 173 void OnDetachCompositor() override; |
| 178 void OnVSync(base::TimeTicks frame_time, | 174 void OnVSync(base::TimeTicks frame_time, |
| 179 base::TimeDelta vsync_period) override; | 175 base::TimeDelta vsync_period) override; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 | 249 |
| 254 void DestroyDelegatedContent(); | 250 void DestroyDelegatedContent(); |
| 255 void CheckOutputSurfaceChanged(uint32_t output_surface_id); | 251 void CheckOutputSurfaceChanged(uint32_t output_surface_id); |
| 256 void SubmitCompositorFrame(cc::CompositorFrame frame_data); | 252 void SubmitCompositorFrame(cc::CompositorFrame frame_data); |
| 257 void SendReclaimCompositorResources(uint32_t output_surface_id, | 253 void SendReclaimCompositorResources(uint32_t output_surface_id, |
| 258 bool is_swap_ack); | 254 bool is_swap_ack); |
| 259 | 255 |
| 260 void OnFrameMetadataUpdated( | 256 void OnFrameMetadataUpdated( |
| 261 const cc::CompositorFrameMetadata& frame_metadata); | 257 const cc::CompositorFrameMetadata& frame_metadata); |
| 262 | 258 |
| 259 gfx::Size GetViewSize() const; |
| 260 |
| 263 void ShowInternal(); | 261 void ShowInternal(); |
| 264 void HideInternal(); | 262 void HideInternal(); |
| 265 void AttachLayers(); | 263 void AttachLayers(); |
| 266 void RemoveLayers(); | 264 void RemoveLayers(); |
| 267 | 265 |
| 268 void UpdateBackgroundColor(SkColor color); | 266 void UpdateBackgroundColor(SkColor color); |
| 269 | 267 |
| 270 // Called after async screenshot task completes. Scales and crops the result | 268 // Called after async screenshot task completes. Scales and crops the result |
| 271 // of the copy. | 269 // of the copy. |
| 272 static void PrepareTextureCopyOutputResult( | 270 static void PrepareTextureCopyOutputResult( |
| (...skipping 16 matching lines...) Expand all Loading... |
| 289 void ReleaseLocksOnSurface(); | 287 void ReleaseLocksOnSurface(); |
| 290 | 288 |
| 291 // Drop any incoming frames from the renderer when there are locks on the | 289 // Drop any incoming frames from the renderer when there are locks on the |
| 292 // current frame. | 290 // current frame. |
| 293 void RetainFrame(uint32_t output_surface_id, cc::CompositorFrame frame); | 291 void RetainFrame(uint32_t output_surface_id, cc::CompositorFrame frame); |
| 294 | 292 |
| 295 void InternalSwapCompositorFrame(uint32_t output_surface_id, | 293 void InternalSwapCompositorFrame(uint32_t output_surface_id, |
| 296 cc::CompositorFrame frame); | 294 cc::CompositorFrame frame); |
| 297 void OnLostResources(); | 295 void OnLostResources(); |
| 298 | 296 |
| 297 void ReturnResources(const cc::ReturnedResourceArray& resources); |
| 298 |
| 299 enum VSyncRequestType { | 299 enum VSyncRequestType { |
| 300 FLUSH_INPUT = 1 << 0, | 300 FLUSH_INPUT = 1 << 0, |
| 301 BEGIN_FRAME = 1 << 1, | 301 BEGIN_FRAME = 1 << 1, |
| 302 PERSISTENT_BEGIN_FRAME = 1 << 2 | 302 PERSISTENT_BEGIN_FRAME = 1 << 2 |
| 303 }; | 303 }; |
| 304 void RequestVSyncUpdate(uint32_t requests); | 304 void RequestVSyncUpdate(uint32_t requests); |
| 305 void StartObservingRootWindow(); | 305 void StartObservingRootWindow(); |
| 306 void StopObservingRootWindow(); | 306 void StopObservingRootWindow(); |
| 307 void SendBeginFrame(base::TimeTicks frame_time, base::TimeDelta vsync_period); | 307 void SendBeginFrame(base::TimeTicks frame_time, base::TimeDelta vsync_period); |
| 308 bool Animate(base::TimeTicks frame_time); | 308 bool Animate(base::TimeTicks frame_time); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 327 // ContentViewCoreImpl is our interface to the view system. | 327 // ContentViewCoreImpl is our interface to the view system. |
| 328 ContentViewCoreImpl* content_view_core_; | 328 ContentViewCoreImpl* content_view_core_; |
| 329 | 329 |
| 330 ImeAdapterAndroid ime_adapter_android_; | 330 ImeAdapterAndroid ime_adapter_android_; |
| 331 | 331 |
| 332 // Body background color of the underlying document. | 332 // Body background color of the underlying document. |
| 333 SkColor cached_background_color_; | 333 SkColor cached_background_color_; |
| 334 | 334 |
| 335 mutable ui::ViewAndroid view_; | 335 mutable ui::ViewAndroid view_; |
| 336 | 336 |
| 337 std::unique_ptr<cc::SurfaceIdAllocator> id_allocator_; | 337 // Manages the Compositor Frames received from the renderer. |
| 338 std::unique_ptr<cc::SurfaceFactory> surface_factory_; | 338 std::unique_ptr<ui::DelegatedFrameHostAndroid> delegated_frame_host_; |
| 339 cc::SurfaceId surface_id_; | 339 |
| 340 gfx::Size current_surface_size_; | |
| 341 cc::ReturnedResourceArray surface_returned_resources_; | 340 cc::ReturnedResourceArray surface_returned_resources_; |
| 342 gfx::Vector2dF location_bar_content_translation_; | |
| 343 cc::Selection<gfx::SelectionBound> current_viewport_selection_; | |
| 344 | 341 |
| 345 // The most recent texture size that was pushed to the texture layer. | 342 // The most recent texture size that was pushed to the texture layer. |
| 346 gfx::Size texture_size_in_layer_; | 343 gfx::Size texture_size_in_layer_; |
| 347 | 344 |
| 348 // The output surface id of the last received frame. | 345 // The output surface id of the last received frame. |
| 349 uint32_t last_output_surface_id_; | 346 uint32_t last_output_surface_id_; |
| 350 | 347 |
| 351 | 348 |
| 352 std::queue<base::Closure> ack_callbacks_; | 349 std::queue<base::Closure> ack_callbacks_; |
| 353 | 350 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 gfx::Vector2dF last_scroll_offset_; | 386 gfx::Vector2dF last_scroll_offset_; |
| 390 | 387 |
| 391 base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_; | 388 base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_; |
| 392 | 389 |
| 393 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); | 390 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); |
| 394 }; | 391 }; |
| 395 | 392 |
| 396 } // namespace content | 393 } // namespace content |
| 397 | 394 |
| 398 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ | 395 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ |
| OLD | NEW |