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

Side by Side Diff: content/renderer/input/non_blocking_event_queue.cc

Issue 1631963002: Plumb firing passive event listeners. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_wheel_passive_listeners_2a
Patch Set: Rename to non-blocking and rebase against underlying changes Created 4 years, 10 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/renderer/input/non_blocking_event_queue.h"
6
7 namespace content {
8
9 NonBlockingEventQueue::NonBlockingEventQueue(
10 int routing_id,
11 NonBlockingEventQueueClient* client)
12 : routing_id_(routing_id), client_(client) {}
13
14 NonBlockingEventQueue::~NonBlockingEventQueue() {}
15
16 void NonBlockingEventQueue::HandleEvent(const blink::WebInputEvent* event,
17 const ui::LatencyInfo& latency) {
18 if (event->type == blink::WebInputEvent::MouseWheel) {
19 if (wheel_events_.state() ==
20 WebInputEventQueue<
21 MouseWheelEventWithLatencyInfo>::State::ITEM_PENDING) {
tdresser 2016/02/08 17:51:32 Referring to these constants is pretty nasty. May
dtapuska 2016/02/09 19:40:11 Done.
22 wheel_events_.Queue(MouseWheelEventWithLatencyInfo(
23 *static_cast<const blink::WebMouseWheelEvent*>(event), latency));
24 } else {
25 wheel_events_.set_state(
26 WebInputEventQueue<
27 MouseWheelEventWithLatencyInfo>::State::ITEM_PENDING);
28 client_->SendNonBlockingEvent(routing_id_, event, latency);
29 }
30 } else if (blink::WebInputEvent::isTouchEventType(event->type)) {
31 if (touch_events_.state() ==
32 WebInputEventQueue<TouchEventWithLatencyInfo>::State::ITEM_PENDING) {
33 touch_events_.Queue(TouchEventWithLatencyInfo(
34 *static_cast<const blink::WebTouchEvent*>(event), latency));
35 } else {
36 touch_events_.set_state(
37 WebInputEventQueue<TouchEventWithLatencyInfo>::State::ITEM_PENDING);
38 client_->SendNonBlockingEvent(routing_id_, event, latency);
39 }
40 } else {
41 NOTREACHED() << "Invalid passive event type";
42 }
43 }
44
45 void NonBlockingEventQueue::EventHandled(blink::WebInputEvent::Type type) {
46 if (type == blink::WebInputEvent::MouseWheel) {
47 if (!wheel_events_.empty()) {
48 scoped_ptr<MouseWheelEventWithLatencyInfo> event = wheel_events_.Deque();
49
50 client_->SendNonBlockingEvent(routing_id_, &event->event, event->latency);
51 } else {
52 wheel_events_.set_state(
53 WebInputEventQueue<
54 MouseWheelEventWithLatencyInfo>::State::ITEM_NOT_PENDING);
55 }
56 } else if (blink::WebInputEvent::isTouchEventType(type)) {
57 if (!touch_events_.empty()) {
58 scoped_ptr<TouchEventWithLatencyInfo> event = touch_events_.Deque();
59 client_->SendNonBlockingEvent(routing_id_, &event->event, event->latency);
60 } else {
61 touch_events_.set_state(
62 WebInputEventQueue<
63 TouchEventWithLatencyInfo>::State::ITEM_NOT_PENDING);
64 }
65 } else {
66 NOTREACHED() << "Invalid passive event type";
67 }
68 }
69
70 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698