| 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 MainThreadEventQueue; |
| 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 FilterResult { | 24 enum class FilterResult { |
| 25 // The passed in event was coalesced into this event. Don't queue | 25 // The passed in event was coalesced into this event. Don't queue |
| 26 // the new event. | 26 // the new event. |
| 27 CoalescedEvent, | 27 CoalescedEvent, |
| 28 | 28 |
| 29 // Stop invoking FilterNewEvent on any other events in the queue. | 29 // Stop invoking FilterNewEvent on any other events in the queue. |
| 30 StopIterating, | 30 StopIterating, |
| 31 | 31 |
| 32 // Keep invoking FilterNewEvent on the next older event in the queue. | 32 // Keep invoking FilterNewEvent on the next older event in the queue. |
| 33 KeepIterating, | 33 KeepIterating, |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 // Filter a new event that is about to be queued. Acceptable actions | 36 // Filter a new event that is about to be queued. Acceptable actions |
| 37 // are to coalesce event, stop iterating or keep iterating. | 37 // are to coalesce event, stop iterating or keep iterating. |
| 38 // Iteration of the list begins at the end of the queue (newest to oldest). | 38 // Iteration of the list begins at the end of the queue (newest to oldest). |
| 39 virtual FilterResult FilterNewEvent(const MainThreadEventQueueTask&) = 0; | 39 virtual FilterResult FilterNewEvent(const MainThreadEventQueueTask&) = 0; |
| 40 virtual bool IsWebInputEvent() const = 0; | 40 virtual bool IsWebInputEvent() const = 0; |
| 41 virtual void Dispatch(int routing_id, MainThreadEventQueueClient*) = 0; | 41 virtual void Dispatch(MainThreadEventQueue*) = 0; |
| 42 | |
| 43 virtual void EventHandled( | |
| 44 int routing_id, | |
| 45 blink::scheduler::RendererScheduler* renderer_scheduler, | |
| 46 MainThreadEventQueueClient* client, | |
| 47 blink::WebInputEvent::Type type, | |
| 48 blink::WebInputEventResult result, | |
| 49 InputEventAckState ack_result) = 0; | |
| 50 }; | 42 }; |
| 51 | 43 |
| 52 } // namespace content | 44 } // namespace content |
| 53 | 45 |
| 54 #endif // CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_TASK_H_ | 46 #endif // CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_TASK_H_ |
| OLD | NEW |