| 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 <deque> | 8 #include <deque> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "base/strings/string16.h" | 22 #include "base/strings/string16.h" |
| 23 #include "base/time/time.h" | 23 #include "base/time/time.h" |
| 24 #include "base/timer/timer.h" | 24 #include "base/timer/timer.h" |
| 25 #include "build/build_config.h" | 25 #include "build/build_config.h" |
| 26 #include "cc/resources/shared_bitmap.h" | 26 #include "cc/resources/shared_bitmap.h" |
| 27 #include "content/browser/renderer_host/event_with_latency_info.h" | 27 #include "content/browser/renderer_host/event_with_latency_info.h" |
| 28 #include "content/browser/renderer_host/input/input_ack_handler.h" | 28 #include "content/browser/renderer_host/input/input_ack_handler.h" |
| 29 #include "content/browser/renderer_host/input/input_router_client.h" | 29 #include "content/browser/renderer_host/input/input_router_client.h" |
| 30 #include "content/browser/renderer_host/input/synthetic_gesture.h" | 30 #include "content/browser/renderer_host/input/synthetic_gesture.h" |
| 31 #include "content/browser/renderer_host/input/touch_emulator_client.h" | 31 #include "content/browser/renderer_host/input/touch_emulator_client.h" |
| 32 #include "content/browser/renderer_host/render_widget_host_latency_tracker.h" |
| 32 #include "content/common/input/input_event_ack_state.h" | 33 #include "content/common/input/input_event_ack_state.h" |
| 33 #include "content/common/input/synthetic_gesture_packet.h" | 34 #include "content/common/input/synthetic_gesture_packet.h" |
| 34 #include "content/common/view_message_enums.h" | 35 #include "content/common/view_message_enums.h" |
| 35 #include "content/public/browser/readback_types.h" | 36 #include "content/public/browser/readback_types.h" |
| 36 #include "content/public/browser/render_widget_host.h" | 37 #include "content/public/browser/render_widget_host.h" |
| 37 #include "content/public/common/page_zoom.h" | 38 #include "content/public/common/page_zoom.h" |
| 38 #include "ipc/ipc_listener.h" | 39 #include "ipc/ipc_listener.h" |
| 39 #include "ui/base/ime/text_input_mode.h" | 40 #include "ui/base/ime/text_input_mode.h" |
| 40 #include "ui/base/ime/text_input_type.h" | 41 #include "ui/base/ime/text_input_type.h" |
| 41 #include "ui/events/latency_info.h" | 42 #include "ui/events/latency_info.h" |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 | 460 |
| 460 // Don't check whether we expected a resize ack during layout tests. | 461 // Don't check whether we expected a resize ack during layout tests. |
| 461 static void DisableResizeAckCheckForTesting(); | 462 static void DisableResizeAckCheckForTesting(); |
| 462 | 463 |
| 463 void WindowSnapshotAsyncCallback( | 464 void WindowSnapshotAsyncCallback( |
| 464 int routing_id, | 465 int routing_id, |
| 465 int snapshot_id, | 466 int snapshot_id, |
| 466 gfx::Size snapshot_size, | 467 gfx::Size snapshot_size, |
| 467 scoped_refptr<base::RefCountedBytes> png_data); | 468 scoped_refptr<base::RefCountedBytes> png_data); |
| 468 | 469 |
| 469 // LatencyComponents generated in the renderer must have component IDs | |
| 470 // provided to them by the browser process. This function adds the correct | |
| 471 // component ID where necessary. | |
| 472 void AddLatencyInfoComponentIds(ui::LatencyInfo* latency_info); | |
| 473 | |
| 474 InputRouter* input_router() { return input_router_.get(); } | 470 InputRouter* input_router() { return input_router_.get(); } |
| 475 | 471 |
| 476 // Get the BrowserAccessibilityManager for the root of the frame tree, | 472 // Get the BrowserAccessibilityManager for the root of the frame tree, |
| 477 BrowserAccessibilityManager* GetRootBrowserAccessibilityManager(); | 473 BrowserAccessibilityManager* GetRootBrowserAccessibilityManager(); |
| 478 | 474 |
| 479 // Get the BrowserAccessibilityManager for the root of the frame tree, | 475 // Get the BrowserAccessibilityManager for the root of the frame tree, |
| 480 // or create it if it doesn't already exist. | 476 // or create it if it doesn't already exist. |
| 481 BrowserAccessibilityManager* GetOrCreateRootBrowserAccessibilityManager(); | 477 BrowserAccessibilityManager* GetOrCreateRootBrowserAccessibilityManager(); |
| 482 | 478 |
| 483 #if defined(OS_WIN) | 479 #if defined(OS_WIN) |
| 484 gfx::NativeViewAccessible GetParentNativeViewAccessible(); | 480 gfx::NativeViewAccessible GetParentNativeViewAccessible(); |
| 485 #endif | 481 #endif |
| 486 | 482 |
| 487 protected: | 483 protected: |
| 488 RenderWidgetHostImpl* AsRenderWidgetHostImpl() override; | 484 RenderWidgetHostImpl* AsRenderWidgetHostImpl() override; |
| 489 | 485 |
| 490 // Create a LatencyInfo struct with INPUT_EVENT_LATENCY_RWH_COMPONENT | |
| 491 // component if it is not already in |original|. And if |original| is | |
| 492 // not NULL, it is also merged into the resulting LatencyInfo. | |
| 493 ui::LatencyInfo CreateInputEventLatencyInfoIfNotExist( | |
| 494 const ui::LatencyInfo* original, | |
| 495 blink::WebInputEvent::Type type, | |
| 496 const ui::LatencyInfo::InputCoordinate* logical_coordinates, | |
| 497 size_t logical_coordinates_size); | |
| 498 // Add UMA histograms for the latency to the renderer and roundtrip latency | |
| 499 // for a given event type. | |
| 500 void ComputeInputLatencyHistograms( | |
| 501 blink::WebInputEvent::Type type, | |
| 502 const ui::LatencyInfo& latency_info) const; | |
| 503 | |
| 504 // Called when we receive a notification indicating that the renderer | 486 // Called when we receive a notification indicating that the renderer |
| 505 // process has gone. This will reset our state so that our state will be | 487 // process has gone. This will reset our state so that our state will be |
| 506 // consistent if a new renderer is created. | 488 // consistent if a new renderer is created. |
| 507 void RendererExited(base::TerminationStatus status, int exit_code); | 489 void RendererExited(base::TerminationStatus status, int exit_code); |
| 508 | 490 |
| 509 // Retrieves an id the renderer can use to refer to its view. | 491 // Retrieves an id the renderer can use to refer to its view. |
| 510 // This is used for various IPC messages, including plugins. | 492 // This is used for various IPC messages, including plugins. |
| 511 gfx::NativeViewId GetNativeViewId() const; | 493 gfx::NativeViewId GetNativeViewId() const; |
| 512 | 494 |
| 513 // Retrieves an id for the surface that the renderer can draw to | 495 // Retrieves an id for the surface that the renderer can draw to |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 void OnKeyboardEventAck(const NativeWebKeyboardEvent& event, | 654 void OnKeyboardEventAck(const NativeWebKeyboardEvent& event, |
| 673 InputEventAckState ack_result) override; | 655 InputEventAckState ack_result) override; |
| 674 void OnWheelEventAck(const MouseWheelEventWithLatencyInfo& event, | 656 void OnWheelEventAck(const MouseWheelEventWithLatencyInfo& event, |
| 675 InputEventAckState ack_result) override; | 657 InputEventAckState ack_result) override; |
| 676 void OnTouchEventAck(const TouchEventWithLatencyInfo& event, | 658 void OnTouchEventAck(const TouchEventWithLatencyInfo& event, |
| 677 InputEventAckState ack_result) override; | 659 InputEventAckState ack_result) override; |
| 678 void OnGestureEventAck(const GestureEventWithLatencyInfo& event, | 660 void OnGestureEventAck(const GestureEventWithLatencyInfo& event, |
| 679 InputEventAckState ack_result) override; | 661 InputEventAckState ack_result) override; |
| 680 void OnUnexpectedEventAck(UnexpectedEventAckType type) override; | 662 void OnUnexpectedEventAck(UnexpectedEventAckType type) override; |
| 681 | 663 |
| 664 void StartTrackingInputEventLatency(const blink::WebInputEvent& event, |
| 665 ui::LatencyInfo* latency); |
| 666 |
| 682 void OnSyntheticGestureCompleted(SyntheticGesture::Result result); | 667 void OnSyntheticGestureCompleted(SyntheticGesture::Result result); |
| 683 | 668 |
| 684 // Called when there is a new auto resize (using a post to avoid a stack | 669 // Called when there is a new auto resize (using a post to avoid a stack |
| 685 // which may get in recursive loops). | 670 // which may get in recursive loops). |
| 686 void DelayedAutoResized(); | 671 void DelayedAutoResized(); |
| 687 | 672 |
| 688 void WindowOldSnapshotReachedScreen(int snapshot_id); | 673 void WindowOldSnapshotReachedScreen(int snapshot_id); |
| 689 | 674 |
| 690 void WindowSnapshotReachedScreen(int snapshot_id); | 675 void WindowSnapshotReachedScreen(int snapshot_id); |
| 691 | 676 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 | 818 |
| 834 // Receives and handles all input events. | 819 // Receives and handles all input events. |
| 835 scoped_ptr<InputRouter> input_router_; | 820 scoped_ptr<InputRouter> input_router_; |
| 836 | 821 |
| 837 scoped_ptr<TimeoutMonitor> hang_monitor_timeout_; | 822 scoped_ptr<TimeoutMonitor> hang_monitor_timeout_; |
| 838 | 823 |
| 839 #if defined(OS_WIN) | 824 #if defined(OS_WIN) |
| 840 std::list<HWND> dummy_windows_for_activation_; | 825 std::list<HWND> dummy_windows_for_activation_; |
| 841 #endif | 826 #endif |
| 842 | 827 |
| 843 int64 last_input_number_; | 828 RenderWidgetHostLatencyTracker latency_tracker_; |
| 844 | 829 |
| 845 bool subscribe_uniform_enabled_; | 830 bool subscribe_uniform_enabled_; |
| 846 | 831 |
| 847 int next_browser_snapshot_id_; | 832 int next_browser_snapshot_id_; |
| 848 typedef std::map<int, | 833 typedef std::map<int, |
| 849 base::Callback<void(const unsigned char*, size_t)> > PendingSnapshotMap; | 834 base::Callback<void(const unsigned char*, size_t)> > PendingSnapshotMap; |
| 850 PendingSnapshotMap pending_browser_snapshots_; | 835 PendingSnapshotMap pending_browser_snapshots_; |
| 851 | 836 |
| 852 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; | 837 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; |
| 853 | 838 |
| 854 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); | 839 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); |
| 855 }; | 840 }; |
| 856 | 841 |
| 857 } // namespace content | 842 } // namespace content |
| 858 | 843 |
| 859 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ | 844 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ |
| OLD | NEW |