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

Unified Diff: content/renderer/input/main_thread_event_queue.cc

Issue 2240473002: Give MainThreadEventQueue a mutable WebInputEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed consts Created 4 years, 4 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
Index: content/renderer/input/main_thread_event_queue.cc
diff --git a/content/renderer/input/main_thread_event_queue.cc b/content/renderer/input/main_thread_event_queue.cc
index 772d3be1c6bc31a979561586ac353b966ba1780a..ee2a34918d69a96861d89c6cf1935c2be2e93f48 100644
--- a/content/renderer/input/main_thread_event_queue.cc
+++ b/content/renderer/input/main_thread_event_queue.cc
@@ -9,10 +9,10 @@
namespace content {
EventWithDispatchType::EventWithDispatchType(
- const blink::WebInputEvent& event,
+ ScopedWebInputEvent event,
const ui::LatencyInfo& latency,
InputEventDispatchType dispatch_type)
- : ScopedWebInputEventWithLatencyInfo(event, latency),
+ : ScopedWebInputEventWithLatencyInfo(std::move(event), latency),
dispatch_type_(dispatch_type) {}
EventWithDispatchType::~EventWithDispatchType() {}
@@ -46,7 +46,7 @@ MainThreadEventQueue::MainThreadEventQueue(
MainThreadEventQueue::~MainThreadEventQueue() {}
bool MainThreadEventQueue::HandleEvent(
- const blink::WebInputEvent* event,
+ ScopedWebInputEvent event,
const ui::LatencyInfo& latency,
InputEventDispatchType original_dispatch_type,
InputEventAckState ack_result) {
@@ -64,28 +64,28 @@ bool MainThreadEventQueue::HandleEvent(
bool is_wheel = event->type == blink::WebInputEvent::MouseWheel;
bool is_touch = blink::WebInputEvent::isTouchEventType(event->type);
- std::unique_ptr<EventWithDispatchType> cloned_event(
- new EventWithDispatchType(*event, latency, dispatch_type));
-
if (is_touch) {
- blink::WebTouchEvent& touch_event =
- static_cast<blink::WebTouchEvent&>(cloned_event->event());
- touch_event.dispatchedDuringFling = is_flinging_;
+ blink::WebTouchEvent* touch_event =
+ static_cast<blink::WebTouchEvent*>(event.get());
+ touch_event->dispatchedDuringFling = is_flinging_;
// Adjust the |dispatchType| on the event since the compositor
// determined all event listeners are passive.
if (non_blocking) {
- touch_event.dispatchType =
+ touch_event->dispatchType =
blink::WebInputEvent::ListenersNonBlockingPassive;
}
}
if (is_wheel && non_blocking) {
// Adjust the |dispatchType| on the event since the compositor
// determined all event listeners are passive.
- static_cast<blink::WebMouseWheelEvent&>(cloned_event->event())
- .dispatchType = blink::WebInputEvent::ListenersNonBlockingPassive;
+ static_cast<blink::WebMouseWheelEvent*>(event.get())
+ ->dispatchType = blink::WebInputEvent::ListenersNonBlockingPassive;
}
- QueueEvent(std::move(cloned_event));
+ std::unique_ptr<EventWithDispatchType> event_with_dispatch_type(
+ new EventWithDispatchType(std::move(event), latency, dispatch_type));
+
+ QueueEvent(std::move(event_with_dispatch_type));
// send an ack when we are non-blocking.
return non_blocking;
« no previous file with comments | « content/renderer/input/main_thread_event_queue.h ('k') | content/renderer/input/main_thread_event_queue_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698