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

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

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

Powered by Google App Engine
This is Rietveld 408576698