Index: content/browser/renderer_host/input/input_router_impl.cc |
diff --git a/content/browser/renderer_host/input/input_router_impl.cc b/content/browser/renderer_host/input/input_router_impl.cc |
index 54bf892014c80b6884e624cdcdaac312c0817e46..654830ff79c0c0bf09b555388824afedd759b7fd 100644 |
--- a/content/browser/renderer_host/input/input_router_impl.cc |
+++ b/content/browser/renderer_host/input/input_router_impl.cc |
@@ -76,6 +76,7 @@ InputRouterImpl::InputRouterImpl(IPC::Sender* sender, |
current_view_flags_(0), |
current_ack_source_(ACK_SOURCE_NONE), |
flush_requested_(false), |
+ active_fling_count_(0), |
touch_event_queue_(this, config.touch_config), |
gesture_event_queue_(this, this, config.gesture_config) { |
DCHECK(sender); |
@@ -88,11 +89,6 @@ InputRouterImpl::~InputRouterImpl() { |
STLDeleteElements(&pending_select_messages_); |
} |
-void InputRouterImpl::Flush() { |
- flush_requested_ = true; |
- SignalFlushedIfNecessary(); |
-} |
- |
bool InputRouterImpl::SendInput(scoped_ptr<IPC::Message> message) { |
DCHECK(IPC_MESSAGE_ID_CLASS(message->type()) == InputMsgStart); |
switch (message->type()) { |
@@ -244,6 +240,22 @@ void InputRouterImpl::OnViewUpdated(int view_flags) { |
UpdateTouchAckTimeoutEnabled(); |
} |
+void InputRouterImpl::RequestNotificationWhenFlushed() { |
+ flush_requested_ = true; |
+ SignalFlushedIfNecessary(); |
+} |
+ |
+bool InputRouterImpl::HasPendingEvents() const { |
+ return !touch_event_queue_.empty() || |
+ !gesture_event_queue_.empty() || |
+ !key_queue_.empty() || |
+ mouse_move_pending_ || |
+ mouse_wheel_pending_ || |
+ select_message_pending_ || |
+ move_caret_pending_ || |
+ active_fling_count_ > 0; |
+} |
+ |
bool InputRouterImpl::OnMessageReceived(const IPC::Message& message) { |
bool handled = true; |
IPC_BEGIN_MESSAGE_MAP(InputRouterImpl, message) |
@@ -257,6 +269,7 @@ bool InputRouterImpl::OnMessageReceived(const IPC::Message& message) { |
OnHasTouchEventHandlers) |
IPC_MESSAGE_HANDLER(InputHostMsg_SetTouchAction, |
OnSetTouchAction) |
+ IPC_MESSAGE_HANDLER(InputHostMsg_DidStopFlinging, OnFlingingStopped) |
IPC_MESSAGE_UNHANDLED(handled = false) |
IPC_END_MESSAGE_MAP() |
@@ -485,6 +498,13 @@ void InputRouterImpl::OnSetTouchAction(TouchAction touch_action) { |
UpdateTouchAckTimeoutEnabled(); |
} |
+void InputRouterImpl::OnFlingingStopped() { |
+ DCHECK_GT(active_fling_count_, 0); |
+ --active_fling_count_; |
+ SignalFlushedIfNecessary(); |
+ client_->DidStopFlinging(); |
+} |
+ |
void InputRouterImpl::ProcessInputEventAck( |
WebInputEvent::Type event_type, |
InputEventAckState ack_result, |
@@ -586,6 +606,11 @@ void InputRouterImpl::ProcessWheelAck(InputEventAckState ack_result, |
void InputRouterImpl::ProcessGestureAck(WebInputEvent::Type type, |
InputEventAckState ack_result, |
const ui::LatencyInfo& latency) { |
+ if (type == blink::WebInputEvent::GestureFlingStart && |
+ ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) { |
+ ++active_fling_count_; |
+ } |
Yufeng Shen (Slow to review)
2015/03/13 15:53:42
I saw that gesture event queue also maintains a fl
jdduke (slow)
2015/03/13 16:08:04
Probably, although the gesture queue fling in prog
|
+ |
// |gesture_event_queue_| will forward to OnGestureEventAck when appropriate. |
gesture_event_queue_.ProcessGestureAck(ack_result, type, latency); |
} |
@@ -626,14 +651,4 @@ void InputRouterImpl::SignalFlushedIfNecessary() { |
client_->DidFlush(); |
} |
-bool InputRouterImpl::HasPendingEvents() const { |
- return !touch_event_queue_.empty() || |
- !gesture_event_queue_.empty() || |
- !key_queue_.empty() || |
- mouse_move_pending_ || |
- mouse_wheel_pending_ || |
- select_message_pending_ || |
- move_caret_pending_; |
-} |
- |
} // namespace content |