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

Unified Diff: content/browser/renderer_host/render_widget_host.cc

Issue 7044096: Throttle the touch move events sent to the renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/render_widget_host.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host.cc
diff --git a/content/browser/renderer_host/render_widget_host.cc b/content/browser/renderer_host/render_widget_host.cc
index 9af103c2847794316905026edf21287712a3bf18..332e733c63d4fd88ad8efa6066ebd30562a953af 100644
--- a/content/browser/renderer_host/render_widget_host.cc
+++ b/content/browser/renderer_host/render_widget_host.cc
@@ -75,6 +75,10 @@ RenderWidgetHost::RenderWidgetHost(RenderProcessHost* process,
resize_ack_pending_(false),
mouse_move_pending_(false),
mouse_wheel_pending_(false),
+#if defined(TOUCH_UI)
+ touch_move_pending_(false),
+ touch_event_is_queued_(false),
+#endif
needs_repainting_on_restore_(false),
is_unresponsive_(false),
in_get_backing_store_(false),
@@ -647,6 +651,20 @@ void RenderWidgetHost::ForwardInputEvent(const WebInputEvent& input_event,
void RenderWidgetHost::ForwardTouchEvent(
const WebKit::WebTouchEvent& touch_event) {
TRACE_EVENT0("renderer_host", "RenderWidgetHost::ForwardTouchEvent");
+ if (ignore_input_events_ || process_->ignore_input_events())
+ return;
+
+ if (touch_event.type == WebInputEvent::TouchMove &&
+ touch_move_pending_) {
+ touch_event_is_queued_ = true;
+ queued_touch_event_ = touch_event;
+ return;
+ }
+
+ if (touch_event.type == WebInputEvent::TouchMove)
+ touch_move_pending_ = true;
+ else
+ touch_move_pending_ = false;
ForwardInputEvent(touch_event, sizeof(WebKit::WebTouchEvent), false);
}
#endif
@@ -664,6 +682,11 @@ void RenderWidgetHost::RendererExited(base::TerminationStatus status,
mouse_wheel_pending_ = false;
coalesced_mouse_wheel_events_.clear();
+#if defined(TOUCH_UI)
+ touch_move_pending_ = false;
+ touch_event_is_queued_ = false;
+#endif
+
// Must reset these to ensure that keyboard events work with a new renderer.
key_queue_.clear();
suppress_next_char_events_ = false;
@@ -992,6 +1015,14 @@ void RenderWidgetHost::OnMsgInputEventAck(const IPC::Message& message) {
}
ProcessKeyboardEventAck(type, processed);
+#if defined(TOUCH_UI)
+ } else if (type == WebInputEvent::TouchMove) {
+ touch_move_pending_ = false;
+ if (touch_event_is_queued_) {
+ touch_event_is_queued_ = false;
+ ForwardTouchEvent(queued_touch_event_);
+ }
+#endif
}
// This is used only for testing.
NotificationService::current()->Notify(
« no previous file with comments | « content/browser/renderer_host/render_widget_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698