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_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <string> | 10 #include <string> |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 // Indicates if the render widget host should track the render widget's size | 526 // Indicates if the render widget host should track the render widget's size |
527 // as opposed to visa versa. | 527 // as opposed to visa versa. |
528 void SetShouldAutoResize(bool enable); | 528 void SetShouldAutoResize(bool enable); |
529 | 529 |
530 protected: | 530 protected: |
531 // true if a renderer has once been valid. We use this flag to display a sad | 531 // true if a renderer has once been valid. We use this flag to display a sad |
532 // tab only when we lose our renderer and not if a paint occurs during | 532 // tab only when we lose our renderer and not if a paint occurs during |
533 // initialization. | 533 // initialization. |
534 bool renderer_initialized_; | 534 bool renderer_initialized_; |
535 | 535 |
| 536 // This value indicates how long to wait before we consider a renderer hung. |
| 537 int hung_renderer_delay_ms_; |
| 538 |
536 private: | 539 private: |
537 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest, Resize); | 540 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest, Resize); |
538 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest, ResizeThenCrash); | 541 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest, ResizeThenCrash); |
539 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest, HiddenPaint); | 542 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest, HiddenPaint); |
540 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest, PaintAtSize); | 543 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest, PaintAtSize); |
541 | 544 |
542 // Tell this object to destroy itself. | 545 // Tell this object to destroy itself. |
543 void Destroy(); | 546 void Destroy(); |
544 | 547 |
545 // Checks whether the renderer is hung and calls NotifyRendererUnresponsive | 548 // Checks whether the renderer is hung and calls NotifyRendererUnresponsive |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 const gfx::Size& view_size); | 632 const gfx::Size& view_size); |
630 | 633 |
631 // Called by OnMsgInputEventAck() to process a keyboard event ack message. | 634 // Called by OnMsgInputEventAck() to process a keyboard event ack message. |
632 void ProcessKeyboardEventAck(int type, bool processed); | 635 void ProcessKeyboardEventAck(int type, bool processed); |
633 | 636 |
634 // Called by OnMsgInputEventAck() to process a wheel event ack message. | 637 // Called by OnMsgInputEventAck() to process a wheel event ack message. |
635 // This could result in a task being posted to allow additional wheel | 638 // This could result in a task being posted to allow additional wheel |
636 // input messages to be coalesced. | 639 // input messages to be coalesced. |
637 void ProcessWheelAck(bool processed); | 640 void ProcessWheelAck(bool processed); |
638 | 641 |
| 642 // These two methods are being used by the "hung renderer" monitoring |
| 643 // mechanism. This mechanism relies on starting a timer and counting |
| 644 // input events going to the renderer as well as the corresponding |
| 645 // acks coming back from the renderer. The two methods below are used |
| 646 // for counting. |
| 647 void RecordInputEvent(); |
| 648 bool RecordInputEventAck(); |
| 649 |
639 // True if renderer accessibility is enabled. This should only be set when a | 650 // True if renderer accessibility is enabled. This should only be set when a |
640 // screenreader is detected as it can potentially slow down Chrome. | 651 // screenreader is detected as it can potentially slow down Chrome. |
641 bool renderer_accessible_; | 652 bool renderer_accessible_; |
642 | 653 |
643 // The View associated with the RenderViewHost. The lifetime of this object | 654 // The View associated with the RenderViewHost. The lifetime of this object |
644 // is associated with the lifetime of the Render process. If the Renderer | 655 // is associated with the lifetime of the Render process. If the Renderer |
645 // crashes, its View is destroyed and this pointer becomes NULL, even though | 656 // crashes, its View is destroyed and this pointer becomes NULL, even though |
646 // render_view_host_ lives on to load another URL (creating a new View while | 657 // render_view_host_ lives on to load another URL (creating a new View while |
647 // doing so). | 658 // doing so). |
648 RenderWidgetHostView* view_; | 659 RenderWidgetHostView* view_; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 // itself, a paint message could already be in flight at that point. | 747 // itself, a paint message could already be in flight at that point. |
737 bool needs_repainting_on_restore_; | 748 bool needs_repainting_on_restore_; |
738 | 749 |
739 // This is true if the renderer is currently unresponsive. | 750 // This is true if the renderer is currently unresponsive. |
740 bool is_unresponsive_; | 751 bool is_unresponsive_; |
741 | 752 |
742 // The following value indicates a time in the future when we would consider | 753 // The following value indicates a time in the future when we would consider |
743 // the renderer hung if it does not generate an appropriate response message. | 754 // the renderer hung if it does not generate an appropriate response message. |
744 base::Time time_when_considered_hung_; | 755 base::Time time_when_considered_hung_; |
745 | 756 |
| 757 // This value denotes the number of input events yet to be acknowledged |
| 758 // by the renderer. |
| 759 int event_count_; |
| 760 |
746 // This timer runs to check if time_when_considered_hung_ has past. | 761 // This timer runs to check if time_when_considered_hung_ has past. |
747 base::OneShotTimer<RenderWidgetHost> hung_renderer_timer_; | 762 base::OneShotTimer<RenderWidgetHost> hung_renderer_timer_; |
748 | 763 |
749 // Flag to detect recursive calls to GetBackingStore(). | 764 // Flag to detect recursive calls to GetBackingStore(). |
750 bool in_get_backing_store_; | 765 bool in_get_backing_store_; |
751 | 766 |
752 // Set when we call DidPaintRect/DidScrollRect on the view. | 767 // Set when we call DidPaintRect/DidScrollRect on the view. |
753 bool view_being_painted_; | 768 bool view_being_painted_; |
754 | 769 |
755 // Used for UMA histogram logging to measure the time for a repaint view | 770 // Used for UMA histogram logging to measure the time for a repaint view |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 gfx::Point last_scroll_offset_; | 812 gfx::Point last_scroll_offset_; |
798 | 813 |
799 bool pending_mouse_lock_request_; | 814 bool pending_mouse_lock_request_; |
800 | 815 |
801 base::WeakPtrFactory<RenderWidgetHost> weak_factory_; | 816 base::WeakPtrFactory<RenderWidgetHost> weak_factory_; |
802 | 817 |
803 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHost); | 818 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHost); |
804 }; | 819 }; |
805 | 820 |
806 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ | 821 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ |
OLD | NEW |