Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(366)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.h

Issue 2133873004: content: Move Surfaces related code out of RWHVA. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: .. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 14 matching lines...) Expand all
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
57 namespace content { 54 namespace content {
58 class ContentViewCoreImpl; 55 class ContentViewCoreImpl;
59 class ContentViewCoreObserver; 56 class ContentViewCoreObserver;
57 class DelegatedFrameHostAndroid;
60 class OverscrollControllerAndroid; 58 class OverscrollControllerAndroid;
61 class RenderWidgetHost; 59 class RenderWidgetHost;
62 class RenderWidgetHostImpl; 60 class RenderWidgetHostImpl;
63 class SynchronousCompositorHost; 61 class SynchronousCompositorHost;
64 struct DidOverscrollParams; 62 struct DidOverscrollParams;
65 struct NativeWebKeyboardEvent; 63 struct NativeWebKeyboardEvent;
66 struct TextInputState; 64 struct TextInputState;
67 65
68 // ----------------------------------------------------------------------------- 66 // -----------------------------------------------------------------------------
69 // See comments in render_widget_host_view.h about this class and its members. 67 // See comments in render_widget_host_view.h about this class and its members.
70 // ----------------------------------------------------------------------------- 68 // -----------------------------------------------------------------------------
71 class CONTENT_EXPORT RenderWidgetHostViewAndroid 69 class CONTENT_EXPORT RenderWidgetHostViewAndroid
72 : public RenderWidgetHostViewBase, 70 : public RenderWidgetHostViewBase,
73 public cc::SurfaceFactoryClient,
74 public ui::GestureProviderClient, 71 public ui::GestureProviderClient,
75 public ui::WindowAndroidObserver, 72 public ui::WindowAndroidObserver,
76 public DelegatedFrameEvictorClient, 73 public DelegatedFrameEvictorClient,
77 public StylusTextSelectorClient, 74 public StylusTextSelectorClient,
78 public ui::TouchSelectionControllerClient, 75 public ui::TouchSelectionControllerClient,
79 public content::ContentViewCoreImplObserver { 76 public content::ContentViewCoreImplObserver {
80 public: 77 public:
81 RenderWidgetHostViewAndroid(RenderWidgetHostImpl* widget, 78 RenderWidgetHostViewAndroid(RenderWidgetHostImpl* widget,
82 ContentViewCoreImpl* content_view_core); 79 ContentViewCoreImpl* content_view_core);
83 ~RenderWidgetHostViewAndroid() override; 80 ~RenderWidgetHostViewAndroid() override;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 void DidStopFlinging() override; 153 void DidStopFlinging() override;
157 uint32_t GetSurfaceClientId() override; 154 uint32_t GetSurfaceClientId() override;
158 void ShowDisambiguationPopup(const gfx::Rect& rect_pixels, 155 void ShowDisambiguationPopup(const gfx::Rect& rect_pixels,
159 const SkBitmap& zoomed_bitmap) override; 156 const SkBitmap& zoomed_bitmap) override;
160 std::unique_ptr<SyntheticGestureTarget> CreateSyntheticGestureTarget() 157 std::unique_ptr<SyntheticGestureTarget> CreateSyntheticGestureTarget()
161 override; 158 override;
162 void LockCompositingSurface() override; 159 void LockCompositingSurface() override;
163 void UnlockCompositingSurface() override; 160 void UnlockCompositingSurface() override;
164 void OnDidNavigateMainFrameToNewPage() override; 161 void OnDidNavigateMainFrameToNewPage() override;
165 162
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. 163 // ui::GestureProviderClient implementation.
171 void OnGestureEvent(const ui::GestureEventData& gesture) override; 164 void OnGestureEvent(const ui::GestureEventData& gesture) override;
172 165
173 // ui::WindowAndroidObserver implementation. 166 // ui::WindowAndroidObserver implementation.
174 void OnCompositingDidCommit() override; 167 void OnCompositingDidCommit() override;
175 void OnRootWindowVisibilityChanged(bool visible) override; 168 void OnRootWindowVisibilityChanged(bool visible) override;
176 void OnAttachCompositor() override; 169 void OnAttachCompositor() override;
177 void OnDetachCompositor() override; 170 void OnDetachCompositor() override;
178 void OnVSync(base::TimeTicks frame_time, 171 void OnVSync(base::TimeTicks frame_time,
179 base::TimeDelta vsync_period) override; 172 base::TimeDelta vsync_period) override;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 246
254 void DestroyDelegatedContent(); 247 void DestroyDelegatedContent();
255 void CheckOutputSurfaceChanged(uint32_t output_surface_id); 248 void CheckOutputSurfaceChanged(uint32_t output_surface_id);
256 void SubmitCompositorFrame(cc::CompositorFrame frame_data); 249 void SubmitCompositorFrame(cc::CompositorFrame frame_data);
257 void SendReclaimCompositorResources(uint32_t output_surface_id, 250 void SendReclaimCompositorResources(uint32_t output_surface_id,
258 bool is_swap_ack); 251 bool is_swap_ack);
259 252
260 void OnFrameMetadataUpdated( 253 void OnFrameMetadataUpdated(
261 const cc::CompositorFrameMetadata& frame_metadata); 254 const cc::CompositorFrameMetadata& frame_metadata);
262 255
256 gfx::Size GetViewSize() const;
257
263 void ShowInternal(); 258 void ShowInternal();
264 void HideInternal(); 259 void HideInternal();
265 void AttachLayers(); 260 void AttachLayers();
266 void RemoveLayers(); 261 void RemoveLayers();
267 262
268 void UpdateBackgroundColor(SkColor color); 263 void UpdateBackgroundColor(SkColor color);
269 264
270 // Called after async screenshot task completes. Scales and crops the result 265 // Called after async screenshot task completes. Scales and crops the result
271 // of the copy. 266 // of the copy.
272 static void PrepareTextureCopyOutputResult( 267 static void PrepareTextureCopyOutputResult(
(...skipping 16 matching lines...) Expand all
289 void ReleaseLocksOnSurface(); 284 void ReleaseLocksOnSurface();
290 285
291 // Drop any incoming frames from the renderer when there are locks on the 286 // Drop any incoming frames from the renderer when there are locks on the
292 // current frame. 287 // current frame.
293 void RetainFrame(uint32_t output_surface_id, cc::CompositorFrame frame); 288 void RetainFrame(uint32_t output_surface_id, cc::CompositorFrame frame);
294 289
295 void InternalSwapCompositorFrame(uint32_t output_surface_id, 290 void InternalSwapCompositorFrame(uint32_t output_surface_id,
296 cc::CompositorFrame frame); 291 cc::CompositorFrame frame);
297 void OnLostResources(); 292 void OnLostResources();
298 293
294 void ReturnResources(const cc::ReturnedResourceArray& resources);
295
299 enum VSyncRequestType { 296 enum VSyncRequestType {
300 FLUSH_INPUT = 1 << 0, 297 FLUSH_INPUT = 1 << 0,
301 BEGIN_FRAME = 1 << 1, 298 BEGIN_FRAME = 1 << 1,
302 PERSISTENT_BEGIN_FRAME = 1 << 2 299 PERSISTENT_BEGIN_FRAME = 1 << 2
303 }; 300 };
304 void RequestVSyncUpdate(uint32_t requests); 301 void RequestVSyncUpdate(uint32_t requests);
305 void StartObservingRootWindow(); 302 void StartObservingRootWindow();
306 void StopObservingRootWindow(); 303 void StopObservingRootWindow();
307 void SendBeginFrame(base::TimeTicks frame_time, base::TimeDelta vsync_period); 304 void SendBeginFrame(base::TimeTicks frame_time, base::TimeDelta vsync_period);
308 bool Animate(base::TimeTicks frame_time); 305 bool Animate(base::TimeTicks frame_time);
(...skipping 18 matching lines...) Expand all
327 // ContentViewCoreImpl is our interface to the view system. 324 // ContentViewCoreImpl is our interface to the view system.
328 ContentViewCoreImpl* content_view_core_; 325 ContentViewCoreImpl* content_view_core_;
329 326
330 ImeAdapterAndroid ime_adapter_android_; 327 ImeAdapterAndroid ime_adapter_android_;
331 328
332 // Body background color of the underlying document. 329 // Body background color of the underlying document.
333 SkColor cached_background_color_; 330 SkColor cached_background_color_;
334 331
335 mutable ui::ViewAndroid view_; 332 mutable ui::ViewAndroid view_;
336 333
337 std::unique_ptr<cc::SurfaceIdAllocator> id_allocator_; 334 // Manages the Compositor Frames received from the renderer.
338 std::unique_ptr<cc::SurfaceFactory> surface_factory_; 335 std::unique_ptr<DelegatedFrameHostAndroid> delegated_frame_host_;
339 cc::SurfaceId surface_id_; 336
340 gfx::Size current_surface_size_;
341 cc::ReturnedResourceArray surface_returned_resources_; 337 cc::ReturnedResourceArray surface_returned_resources_;
342 gfx::Vector2dF location_bar_content_translation_;
343 cc::Selection<gfx::SelectionBound> current_viewport_selection_;
344 338
345 // The most recent texture size that was pushed to the texture layer. 339 // The most recent texture size that was pushed to the texture layer.
346 gfx::Size texture_size_in_layer_; 340 gfx::Size texture_size_in_layer_;
347 341
348 // The output surface id of the last received frame. 342 // The output surface id of the last received frame.
349 uint32_t last_output_surface_id_; 343 uint32_t last_output_surface_id_;
350 344
351 345
352 std::queue<base::Closure> ack_callbacks_; 346 std::queue<base::Closure> ack_callbacks_;
353 347
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 gfx::Vector2dF last_scroll_offset_; 383 gfx::Vector2dF last_scroll_offset_;
390 384
391 base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_; 385 base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_;
392 386
393 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); 387 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid);
394 }; 388 };
395 389
396 } // namespace content 390 } // namespace content
397 391
398 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ 392 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698