| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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_H_ | 5 #ifndef CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_H_ |
| 6 #define CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_H_ | 6 #define CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include "base/feature_list.h" | 9 #include "base/feature_list.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "content/common/input/event_with_latency_info.h" | 11 #include "content/common/input/event_with_latency_info.h" |
| 12 #include "content/common/input/input_event_ack_state.h" | 12 #include "content/common/input/input_event_ack_state.h" |
| 13 #include "content/common/input/input_event_dispatch_type.h" | 13 #include "content/common/input/input_event_dispatch_type.h" |
| 14 #include "content/common/input/web_input_event_queue.h" | 14 #include "content/common/input/web_input_event_queue.h" |
| 15 #include "content/public/common/content_features.h" | 15 #include "content/public/common/content_features.h" |
| 16 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" |
| 16 #include "third_party/WebKit/public/web/WebInputEvent.h" | 17 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 17 #include "ui/events/blink/web_input_event_traits.h" | 18 #include "ui/events/blink/web_input_event_traits.h" |
| 18 #include "ui/events/latency_info.h" | 19 #include "ui/events/latency_info.h" |
| 19 | 20 |
| 20 namespace content { | 21 namespace content { |
| 21 | 22 |
| 22 class EventWithDispatchType : public ScopedWebInputEventWithLatencyInfo { | 23 class EventWithDispatchType : public ScopedWebInputEventWithLatencyInfo { |
| 23 public: | 24 public: |
| 24 EventWithDispatchType(ui::ScopedWebInputEvent event, | 25 EventWithDispatchType(ui::ScopedWebInputEvent event, |
| 25 const ui::LatencyInfo& latency, | 26 const ui::LatencyInfo& latency, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 // (deque) | 95 // (deque) |
| 95 // (deque) | 96 // (deque) |
| 96 // <-------(ACK)------ | 97 // <-------(ACK)------ |
| 97 // | 98 // |
| 98 class CONTENT_EXPORT MainThreadEventQueue | 99 class CONTENT_EXPORT MainThreadEventQueue |
| 99 : public base::RefCountedThreadSafe<MainThreadEventQueue> { | 100 : public base::RefCountedThreadSafe<MainThreadEventQueue> { |
| 100 public: | 101 public: |
| 101 MainThreadEventQueue( | 102 MainThreadEventQueue( |
| 102 int routing_id, | 103 int routing_id, |
| 103 MainThreadEventQueueClient* client, | 104 MainThreadEventQueueClient* client, |
| 104 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner); | 105 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner, |
| 106 blink::scheduler::RendererScheduler* renderer_scheduler); |
| 105 | 107 |
| 106 // Called once the compositor has handled |event| and indicated that it is | 108 // Called once the compositor has handled |event| and indicated that it is |
| 107 // a non-blocking event to be queued to the main thread. | 109 // a non-blocking event to be queued to the main thread. |
| 108 bool HandleEvent(ui::ScopedWebInputEvent event, | 110 bool HandleEvent(ui::ScopedWebInputEvent event, |
| 109 const ui::LatencyInfo& latency, | 111 const ui::LatencyInfo& latency, |
| 110 InputEventDispatchType dispatch_type, | 112 InputEventDispatchType dispatch_type, |
| 111 InputEventAckState ack_result); | 113 InputEventAckState ack_result); |
| 112 | 114 |
| 113 // Call once the main thread has handled an outstanding |type| event | 115 // Call once the main thread has handled an outstanding |type| event |
| 114 // in flight. | 116 // in flight. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 131 int routing_id_; | 133 int routing_id_; |
| 132 MainThreadEventQueueClient* client_; | 134 MainThreadEventQueueClient* client_; |
| 133 WebInputEventQueue<EventWithDispatchType> events_; | 135 WebInputEventQueue<EventWithDispatchType> events_; |
| 134 std::unique_ptr<EventWithDispatchType> in_flight_event_; | 136 std::unique_ptr<EventWithDispatchType> in_flight_event_; |
| 135 bool is_flinging_; | 137 bool is_flinging_; |
| 136 bool last_touch_start_forced_nonblocking_due_to_fling_; | 138 bool last_touch_start_forced_nonblocking_due_to_fling_; |
| 137 bool enable_fling_passive_listener_flag_; | 139 bool enable_fling_passive_listener_flag_; |
| 138 | 140 |
| 139 base::Lock event_queue_lock_; | 141 base::Lock event_queue_lock_; |
| 140 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 142 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
| 143 blink::scheduler::RendererScheduler* renderer_scheduler_; |
| 141 | 144 |
| 142 DISALLOW_COPY_AND_ASSIGN(MainThreadEventQueue); | 145 DISALLOW_COPY_AND_ASSIGN(MainThreadEventQueue); |
| 143 }; | 146 }; |
| 144 | 147 |
| 145 } // namespace content | 148 } // namespace content |
| 146 | 149 |
| 147 #endif // CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_H_ | 150 #endif // CONTENT_RENDERER_INPUT_MAIN_THREAD_EVENT_QUEUE_H_ |
| OLD | NEW |