| 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/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "content/common/input/event_with_latency_info.h" | 10 #include "content/common/input/event_with_latency_info.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 InputEventDispatchType dispatch_type) | 35 InputEventDispatchType dispatch_type) |
| 36 : ScopedWebInputEventWithLatencyInfo(std::move(event), latency), | 36 : ScopedWebInputEventWithLatencyInfo(std::move(event), latency), |
| 37 dispatch_type_(dispatch_type), | 37 dispatch_type_(dispatch_type), |
| 38 non_blocking_coalesced_count_(0), | 38 non_blocking_coalesced_count_(0), |
| 39 creation_timestamp_(base::TimeTicks::Now()), | 39 creation_timestamp_(base::TimeTicks::Now()), |
| 40 last_coalesced_timestamp_(creation_timestamp_) {} | 40 last_coalesced_timestamp_(creation_timestamp_) {} |
| 41 | 41 |
| 42 EventWithDispatchType::~EventWithDispatchType() {} | 42 EventWithDispatchType::~EventWithDispatchType() {} |
| 43 | 43 |
| 44 void EventWithDispatchType::CoalesceWith(const EventWithDispatchType& other) { | 44 void EventWithDispatchType::CoalesceWith(const EventWithDispatchType& other) { |
| 45 if (other.dispatch_type_ == DISPATCH_TYPE_BLOCKING) { | 45 // If this event was blocking push the event id to the blocking |
| 46 // list before updating the dispatch_type of this event. |
| 47 if (dispatch_type_ == DISPATCH_TYPE_BLOCKING) { |
| 46 blocking_coalesced_event_ids_.push_back( | 48 blocking_coalesced_event_ids_.push_back( |
| 47 ui::WebInputEventTraits::GetUniqueTouchEventId(other.event())); | 49 ui::WebInputEventTraits::GetUniqueTouchEventId(event())); |
| 48 } else { | 50 } else { |
| 49 non_blocking_coalesced_count_++; | 51 non_blocking_coalesced_count_++; |
| 50 } | 52 } |
| 51 ScopedWebInputEventWithLatencyInfo::CoalesceWith(other); | 53 ScopedWebInputEventWithLatencyInfo::CoalesceWith(other); |
| 54 dispatch_type_ = other.dispatch_type_; |
| 52 last_coalesced_timestamp_ = base::TimeTicks::Now(); | 55 last_coalesced_timestamp_ = base::TimeTicks::Now(); |
| 53 } | 56 } |
| 54 | 57 |
| 55 MainThreadEventQueue::SharedState::SharedState() | 58 MainThreadEventQueue::SharedState::SharedState() |
| 56 : sent_main_frame_request_(false) {} | 59 : sent_main_frame_request_(false) {} |
| 57 | 60 |
| 58 MainThreadEventQueue::SharedState::~SharedState() {} | 61 MainThreadEventQueue::SharedState::~SharedState() {} |
| 59 | 62 |
| 60 MainThreadEventQueue::MainThreadEventQueue( | 63 MainThreadEventQueue::MainThreadEventQueue( |
| 61 int routing_id, | 64 int routing_id, |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 case blink::WebInputEvent::MouseWheel: | 361 case blink::WebInputEvent::MouseWheel: |
| 359 return handle_raf_aligned_mouse_input_; | 362 return handle_raf_aligned_mouse_input_; |
| 360 case blink::WebInputEvent::TouchMove: | 363 case blink::WebInputEvent::TouchMove: |
| 361 return handle_raf_aligned_touch_input_; | 364 return handle_raf_aligned_touch_input_; |
| 362 default: | 365 default: |
| 363 return false; | 366 return false; |
| 364 } | 367 } |
| 365 } | 368 } |
| 366 | 369 |
| 367 } // namespace content | 370 } // namespace content |
| OLD | NEW |