Chromium Code Reviews| 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 FilterResult { |
| 25 Coalesced, | 25 PreventQueuingEvent, |
| 26 CannotCoalesce, | 26 StopIterating, |
| 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 // Filter a new event that is about to be queued. Acceptable actions |
| 31 // are to prevent queuing the event, stop iterating or keep iterating. | |
|
tdresser
2017/03/31 20:50:20
Add more detail around what it means to keep itera
dtapuska
2017/03/31 21:06:10
Done.
| |
| 32 virtual FilterResult FilterNewEvent(const MainThreadEventQueueTask&) = 0; | |
| 33 virtual bool IsWebInputEvent() const = 0; | 33 virtual bool IsWebInputEvent() const = 0; |
| 34 virtual void Dispatch(int routing_id, MainThreadEventQueueClient*) = 0; | 34 virtual void Dispatch(int routing_id, MainThreadEventQueueClient*) = 0; |
| 35 | |
| 35 virtual void EventHandled( | 36 virtual void EventHandled( |
| 36 int routing_id, | 37 int routing_id, |
| 37 blink::scheduler::RendererScheduler* renderer_scheduler, | 38 blink::scheduler::RendererScheduler* renderer_scheduler, |
| 38 MainThreadEventQueueClient* client, | 39 MainThreadEventQueueClient* client, |
| 39 blink::WebInputEvent::Type type, | 40 blink::WebInputEvent::Type type, |
| 40 blink::WebInputEventResult result, | 41 blink::WebInputEventResult result, |
| 41 InputEventAckState ack_result) = 0; | 42 InputEventAckState ack_result) = 0; |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 } // namespace content | 45 } // namespace content |
| 45 | 46 |
| 46 #endif // CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_TASK_H_ | 47 #endif // CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_TASK_H_ |
| OLD | NEW |