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

Unified Diff: content/renderer/gpu/input_handler_proxy.cc

Issue 15927023: Explicit interface for synchronous InputHandlerProxy input handling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Shorter names ftw Created 7 years, 7 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/renderer/gpu/input_handler_proxy.h ('k') | content/renderer/gpu/input_handler_proxy_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/gpu/input_handler_proxy.cc
diff --git a/content/renderer/gpu/input_handler_proxy.cc b/content/renderer/gpu/input_handler_proxy.cc
index 24c541c92fe1ba546125ecd4d74217fc4b59a6ff..addc00406ca8a53bcd594f6d40ba1ec98145872e 100644
--- a/content/renderer/gpu/input_handler_proxy.cc
+++ b/content/renderer/gpu/input_handler_proxy.cc
@@ -46,28 +46,19 @@ void InputHandlerProxy::SetClient(InputHandlerProxyClient* client) {
client_ = client;
}
-void InputHandlerProxy::HandleInputEvent(const WebInputEvent& event) {
+InputHandlerProxy::EventDisposition InputHandlerProxy::HandleInputEvent(
+ const WebInputEvent& event) {
DCHECK(client_);
DCHECK(input_handler_);
InputHandlerProxy::EventDisposition disposition =
HandleInputEventInternal(event);
- switch (disposition) {
- case DidHandle:
- client_->DidHandleInputEvent();
- break;
- case DidNotHandle:
- client_->DidNotHandleInputEvent(true /* send_to_widget */);
- break;
- case DropEvent:
- client_->DidNotHandleInputEvent(false /* send_to_widget */);
- break;
- }
if (event.modifiers & WebInputEvent::IsLastInputEventForCurrentVSync) {
input_handler_->DidReceiveLastInputEventForBeginFrame(
base::TimeTicks::FromInternalValue(event.timeStampSeconds *
base::Time::kMicrosecondsPerSecond));
}
+ return disposition;
}
InputHandlerProxy::EventDisposition
@@ -78,7 +69,7 @@ InputHandlerProxy::HandleInputEventInternal(const WebInputEvent& event) {
if (wheel_event.scrollByPage) {
// TODO(jamesr): We don't properly handle scroll by page in the compositor
// thread, so punt it to the main thread. http://crbug.com/236639
- return DidNotHandle;
+ return DID_NOT_HANDLE;
}
cc::InputHandler::ScrollStatus scroll_status = input_handler_->ScrollBegin(
gfx::Point(wheel_event.x, wheel_event.y), cc::InputHandler::Wheel);
@@ -96,16 +87,16 @@ InputHandlerProxy::HandleInputEventInternal(const WebInputEvent& event) {
gfx::Point(wheel_event.x, wheel_event.y),
gfx::Vector2dF(-wheel_event.deltaX, -wheel_event.deltaY));
input_handler_->ScrollEnd();
- return did_scroll ? DidHandle : DropEvent;
+ return did_scroll ? DID_HANDLE : DROP_EVENT;
}
case cc::InputHandler::ScrollIgnored:
- // TODO(jamesr): This should be DropEvent, but in cases where we fail to
- // properly sync scrollability it's safer to send the
- // event to the main thread. Change back to DropEvent once we have
- // synchronization bugs sorted out.
- return DidNotHandle;
+ // TODO(jamesr): This should be DROP_EVENT, but in cases where we fail
+ // to properly sync scrollability it's safer to send the event to the
+ // main thread. Change back to DROP_EVENT once we have synchronization
+ // bugs sorted out.
+ return DID_NOT_HANDLE;
case cc::InputHandler::ScrollOnMainThread:
- return DidNotHandle;
+ return DID_NOT_HANDLE;
}
} else if (event.type == WebInputEvent::GestureScrollBegin) {
DCHECK(!gesture_scroll_on_impl_thread_);
@@ -121,11 +112,11 @@ InputHandlerProxy::HandleInputEventInternal(const WebInputEvent& event) {
switch (scroll_status) {
case cc::InputHandler::ScrollStarted:
gesture_scroll_on_impl_thread_ = true;
- return DidHandle;
+ return DID_HANDLE;
case cc::InputHandler::ScrollOnMainThread:
- return DidNotHandle;
+ return DID_NOT_HANDLE;
case cc::InputHandler::ScrollIgnored:
- return DropEvent;
+ return DROP_EVENT;
}
} else if (event.type == WebInputEvent::GestureScrollUpdate) {
#ifndef NDEBUG
@@ -133,7 +124,7 @@ InputHandlerProxy::HandleInputEventInternal(const WebInputEvent& event) {
#endif
if (!gesture_scroll_on_impl_thread_ && !gesture_pinch_on_impl_thread_)
- return DidNotHandle;
+ return DID_NOT_HANDLE;
const WebGestureEvent& gesture_event =
*static_cast<const WebGestureEvent*>(&event);
@@ -141,18 +132,18 @@ InputHandlerProxy::HandleInputEventInternal(const WebInputEvent& event) {
gfx::Point(gesture_event.x, gesture_event.y),
gfx::Vector2dF(-gesture_event.data.scrollUpdate.deltaX,
-gesture_event.data.scrollUpdate.deltaY));
- return did_scroll ? DidHandle : DropEvent;
+ return did_scroll ? DID_HANDLE : DROP_EVENT;
} else if (event.type == WebInputEvent::GestureScrollEnd) {
#ifndef NDEBUG
DCHECK(expect_scroll_update_end_);
expect_scroll_update_end_ = false;
#endif
if (!gesture_scroll_on_impl_thread_)
- return DidNotHandle;
+ return DID_NOT_HANDLE;
input_handler_->ScrollEnd();
gesture_scroll_on_impl_thread_ = false;
- return DidHandle;
+ return DID_HANDLE;
} else if (event.type == WebInputEvent::GesturePinchBegin) {
#ifndef NDEBUG
DCHECK(!expect_pinch_update_end_);
@@ -160,7 +151,7 @@ InputHandlerProxy::HandleInputEventInternal(const WebInputEvent& event) {
#endif
input_handler_->PinchGestureBegin();
gesture_pinch_on_impl_thread_ = true;
- return DidHandle;
+ return DID_HANDLE;
} else if (event.type == WebInputEvent::GesturePinchEnd) {
#ifndef NDEBUG
DCHECK(expect_pinch_update_end_);
@@ -168,7 +159,7 @@ InputHandlerProxy::HandleInputEventInternal(const WebInputEvent& event) {
#endif
gesture_pinch_on_impl_thread_ = false;
input_handler_->PinchGestureEnd();
- return DidHandle;
+ return DID_HANDLE;
} else if (event.type == WebInputEvent::GesturePinchUpdate) {
#ifndef NDEBUG
DCHECK(expect_pinch_update_end_);
@@ -178,27 +169,27 @@ InputHandlerProxy::HandleInputEventInternal(const WebInputEvent& event) {
input_handler_->PinchGestureUpdate(
gesture_event.data.pinchUpdate.scale,
gfx::Point(gesture_event.x, gesture_event.y));
- return DidHandle;
+ return DID_HANDLE;
} else if (event.type == WebInputEvent::GestureFlingStart) {
const WebGestureEvent& gesture_event =
*static_cast<const WebGestureEvent*>(&event);
return HandleGestureFling(gesture_event);
} else if (event.type == WebInputEvent::GestureFlingCancel) {
if (CancelCurrentFling())
- return DidHandle;
+ return DID_HANDLE;
else if (!fling_may_be_active_on_main_thread_)
- return DropEvent;
+ return DROP_EVENT;
} else if (event.type == WebInputEvent::TouchStart) {
const WebTouchEvent& touch_event =
*static_cast<const WebTouchEvent*>(&event);
if (!input_handler_->HaveTouchEventHandlersAt(touch_event.touches[0]
.position))
- return DropEvent;
+ return DROP_EVENT;
} else if (WebInputEvent::isKeyboardEventType(event.type)) {
CancelCurrentFling();
}
- return DidNotHandle;
+ return DID_NOT_HANDLE;
}
InputHandlerProxy::EventDisposition
@@ -244,7 +235,7 @@ InputHandlerProxy::HandleGestureFling(
fling_parameters_.modifiers = gesture_event.modifiers;
fling_parameters_.sourceDevice = gesture_event.sourceDevice;
input_handler_->ScheduleAnimation();
- return DidHandle;
+ return DID_HANDLE;
}
case cc::InputHandler::ScrollOnMainThread: {
TRACE_EVENT_INSTANT0("renderer",
@@ -252,7 +243,7 @@ InputHandlerProxy::HandleGestureFling(
"scroll_on_main_thread",
TRACE_EVENT_SCOPE_THREAD);
fling_may_be_active_on_main_thread_ = true;
- return DidNotHandle;
+ return DID_NOT_HANDLE;
}
case cc::InputHandler::ScrollIgnored: {
TRACE_EVENT_INSTANT0(
@@ -263,12 +254,12 @@ InputHandlerProxy::HandleGestureFling(
// We still pass the curve to the main thread if there's nothing
// scrollable, in case something
// registers a handler before the curve is over.
- return DidNotHandle;
+ return DID_NOT_HANDLE;
}
- return DropEvent;
+ return DROP_EVENT;
}
}
- return DidNotHandle;
+ return DID_NOT_HANDLE;
}
void InputHandlerProxy::Animate(base::TimeTicks time) {
@@ -341,15 +332,15 @@ bool InputHandlerProxy::TouchpadFlingScroll(
InputHandlerProxy::EventDisposition disposition =
HandleInputEventInternal(synthetic_wheel);
switch (disposition) {
- case DidHandle:
+ case DID_HANDLE:
return true;
- case DropEvent:
+ case DROP_EVENT:
break;
- case DidNotHandle:
+ case DID_NOT_HANDLE:
TRACE_EVENT_INSTANT0("renderer",
"InputHandlerProxy::scrollBy::AbortFling",
TRACE_EVENT_SCOPE_THREAD);
- // If we got a DidNotHandle, that means we need to deliver wheels on the
+ // If we got a DID_NOT_HANDLE, that means we need to deliver wheels on the
// main thread. In this case we need to schedule a commit and transfer the
// fling curve over to the main thread and run the rest of the wheels from
// there. This can happen when flinging a page that contains a scrollable
« no previous file with comments | « content/renderer/gpu/input_handler_proxy.h ('k') | content/renderer/gpu/input_handler_proxy_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698