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 23 matching lines...) Expand all Loading... | |
34 const ui::LatencyInfo& latency, | 34 const ui::LatencyInfo& latency, |
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) { |
tdresser
2017/02/22 15:53:47
This method doesn't make it super clear whether yo
dtapuska
2017/02/22 18:43:48
The ScopedWebInputEventWithLatencyInfo already DCH
| |
45 if (other.dispatch_type_ == DISPATCH_TYPE_BLOCKING) { | 45 if (dispatch_type_ == DISPATCH_TYPE_BLOCKING) { |
46 blocking_coalesced_event_ids_.push_back( | 46 blocking_coalesced_event_ids_.push_back( |
47 ui::WebInputEventTraits::GetUniqueTouchEventId(other.event())); | 47 ui::WebInputEventTraits::GetUniqueTouchEventId(event())); |
48 } else { | 48 } else { |
49 non_blocking_coalesced_count_++; | 49 non_blocking_coalesced_count_++; |
50 } | 50 } |
51 ScopedWebInputEventWithLatencyInfo::CoalesceWith(other); | 51 ScopedWebInputEventWithLatencyInfo::CoalesceWith(other); |
52 dispatch_type_ = other.dispatch_type_; | |
52 last_coalesced_timestamp_ = base::TimeTicks::Now(); | 53 last_coalesced_timestamp_ = base::TimeTicks::Now(); |
53 } | 54 } |
54 | 55 |
55 MainThreadEventQueue::SharedState::SharedState() | 56 MainThreadEventQueue::SharedState::SharedState() |
56 : sent_main_frame_request_(false) {} | 57 : sent_main_frame_request_(false) {} |
57 | 58 |
58 MainThreadEventQueue::SharedState::~SharedState() {} | 59 MainThreadEventQueue::SharedState::~SharedState() {} |
59 | 60 |
60 MainThreadEventQueue::MainThreadEventQueue( | 61 MainThreadEventQueue::MainThreadEventQueue( |
61 int routing_id, | 62 int routing_id, |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
358 case blink::WebInputEvent::MouseWheel: | 359 case blink::WebInputEvent::MouseWheel: |
359 return handle_raf_aligned_mouse_input_; | 360 return handle_raf_aligned_mouse_input_; |
360 case blink::WebInputEvent::TouchMove: | 361 case blink::WebInputEvent::TouchMove: |
361 return handle_raf_aligned_touch_input_; | 362 return handle_raf_aligned_touch_input_; |
362 default: | 363 default: |
363 return false; | 364 return false; |
364 } | 365 } |
365 } | 366 } |
366 | 367 |
367 } // namespace content | 368 } // namespace content |
OLD | NEW |