Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 375863005: Touch emulator: allow multiple touch streams. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed comments, switched to sequence_count Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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::ForwardEmulatedTouchEvent");
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
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) {
1911 suppress_next_char_events_ = false; 1927 suppress_next_char_events_ = false;
1912 } 1928 }
1913 } 1929 }
1914 1930
1915 void RenderWidgetHostImpl::OnSyntheticGestureCompleted( 1931 void RenderWidgetHostImpl::OnSyntheticGestureCompleted(
1916 SyntheticGesture::Result result) { 1932 SyntheticGesture::Result result) {
1917 Send(new InputMsg_SyntheticGestureCompleted(GetRoutingID())); 1933 Send(new InputMsg_SyntheticGestureCompleted(GetRoutingID()));
1918 } 1934 }
1919 1935
1920 const gfx::Vector2d& RenderWidgetHostImpl::GetLastScrollOffset() const { 1936 const gfx::Vector2d& RenderWidgetHostImpl::GetLastScrollOffset() const {
1921 return last_scroll_offset_; 1937 return last_scroll_offset_;
1922 } 1938 }
1923 1939
1924 bool RenderWidgetHostImpl::IgnoreInputEvents() const { 1940 bool RenderWidgetHostImpl::IgnoreInputEvents() const {
1925 return ignore_input_events_ || process_->IgnoreInputEvents(); 1941 return ignore_input_events_ || process_->IgnoreInputEvents();
1926 } 1942 }
1927 1943
1928 bool RenderWidgetHostImpl::ShouldForwardTouchEvent() const { 1944 bool RenderWidgetHostImpl::ShouldForwardTouchEvent() const {
1929 return input_router_->ShouldForwardTouchEvent(); 1945 return input_router_->ShouldForwardTouchEvent();
jdduke (slow) 2014/07/16 15:17:03 So, one intermediate solution (kind of hacky) woul
1930 } 1946 }
1931 1947
1932 void RenderWidgetHostImpl::StartUserGesture() { 1948 void RenderWidgetHostImpl::StartUserGesture() {
1933 OnUserGesture(); 1949 OnUserGesture();
1934 } 1950 }
1935 1951
1936 void RenderWidgetHostImpl::Stop() { 1952 void RenderWidgetHostImpl::Stop() {
1937 Send(new ViewMsg_Stop(GetRoutingID())); 1953 Send(new ViewMsg_Stop(GetRoutingID()));
1938 } 1954 }
1939 1955
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/common/input/web_touch_event_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698