OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_TASK_H_ | 5 #ifndef CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_TASK_H_ |
6 #define CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_TASK_H_ | 6 #define CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_TASK_H_ |
7 | 7 |
8 #include "content/common/input/input_event_ack_state.h" | 8 #include "content/common/input/input_event_ack_state.h" |
9 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 9 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
10 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul er.h" | 10 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul er.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 class MainThreadEventQueueClient; | 14 class MainThreadEventQueueClient; |
15 | 15 |
16 // A work item to execute from the main thread event queue. | 16 // A work item to execute from the main thread event queue. |
17 // The MainThreadEventQueue supports 2 types of tasks (subclasses): | 17 // The MainThreadEventQueue supports 2 types of tasks (subclasses): |
18 // 1) Closures | 18 // 1) Closures |
19 // 2) WebInputEvent | 19 // 2) WebInputEvent |
20 class MainThreadEventQueueTask { | 20 class MainThreadEventQueueTask { |
21 public: | 21 public: |
22 virtual ~MainThreadEventQueueTask() {} | 22 virtual ~MainThreadEventQueueTask() {} |
23 | 23 |
24 enum class CoalesceResult { | 24 enum class NotifyResult { |
25 Coalesced, | 25 CoalescedEvent, |
26 CannotCoalesce, | 26 Stop, |
27 // Keep iterating on the queue looking for a matching event with the | 27 KeepIterating, |
28 // same modality. | |
29 KeepSearching, | |
30 }; | 28 }; |
31 | 29 |
32 virtual CoalesceResult CoalesceWith(const MainThreadEventQueueTask&) = 0; | 30 // Notify an event will be queued. Acceptable actions are to coalesce the |
31 // event with this event, stop iterating or keep iterating. | |
tdresser
2017/03/31 19:31:02
This naming is confusing. We aren't notifying an e
dtapuska
2017/03/31 20:18:18
I adjusted the names a bit
| |
32 virtual NotifyResult NotifyEventWillBeQueued( | |
33 const MainThreadEventQueueTask&) = 0; | |
33 virtual bool IsWebInputEvent() const = 0; | 34 virtual bool IsWebInputEvent() const = 0; |
34 virtual void Dispatch(int routing_id, MainThreadEventQueueClient*) = 0; | 35 virtual void Dispatch(int routing_id, MainThreadEventQueueClient*) = 0; |
36 | |
35 virtual void EventHandled( | 37 virtual void EventHandled( |
36 int routing_id, | 38 int routing_id, |
37 blink::scheduler::RendererScheduler* renderer_scheduler, | 39 blink::scheduler::RendererScheduler* renderer_scheduler, |
38 MainThreadEventQueueClient* client, | 40 MainThreadEventQueueClient* client, |
39 blink::WebInputEvent::Type type, | 41 blink::WebInputEvent::Type type, |
40 blink::WebInputEventResult result, | 42 blink::WebInputEventResult result, |
41 InputEventAckState ack_result) = 0; | 43 InputEventAckState ack_result) = 0; |
42 }; | 44 }; |
43 | 45 |
44 } // namespace content | 46 } // namespace content |
45 | 47 |
46 #endif // CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_TASK_H_ | 48 #endif // CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_TASK_H_ |
OLD | NEW |