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

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

Issue 2564403002: [android] Make RWHVAndroid a BeginFrameObserver. (Closed)
Patch Set: rebase Created 4 years 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/output/begin_frame_args.h" 22 #include "cc/output/begin_frame_args.h"
23 #include "cc/scheduler/begin_frame_source.h"
23 #include "content/browser/accessibility/browser_accessibility_manager.h" 24 #include "content/browser/accessibility/browser_accessibility_manager.h"
24 #include "content/browser/android/content_view_core_impl_observer.h" 25 #include "content/browser/android/content_view_core_impl_observer.h"
25 #include "content/browser/renderer_host/delegated_frame_evictor.h" 26 #include "content/browser/renderer_host/delegated_frame_evictor.h"
26 #include "content/browser/renderer_host/ime_adapter_android.h" 27 #include "content/browser/renderer_host/ime_adapter_android.h"
27 #include "content/browser/renderer_host/input/stylus_text_selector.h" 28 #include "content/browser/renderer_host/input/stylus_text_selector.h"
28 #include "content/browser/renderer_host/render_widget_host_view_base.h" 29 #include "content/browser/renderer_host/render_widget_host_view_base.h"
29 #include "content/browser/renderer_host/text_input_manager.h" 30 #include "content/browser/renderer_host/text_input_manager.h"
30 #include "content/common/content_export.h" 31 #include "content/common/content_export.h"
31 #include "content/public/browser/readback_types.h" 32 #include "content/public/browser/readback_types.h"
32 #include "gpu/command_buffer/common/mailbox.h" 33 #include "gpu/command_buffer/common/mailbox.h"
33 #include "third_party/skia/include/core/SkColor.h" 34 #include "third_party/skia/include/core/SkColor.h"
35 #include "ui/android/delegated_frame_host_android.h"
34 #include "ui/android/view_android.h" 36 #include "ui/android/view_android.h"
35 #include "ui/android/view_client.h" 37 #include "ui/android/view_client.h"
36 #include "ui/android/window_android_observer.h" 38 #include "ui/android/window_android_observer.h"
37 #include "ui/events/android/motion_event_android.h" 39 #include "ui/events/android/motion_event_android.h"
38 #include "ui/events/gesture_detection/filtered_gesture_provider.h" 40 #include "ui/events/gesture_detection/filtered_gesture_provider.h"
39 #include "ui/gfx/geometry/size.h" 41 #include "ui/gfx/geometry/size.h"
40 #include "ui/gfx/geometry/vector2d_f.h" 42 #include "ui/gfx/geometry/vector2d_f.h"
41 #include "ui/gfx/selection_bound.h" 43 #include "ui/gfx/selection_bound.h"
42 #include "ui/touch_selection/touch_selection_controller.h" 44 #include "ui/touch_selection/touch_selection_controller.h"
43 45
44 class GURL; 46 class GURL;
45 47
46 namespace ui { 48 namespace ui {
47 struct DidOverscrollParams; 49 struct DidOverscrollParams;
48 } 50 }
49 51
50 namespace ui {
51 class DelegatedFrameHostAndroid;
52 }
53
54 namespace content { 52 namespace content {
55 class ContentViewCoreImpl; 53 class ContentViewCoreImpl;
56 class OverscrollControllerAndroid; 54 class OverscrollControllerAndroid;
57 class RenderWidgetHost; 55 class RenderWidgetHost;
58 class RenderWidgetHostImpl; 56 class RenderWidgetHostImpl;
59 class SynchronousCompositorHost; 57 class SynchronousCompositorHost;
60 class SynchronousCompositorClient; 58 class SynchronousCompositorClient;
61 struct NativeWebKeyboardEvent; 59 struct NativeWebKeyboardEvent;
62 60
63 // ----------------------------------------------------------------------------- 61 // -----------------------------------------------------------------------------
64 // See comments in render_widget_host_view.h about this class and its members. 62 // See comments in render_widget_host_view.h about this class and its members.
65 // ----------------------------------------------------------------------------- 63 // -----------------------------------------------------------------------------
66 class CONTENT_EXPORT RenderWidgetHostViewAndroid 64 class CONTENT_EXPORT RenderWidgetHostViewAndroid
67 : public RenderWidgetHostViewBase, 65 : public RenderWidgetHostViewBase,
68 public ui::GestureProviderClient, 66 public ui::GestureProviderClient,
69 public ui::ViewClient, 67 public ui::ViewClient,
70 public ui::WindowAndroidObserver, 68 public ui::WindowAndroidObserver,
71 public DelegatedFrameEvictorClient, 69 public DelegatedFrameEvictorClient,
72 public StylusTextSelectorClient, 70 public StylusTextSelectorClient,
73 public ui::TouchSelectionControllerClient, 71 public ui::TouchSelectionControllerClient,
74 public content::ContentViewCoreImplObserver, 72 public content::ContentViewCoreImplObserver,
75 public content::TextInputManager::Observer { 73 public content::TextInputManager::Observer,
74 public ui::DelegatedFrameHostAndroid::Client,
75 public cc::BeginFrameObserver {
76 public: 76 public:
77 RenderWidgetHostViewAndroid(RenderWidgetHostImpl* widget, 77 RenderWidgetHostViewAndroid(RenderWidgetHostImpl* widget,
78 ContentViewCoreImpl* content_view_core); 78 ContentViewCoreImpl* content_view_core);
79 ~RenderWidgetHostViewAndroid() override; 79 ~RenderWidgetHostViewAndroid() override;
80 80
81 void Blur(); 81 void Blur();
82 82
83 // RenderWidgetHostView implementation. 83 // RenderWidgetHostView implementation.
84 bool OnMessageReceived(const IPC::Message& msg) override; 84 bool OnMessageReceived(const IPC::Message& msg) override;
85 void InitAsChild(gfx::NativeView parent_view) override; 85 void InitAsChild(gfx::NativeView parent_view) override;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 void OnPhysicalBackingSizeChanged(int width, int height) override; 163 void OnPhysicalBackingSizeChanged(int width, int height) override;
164 164
165 // ui::GestureProviderClient implementation. 165 // ui::GestureProviderClient implementation.
166 void OnGestureEvent(const ui::GestureEventData& gesture) override; 166 void OnGestureEvent(const ui::GestureEventData& gesture) override;
167 167
168 // ui::WindowAndroidObserver implementation. 168 // ui::WindowAndroidObserver implementation.
169 void OnCompositingDidCommit() override; 169 void OnCompositingDidCommit() override;
170 void OnRootWindowVisibilityChanged(bool visible) override; 170 void OnRootWindowVisibilityChanged(bool visible) override;
171 void OnAttachCompositor() override; 171 void OnAttachCompositor() override;
172 void OnDetachCompositor() override; 172 void OnDetachCompositor() override;
173 void OnVSync(base::TimeTicks frame_time,
174 base::TimeDelta vsync_period) override;
175 void OnAnimate(base::TimeTicks begin_frame_time) override; 173 void OnAnimate(base::TimeTicks begin_frame_time) override;
176 void OnActivityStopped() override; 174 void OnActivityStopped() override;
177 void OnActivityStarted() override; 175 void OnActivityStarted() override;
178 176
179 // content::ContentViewCoreImplObserver implementation. 177 // content::ContentViewCoreImplObserver implementation.
180 void OnContentViewCoreDestroyed() override; 178 void OnContentViewCoreDestroyed() override;
181 void OnAttachedToWindow() override; 179 void OnAttachedToWindow() override;
182 void OnDetachedFromWindow() override; 180 void OnDetachedFromWindow() override;
183 181
184 // DelegatedFrameEvictor implementation 182 // DelegatedFrameEvictor implementation
185 void EvictDelegatedFrame() override; 183 void EvictDelegatedFrame() override;
186 184
187 // StylusTextSelectorClient implementation. 185 // StylusTextSelectorClient implementation.
188 void OnStylusSelectBegin(float x0, float y0, float x1, float y1) override; 186 void OnStylusSelectBegin(float x0, float y0, float x1, float y1) override;
189 void OnStylusSelectUpdate(float x, float y) override; 187 void OnStylusSelectUpdate(float x, float y) override;
190 void OnStylusSelectEnd() override; 188 void OnStylusSelectEnd() override;
191 void OnStylusSelectTap(base::TimeTicks time, float x, float y) override; 189 void OnStylusSelectTap(base::TimeTicks time, float x, float y) override;
192 190
193 // ui::TouchSelectionControllerClient implementation. 191 // ui::TouchSelectionControllerClient implementation.
194 bool SupportsAnimation() const override; 192 bool SupportsAnimation() const override;
195 void SetNeedsAnimate() override; 193 void SetNeedsAnimate() override;
196 void MoveCaret(const gfx::PointF& position) override; 194 void MoveCaret(const gfx::PointF& position) override;
197 void MoveRangeSelectionExtent(const gfx::PointF& extent) override; 195 void MoveRangeSelectionExtent(const gfx::PointF& extent) override;
198 void SelectBetweenCoordinates(const gfx::PointF& base, 196 void SelectBetweenCoordinates(const gfx::PointF& base,
199 const gfx::PointF& extent) override; 197 const gfx::PointF& extent) override;
200 void OnSelectionEvent(ui::SelectionEventType event) override; 198 void OnSelectionEvent(ui::SelectionEventType event) override;
201 std::unique_ptr<ui::TouchHandleDrawable> CreateDrawable() override; 199 std::unique_ptr<ui::TouchHandleDrawable> CreateDrawable() override;
202 200
201 // DelegatedFrameHostAndroid::Client implementation.
202 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override;
203 void ReturnResources(const cc::ReturnedResourceArray& resources) override;
204
205 // cc::BeginFrameObserver implementation.
206 void OnBeginFrame(const cc::BeginFrameArgs& args) override;
207 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override;
208 void OnBeginFrameSourcePausedChanged(bool paused) override;
209
203 // Non-virtual methods 210 // Non-virtual methods
204 void SetContentViewCore(ContentViewCoreImpl* content_view_core); 211 void SetContentViewCore(ContentViewCoreImpl* content_view_core);
205 SkColor GetCachedBackgroundColor() const; 212 SkColor GetCachedBackgroundColor() const;
206 void SendKeyEvent(const NativeWebKeyboardEvent& event); 213 void SendKeyEvent(const NativeWebKeyboardEvent& event);
207 void SendMouseEvent(const ui::MotionEventAndroid&, int changed_button); 214 void SendMouseEvent(const ui::MotionEventAndroid&, int changed_button);
208 void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event); 215 void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event);
209 void SendGestureEvent(const blink::WebGestureEvent& event); 216 void SendGestureEvent(const blink::WebGestureEvent& event);
210 217
211 void OnStartContentIntent(const GURL& content_url, bool is_main_frame); 218 void OnStartContentIntent(const GURL& content_url, bool is_main_frame);
212 void OnSmartClipDataExtracted(const base::string16& text, 219 void OnSmartClipDataExtracted(const base::string16& text,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 // Drop any incoming frames from the renderer when there are locks on the 291 // Drop any incoming frames from the renderer when there are locks on the
285 // current frame. 292 // current frame.
286 void RetainFrame(uint32_t compositor_frame_sink_id, 293 void RetainFrame(uint32_t compositor_frame_sink_id,
287 cc::CompositorFrame frame); 294 cc::CompositorFrame frame);
288 295
289 void InternalSwapCompositorFrame(uint32_t compositor_frame_sink_id, 296 void InternalSwapCompositorFrame(uint32_t compositor_frame_sink_id,
290 cc::CompositorFrame frame); 297 cc::CompositorFrame frame);
291 void DestroyDelegatedContent(); 298 void DestroyDelegatedContent();
292 void OnLostResources(); 299 void OnLostResources();
293 300
294 void ReturnResources(const cc::ReturnedResourceArray& resources); 301 enum BeginFrameRequestType {
295
296 enum VSyncRequestType {
297 FLUSH_INPUT = 1 << 0, 302 FLUSH_INPUT = 1 << 0,
298 BEGIN_FRAME = 1 << 1, 303 BEGIN_FRAME = 1 << 1,
299 PERSISTENT_BEGIN_FRAME = 1 << 2 304 PERSISTENT_BEGIN_FRAME = 1 << 2
300 }; 305 };
301 void RequestVSyncUpdate(uint32_t requests); 306 void AddBeginFrameRequest(BeginFrameRequestType request);
307 void ClearBeginFrameRequest(BeginFrameRequestType request);
302 void StartObservingRootWindow(); 308 void StartObservingRootWindow();
303 void StopObservingRootWindow(); 309 void StopObservingRootWindow();
304 void SendBeginFrame(base::TimeTicks frame_time, base::TimeDelta vsync_period); 310 void SendBeginFrame(cc::BeginFrameArgs args);
305 bool Animate(base::TimeTicks frame_time); 311 bool Animate(base::TimeTicks frame_time);
306 void RequestDisallowInterceptTouchEvent(); 312 void RequestDisallowInterceptTouchEvent();
307 313
308 bool SyncCompositorOnMessageReceived(const IPC::Message& message); 314 bool SyncCompositorOnMessageReceived(const IPC::Message& message);
309 315
310 void ComputeEventLatencyOSTouchHistograms(const ui::MotionEvent& event); 316 void ComputeEventLatencyOSTouchHistograms(const ui::MotionEvent& event);
311 317
312 void CreateOverscrollControllerIfPossible(); 318 void CreateOverscrollControllerIfPossible();
313 319
314 // The model object. 320 // The model object.
315 RenderWidgetHostImpl* host_; 321 RenderWidgetHostImpl* host_;
316 322
317 // Used to control action dispatch at the next |OnVSync()| call. 323 // The begin frame source being observed. Null if none.
318 uint32_t outstanding_vsync_requests_; 324 cc::BeginFrameSource* begin_frame_source_;
325 cc::BeginFrameArgs last_begin_frame_args_;
326
327 // Indicates whether and for what reason a request for begin frames has been
328 // issued. Used to control action dispatch at the next |OnBeginFrame()| call.
329 uint32_t outstanding_begin_frame_requests_;
319 330
320 bool is_showing_; 331 bool is_showing_;
321 332
322 // Window-specific bits that affect widget visibility. 333 // Window-specific bits that affect widget visibility.
323 bool is_window_visible_; 334 bool is_window_visible_;
324 bool is_window_activity_started_; 335 bool is_window_activity_started_;
325 336
326 // Used to control the appearance of overscroll glow. 337 // Used to control the appearance of overscroll glow.
327 bool is_showing_overscroll_glow_; 338 bool is_showing_overscroll_glow_;
328 339
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 gfx::Vector2dF last_scroll_offset_; 401 gfx::Vector2dF last_scroll_offset_;
391 402
392 base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_; 403 base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_;
393 404
394 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); 405 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid);
395 }; 406 };
396 407
397 } // namespace content 408 } // namespace content
398 409
399 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ 410 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698