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 #include "content/browser/renderer_host/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 957 original_component.sequence_number, | 957 original_component.sequence_number, |
| 958 original_component.event_time, | 958 original_component.event_time, |
| 959 original_component.event_count); | 959 original_component.event_count); |
| 960 } | 960 } |
| 961 } | 961 } |
| 962 | 962 |
| 963 GestureEventWithLatencyInfo gesture_with_latency(gesture_event, latency_info); | 963 GestureEventWithLatencyInfo gesture_with_latency(gesture_event, latency_info); |
| 964 input_router_->SendGestureEvent(gesture_with_latency); | 964 input_router_->SendGestureEvent(gesture_with_latency); |
| 965 } | 965 } |
| 966 | 966 |
| 967 void RenderWidgetHostImpl::ForwardTouchEvent( | 967 void RenderWidgetHostImpl::ForwardEmulatedTouchEvent( |
| 968 const blink::WebTouchEvent& touch_event) { | 968 const blink::WebTouchEvent& touch_event) { |
| 969 ForwardTouchEventWithLatencyInfo(touch_event, ui::LatencyInfo()); | 969 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardTouchEvent"); |
|
jdduke (slow)
2014/07/15 19:43:03
TRACE_EVENT0("input", "RenderWidgetHostImpl::Forwa
dgozman
2014/07/16 09:05:04
Done.
| |
| 970 ui::LatencyInfo latency_info = | |
| 971 CreateRWHLatencyInfoIfNotExist(NULL, touch_event.type); | |
| 972 TouchEventWithLatencyInfo touch_with_latency(touch_event, latency_info); | |
| 973 input_router_->SendTouchEvent(touch_with_latency); | |
| 970 } | 974 } |
| 971 | 975 |
| 972 void RenderWidgetHostImpl::ForwardTouchEventWithLatencyInfo( | 976 void RenderWidgetHostImpl::ForwardTouchEventWithLatencyInfo( |
| 973 const blink::WebTouchEvent& touch_event, | 977 const blink::WebTouchEvent& touch_event, |
| 974 const ui::LatencyInfo& ui_latency) { | 978 const ui::LatencyInfo& ui_latency) { |
| 975 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardTouchEvent"); | 979 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardTouchEvent"); |
| 976 | 980 |
| 977 // Always forward TouchEvents for touch stream consistency. They will be | 981 // Always forward TouchEvents for touch stream consistency. They will be |
| 978 // ignored if appropriate in FilterInputEvent(). | 982 // ignored if appropriate in FilterInputEvent(). |
| 979 | 983 |
| 980 ui::LatencyInfo latency_info = | 984 ui::LatencyInfo latency_info = |
| 981 CreateRWHLatencyInfoIfNotExist(&ui_latency, touch_event.type); | 985 CreateRWHLatencyInfoIfNotExist(&ui_latency, touch_event.type); |
| 982 TouchEventWithLatencyInfo touch_with_latency(touch_event, latency_info); | 986 TouchEventWithLatencyInfo touch_with_latency(touch_event, latency_info); |
| 987 | |
| 988 if (touch_emulator_ && | |
| 989 touch_emulator_->HandleTouchEvent(touch_with_latency.event)) { | |
| 990 if (view_) { | |
| 991 view_->ProcessAckedTouchEvent( | |
| 992 touch_with_latency, INPUT_EVENT_ACK_STATE_CONSUMED); | |
| 993 } | |
| 994 return; | |
| 995 } | |
| 996 | |
| 983 input_router_->SendTouchEvent(touch_with_latency); | 997 input_router_->SendTouchEvent(touch_with_latency); |
| 984 } | 998 } |
| 985 | 999 |
| 986 void RenderWidgetHostImpl::ForwardKeyboardEvent( | 1000 void RenderWidgetHostImpl::ForwardKeyboardEvent( |
| 987 const NativeWebKeyboardEvent& key_event) { | 1001 const NativeWebKeyboardEvent& key_event) { |
| 988 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardKeyboardEvent"); | 1002 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardKeyboardEvent"); |
| 989 if (IgnoreInputEvents()) | 1003 if (IgnoreInputEvents()) |
| 990 return; | 1004 return; |
| 991 | 1005 |
| 992 if (!process_->HasConnection()) | 1006 if (!process_->HasConnection()) |
| (...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1889 touch_event.latency.AddLatencyNumber( | 1903 touch_event.latency.AddLatencyNumber( |
| 1890 ui::INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT, 0, 0); | 1904 ui::INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT, 0, 0); |
| 1891 // TouchEvent latency ends at ack if it didn't cause any rendering. | 1905 // TouchEvent latency ends at ack if it didn't cause any rendering. |
| 1892 if (!touch_event.latency.FindLatency( | 1906 if (!touch_event.latency.FindLatency( |
| 1893 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { | 1907 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { |
| 1894 touch_event.latency.AddLatencyNumber( | 1908 touch_event.latency.AddLatencyNumber( |
| 1895 ui::INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT, 0, 0); | 1909 ui::INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT, 0, 0); |
| 1896 } | 1910 } |
| 1897 ComputeTouchLatency(touch_event.latency); | 1911 ComputeTouchLatency(touch_event.latency); |
| 1898 | 1912 |
| 1899 if (touch_emulator_ && touch_emulator_->HandleTouchEventAck(ack_result)) | 1913 if (touch_emulator_ && |
| 1914 touch_emulator_->HandleTouchEventAck(event.event, ack_result)) { | |
| 1900 return; | 1915 return; |
| 1916 } | |
| 1901 | 1917 |
| 1902 if (view_) | 1918 if (view_) |
| 1903 view_->ProcessAckedTouchEvent(touch_event, ack_result); | 1919 view_->ProcessAckedTouchEvent(touch_event, ack_result); |
| 1904 } | 1920 } |
| 1905 | 1921 |
| 1906 void RenderWidgetHostImpl::OnUnexpectedEventAck(UnexpectedEventAckType type) { | 1922 void RenderWidgetHostImpl::OnUnexpectedEventAck(UnexpectedEventAckType type) { |
| 1907 if (type == BAD_ACK_MESSAGE) { | 1923 if (type == BAD_ACK_MESSAGE) { |
| 1908 RecordAction(base::UserMetricsAction("BadMessageTerminate_RWH2")); | 1924 RecordAction(base::UserMetricsAction("BadMessageTerminate_RWH2")); |
| 1909 process_->ReceivedBadMessage(); | 1925 process_->ReceivedBadMessage(); |
| 1910 } else if (type == UNEXPECTED_EVENT_TYPE) { | 1926 } else if (type == UNEXPECTED_EVENT_TYPE) { |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2381 } | 2397 } |
| 2382 } | 2398 } |
| 2383 | 2399 |
| 2384 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { | 2400 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { |
| 2385 if (view_) | 2401 if (view_) |
| 2386 return view_->PreferredReadbackFormat(); | 2402 return view_->PreferredReadbackFormat(); |
| 2387 return kN32_SkColorType; | 2403 return kN32_SkColorType; |
| 2388 } | 2404 } |
| 2389 | 2405 |
| 2390 } // namespace content | 2406 } // namespace content |
| OLD | NEW |