Chromium Code Reviews| 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_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 | 109 |
| 110 // Use RenderWidgetHostImpl::From(rwh) to downcast a | 110 // Use RenderWidgetHostImpl::From(rwh) to downcast a |
| 111 // RenderWidgetHost to a RenderWidgetHostImpl. Internally, this | 111 // RenderWidgetHost to a RenderWidgetHostImpl. Internally, this |
| 112 // uses RenderWidgetHost::AsRenderWidgetHostImpl(). | 112 // uses RenderWidgetHost::AsRenderWidgetHostImpl(). |
| 113 static RenderWidgetHostImpl* From(RenderWidgetHost* rwh); | 113 static RenderWidgetHostImpl* From(RenderWidgetHost* rwh); |
| 114 | 114 |
| 115 void set_hung_renderer_delay(const base::TimeDelta& delay) { | 115 void set_hung_renderer_delay(const base::TimeDelta& delay) { |
| 116 hung_renderer_delay_ = delay; | 116 hung_renderer_delay_ = delay; |
| 117 } | 117 } |
| 118 | 118 |
| 119 void set_new_content_rendering_delay(const base::TimeDelta& delay) { | |
|
Charlie Reis
2015/09/14 20:54:55
nit: "_for_testing"? Or is it expected to be used
kenrb
2015/09/14 21:29:36
Done.
| |
| 120 new_content_rendering_delay_ = delay; | |
| 121 } | |
| 122 | |
| 119 // RenderWidgetHost implementation. | 123 // RenderWidgetHost implementation. |
| 120 void UpdateTextDirection(blink::WebTextDirection direction) override; | 124 void UpdateTextDirection(blink::WebTextDirection direction) override; |
| 121 void NotifyTextDirection() override; | 125 void NotifyTextDirection() override; |
| 122 void Focus() override; | 126 void Focus() override; |
| 123 void Blur() override; | 127 void Blur() override; |
| 124 void SetActive(bool active) override; | 128 void SetActive(bool active) override; |
| 125 void CopyFromBackingStore(const gfx::Rect& src_rect, | 129 void CopyFromBackingStore(const gfx::Rect& src_rect, |
| 126 const gfx::Size& accelerated_dst_size, | 130 const gfx::Size& accelerated_dst_size, |
| 127 ReadbackRequestCallback& callback, | 131 ReadbackRequestCallback& callback, |
| 128 const SkColorType preferred_color_type) override; | 132 const SkColorType preferred_color_type) override; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 | 255 |
| 252 // Starts a hang monitor timeout. If there's already a hang monitor timeout | 256 // Starts a hang monitor timeout. If there's already a hang monitor timeout |
| 253 // the new one will only fire if it has a shorter delay than the time | 257 // the new one will only fire if it has a shorter delay than the time |
| 254 // left on the existing timeouts. | 258 // left on the existing timeouts. |
| 255 void StartHangMonitorTimeout(base::TimeDelta delay); | 259 void StartHangMonitorTimeout(base::TimeDelta delay); |
| 256 | 260 |
| 257 // Stops all existing hang monitor timeouts and assumes the renderer is | 261 // Stops all existing hang monitor timeouts and assumes the renderer is |
| 258 // responsive. | 262 // responsive. |
| 259 void StopHangMonitorTimeout(); | 263 void StopHangMonitorTimeout(); |
| 260 | 264 |
| 265 // Starts the rendering timeout, which will clear displayed graphics if | |
| 266 // a new compositor frame is not received before it expires. | |
| 267 void StartNewContentRenderingTimeout(); | |
| 268 | |
| 269 // Stops the rendering timeout and prevents it from clearing any displayed | |
| 270 // graphics. | |
| 271 void StopNewContentRenderingTimeout(); | |
| 272 | |
| 261 // Forwards the given message to the renderer. These are called by the view | 273 // Forwards the given message to the renderer. These are called by the view |
| 262 // when it has received a message. | 274 // when it has received a message. |
| 263 void ForwardGestureEventWithLatencyInfo( | 275 void ForwardGestureEventWithLatencyInfo( |
| 264 const blink::WebGestureEvent& gesture_event, | 276 const blink::WebGestureEvent& gesture_event, |
| 265 const ui::LatencyInfo& ui_latency); | 277 const ui::LatencyInfo& ui_latency); |
| 266 void ForwardTouchEventWithLatencyInfo( | 278 void ForwardTouchEventWithLatencyInfo( |
| 267 const blink::WebTouchEvent& touch_event, | 279 const blink::WebTouchEvent& touch_event, |
| 268 const ui::LatencyInfo& ui_latency); | 280 const ui::LatencyInfo& ui_latency); |
| 269 void ForwardMouseEventWithLatencyInfo( | 281 void ForwardMouseEventWithLatencyInfo( |
| 270 const blink::WebMouseEvent& mouse_event, | 282 const blink::WebMouseEvent& mouse_event, |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 485 // Notification that the user has made some kind of input that could | 497 // Notification that the user has made some kind of input that could |
| 486 // perform an action. The gestures that count are 1) any mouse down | 498 // perform an action. The gestures that count are 1) any mouse down |
| 487 // event and 2) enter or space key presses. | 499 // event and 2) enter or space key presses. |
| 488 virtual void OnUserGesture() {} | 500 virtual void OnUserGesture() {} |
| 489 | 501 |
| 490 // Callbacks for notification when the renderer becomes unresponsive to user | 502 // Callbacks for notification when the renderer becomes unresponsive to user |
| 491 // input events, and subsequently responsive again. | 503 // input events, and subsequently responsive again. |
| 492 virtual void NotifyRendererUnresponsive() {} | 504 virtual void NotifyRendererUnresponsive() {} |
| 493 virtual void NotifyRendererResponsive() {} | 505 virtual void NotifyRendererResponsive() {} |
| 494 | 506 |
| 507 // Callback for notification that we failed to receive any rendered graphics | |
| 508 // from a newly loaded page. Used for testing. | |
| 509 virtual void NotifyNewContentRenderingTimeout() {} | |
|
Charlie Reis
2015/09/14 20:54:55
nit: End name with "ForTesting" so that other code
kenrb
2015/09/14 21:29:36
Done.
| |
| 510 | |
| 495 // Called when auto-resize resulted in the renderer size changing. | 511 // Called when auto-resize resulted in the renderer size changing. |
| 496 virtual void OnRenderAutoResized(const gfx::Size& new_size) {} | 512 virtual void OnRenderAutoResized(const gfx::Size& new_size) {} |
| 497 | 513 |
| 498 // --------------------------------------------------------------------------- | 514 // --------------------------------------------------------------------------- |
| 499 | 515 |
| 500 // RenderViewHost overrides this method to impose further restrictions on when | 516 // RenderViewHost overrides this method to impose further restrictions on when |
| 501 // to allow mouse lock. | 517 // to allow mouse lock. |
| 502 // Once the request is approved or rejected, GotResponseToLockMouseRequest() | 518 // Once the request is approved or rejected, GotResponseToLockMouseRequest() |
| 503 // will be called. | 519 // will be called. |
| 504 virtual void RequestToLockMouse(bool user_gesture, | 520 virtual void RequestToLockMouse(bool user_gesture, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 545 | 561 |
| 546 // A weak pointer to the view. The above pointer should be weak, but changing | 562 // A weak pointer to the view. The above pointer should be weak, but changing |
| 547 // that to be weak causes crashes on Android. | 563 // that to be weak causes crashes on Android. |
| 548 // TODO(ccameron): Fix this. | 564 // TODO(ccameron): Fix this. |
| 549 // http://crbug.com/404828 | 565 // http://crbug.com/404828 |
| 550 base::WeakPtr<RenderWidgetHostViewBase> view_weak_; | 566 base::WeakPtr<RenderWidgetHostViewBase> view_weak_; |
| 551 | 567 |
| 552 // This value indicates how long to wait before we consider a renderer hung. | 568 // This value indicates how long to wait before we consider a renderer hung. |
| 553 base::TimeDelta hung_renderer_delay_; | 569 base::TimeDelta hung_renderer_delay_; |
| 554 | 570 |
| 571 // This value indicates how long to wait for a new compositor frame from a | |
| 572 // renderer process before clearing any previously displayed content. | |
| 573 base::TimeDelta new_content_rendering_delay_; | |
| 574 | |
| 555 private: | 575 private: |
| 556 friend class MockRenderWidgetHost; | 576 friend class MockRenderWidgetHost; |
| 557 | 577 |
| 558 // Tell this object to destroy itself. | 578 // Tell this object to destroy itself. |
| 559 void Destroy(); | 579 void Destroy(); |
| 560 | 580 |
| 561 // Called by |hang_monitor_timeout_| on delayed response from the renderer. | 581 // Called by |hang_monitor_timeout_| on delayed response from the renderer. |
| 562 void RendererIsUnresponsive(); | 582 void RendererIsUnresponsive(); |
| 563 | 583 |
| 584 // Called by |new_content_rendering_timeout_| if a renderer has loaded new | |
| 585 // content but failed to produce a compositor frame in a defined time. | |
| 586 void ClearDisplayedGraphics(); | |
| 587 | |
| 564 // Called if we know the renderer is responsive. When we currently think the | 588 // Called if we know the renderer is responsive. When we currently think the |
| 565 // renderer is unresponsive, this will clear that state and call | 589 // renderer is unresponsive, this will clear that state and call |
| 566 // NotifyRendererResponsive. | 590 // NotifyRendererResponsive. |
| 567 void RendererIsResponsive(); | 591 void RendererIsResponsive(); |
| 568 | 592 |
| 569 // Routines used to send the RenderWidget its screen color profile. | 593 // Routines used to send the RenderWidget its screen color profile. |
| 570 void DispatchColorProfile(); | 594 void DispatchColorProfile(); |
| 571 void SendColorProfile(); | 595 void SendColorProfile(); |
| 572 | 596 |
| 573 // IPC message handlers | 597 // IPC message handlers |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 783 | 807 |
| 784 scoped_ptr<SyntheticGestureController> synthetic_gesture_controller_; | 808 scoped_ptr<SyntheticGestureController> synthetic_gesture_controller_; |
| 785 | 809 |
| 786 scoped_ptr<TouchEmulator> touch_emulator_; | 810 scoped_ptr<TouchEmulator> touch_emulator_; |
| 787 | 811 |
| 788 // Receives and handles all input events. | 812 // Receives and handles all input events. |
| 789 scoped_ptr<InputRouter> input_router_; | 813 scoped_ptr<InputRouter> input_router_; |
| 790 | 814 |
| 791 scoped_ptr<TimeoutMonitor> hang_monitor_timeout_; | 815 scoped_ptr<TimeoutMonitor> hang_monitor_timeout_; |
| 792 | 816 |
| 817 scoped_ptr<TimeoutMonitor> new_content_rendering_timeout_; | |
| 818 | |
| 793 #if defined(OS_WIN) | 819 #if defined(OS_WIN) |
| 794 std::list<HWND> dummy_windows_for_activation_; | 820 std::list<HWND> dummy_windows_for_activation_; |
| 795 #endif | 821 #endif |
| 796 | 822 |
| 797 RenderWidgetHostLatencyTracker latency_tracker_; | 823 RenderWidgetHostLatencyTracker latency_tracker_; |
| 798 | 824 |
| 799 int next_browser_snapshot_id_; | 825 int next_browser_snapshot_id_; |
| 800 using PendingSnapshotMap = std::map<int, GetSnapshotFromBrowserCallback>; | 826 using PendingSnapshotMap = std::map<int, GetSnapshotFromBrowserCallback>; |
| 801 PendingSnapshotMap pending_browser_snapshots_; | 827 PendingSnapshotMap pending_browser_snapshots_; |
| 802 | 828 |
| 803 // Indicates whether a RenderFramehost has ownership, in which case this | 829 // Indicates whether a RenderFramehost has ownership, in which case this |
| 804 // object does not self destroy. | 830 // object does not self destroy. |
| 805 bool owned_by_render_frame_host_; | 831 bool owned_by_render_frame_host_; |
| 806 | 832 |
| 807 // Indicates whether this RenderWidgetHost thinks is focused. This is trying | 833 // Indicates whether this RenderWidgetHost thinks is focused. This is trying |
| 808 // to match what the renderer process knows. It is different from | 834 // to match what the renderer process knows. It is different from |
| 809 // RenderWidgetHostView::HasFocus in that in that the focus request may fail, | 835 // RenderWidgetHostView::HasFocus in that in that the focus request may fail, |
| 810 // causing HasFocus to return false when is_focused_ is true. | 836 // causing HasFocus to return false when is_focused_ is true. |
| 811 bool is_focused_; | 837 bool is_focused_; |
| 812 | 838 |
| 813 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; | 839 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; |
| 814 | 840 |
| 815 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); | 841 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); |
| 816 }; | 842 }; |
| 817 | 843 |
| 818 } // namespace content | 844 } // namespace content |
| 819 | 845 |
| 820 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ | 846 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ |
| OLD | NEW |