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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 | 815 |
834 // Receives and handles all input events. | 816 // Receives and handles all input events. |
835 scoped_ptr<InputRouter> input_router_; | 817 scoped_ptr<InputRouter> input_router_; |
836 | 818 |
837 scoped_ptr<TimeoutMonitor> hang_monitor_timeout_; | 819 scoped_ptr<TimeoutMonitor> hang_monitor_timeout_; |
838 | 820 |
839 #if defined(OS_WIN) | 821 #if defined(OS_WIN) |
840 std::list<HWND> dummy_windows_for_activation_; | 822 std::list<HWND> dummy_windows_for_activation_; |
841 #endif | 823 #endif |
842 | 824 |
843 int64 last_input_number_; | 825 RenderWidgetHostLatencyTracker latency_tracker_; |
844 | 826 |
845 bool subscribe_uniform_enabled_; | 827 bool subscribe_uniform_enabled_; |
846 | 828 |
847 int next_browser_snapshot_id_; | 829 int next_browser_snapshot_id_; |
848 typedef std::map<int, | 830 typedef std::map<int, |
849 base::Callback<void(const unsigned char*, size_t)> > PendingSnapshotMap; | 831 base::Callback<void(const unsigned char*, size_t)> > PendingSnapshotMap; |
850 PendingSnapshotMap pending_browser_snapshots_; | 832 PendingSnapshotMap pending_browser_snapshots_; |
851 | 833 |
852 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; | 834 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; |
853 | 835 |
854 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); | 836 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); |
855 }; | 837 }; |
856 | 838 |
857 } // namespace content | 839 } // namespace content |
858 | 840 |
859 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ | 841 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ |
OLD | NEW |