Chromium Code Reviews| 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 #include "content/renderer/input/main_thread_event_queue.h" | 5 #include "content/renderer/input/main_thread_event_queue.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "content/common/input/event_with_latency_info.h" | 8 #include "content/common/input/event_with_latency_info.h" |
| 9 #include "content/common/input_messages.h" | 9 #include "content/common/input_messages.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 // The maximum number of post-coalesced events processed per rAF task. 10 was | 15 // The maximum number of post-coalesced events processed per rAF task. 10 was |
| 16 // chosen because it really should never be hit yet prevents an infinite loop if | 16 // chosen because it really should never be hit yet prevents an infinite loop if |
| 17 // the compositor keeps delivering events faster than the main thread can | 17 // the compositor keeps delivering events faster than the main thread can |
| 18 // process them. | 18 // process them. |
| 19 const size_t kMaxEventsPerRafTask = 10; | 19 const size_t kMaxEventsPerRafTask = 10; |
| 20 | 20 |
| 21 const size_t kTenSeconds = 10 * 1000 * 1000; | 21 const size_t kTenSeconds = 10 * 1000 * 1000; |
| 22 | 22 |
| 23 bool isContinuousEvent(const std::unique_ptr<EventWithDispatchType>& event) { | 23 bool isContinuousEvent(const std::unique_ptr<EventWithDispatchType>& event) { |
| 24 switch (event->event().type) { | 24 switch (event->event().type) { |
| 25 case blink::WebInputEvent::MouseMove: | 25 case blink::WebInputEvent::MouseMove: |
| 26 case blink::WebInputEvent::TouchMove: | |
| 27 case blink::WebInputEvent::MouseWheel: | 26 case blink::WebInputEvent::MouseWheel: |
| 28 return true; | 27 return true; |
| 28 case blink::WebInputEvent::TouchMove: | |
|
tdresser
2016/08/31 13:23:49
Add a comment on why we're considering blocking to
| |
| 29 return static_cast<const blink::WebTouchEvent&>(event->event()) | |
| 30 .dispatchType != blink::WebInputEvent::Blocking; | |
| 29 default: | 31 default: |
| 30 return false; | 32 return false; |
| 31 } | 33 } |
| 32 } | 34 } |
| 33 | 35 |
| 34 } // namespace | 36 } // namespace |
| 35 | 37 |
| 36 EventWithDispatchType::EventWithDispatchType( | 38 EventWithDispatchType::EventWithDispatchType( |
| 37 ui::ScopedWebInputEvent event, | 39 ui::ScopedWebInputEvent event, |
| 38 const ui::LatencyInfo& latency, | 40 const ui::LatencyInfo& latency, |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 } | 281 } |
| 280 } | 282 } |
| 281 } | 283 } |
| 282 for (size_t i = 0; i < send_notification_count; ++i) | 284 for (size_t i = 0; i < send_notification_count; ++i) |
| 283 SendEventNotificationToMainThread(); | 285 SendEventNotificationToMainThread(); |
| 284 if (needs_main_frame) | 286 if (needs_main_frame) |
| 285 client_->NeedsMainFrame(routing_id_); | 287 client_->NeedsMainFrame(routing_id_); |
| 286 } | 288 } |
| 287 | 289 |
| 288 } // namespace content | 290 } // namespace content |
| OLD | NEW |