Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ui/events/blink/input_handler_proxy.h" | 5 #include "ui/events/blink/input_handler_proxy.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 549 | 549 |
| 550 if (device != blink::WebGestureDeviceTouchpad && | 550 if (device != blink::WebGestureDeviceTouchpad && |
| 551 device != blink::WebGestureDeviceTouchscreen) { | 551 device != blink::WebGestureDeviceTouchscreen) { |
| 552 return; | 552 return; |
| 553 } | 553 } |
| 554 | 554 |
| 555 // UMA_HISTOGRAM_ENUMERATION requires that the enum_max must be strictly | 555 // UMA_HISTOGRAM_ENUMERATION requires that the enum_max must be strictly |
| 556 // greater than the sample value. kMainThreadScrollingReasonCount doesn't | 556 // greater than the sample value. kMainThreadScrollingReasonCount doesn't |
| 557 // include the NotScrollingOnMain enum but the histograms do so adding | 557 // include the NotScrollingOnMain enum but the histograms do so adding |
| 558 // the +1 is necessary. | 558 // the +1 is necessary. |
| 559 // Here we only record NotScrollingOnMain. The actual main thread scrolling | |
| 560 // reasons are recorded in blink::ScrollManager. | |
| 559 uint32_t mainThreadScrollingReasonEnumMax = | 561 uint32_t mainThreadScrollingReasonEnumMax = |
| 560 cc::MainThreadScrollingReason::kMainThreadScrollingReasonCount + 1; | 562 cc::MainThreadScrollingReason::kMainThreadScrollingReasonCount + 1; |
| 561 if (reasons == cc::MainThreadScrollingReason::kNotScrollingOnMain) { | 563 if (reasons == cc::MainThreadScrollingReason::kNotScrollingOnMain) { |
| 562 if (device == blink::WebGestureDeviceTouchscreen) { | 564 if (device == blink::WebGestureDeviceTouchscreen) { |
| 563 UMA_HISTOGRAM_ENUMERATION( | 565 UMA_HISTOGRAM_ENUMERATION( |
| 564 kGestureHistogramName, | 566 kGestureHistogramName, |
| 565 cc::MainThreadScrollingReason::kNotScrollingOnMain, | 567 cc::MainThreadScrollingReason::kNotScrollingOnMain, |
| 566 mainThreadScrollingReasonEnumMax); | 568 mainThreadScrollingReasonEnumMax); |
| 567 } else { | 569 } else { |
| 568 UMA_HISTOGRAM_ENUMERATION( | 570 UMA_HISTOGRAM_ENUMERATION( |
| 569 kWheelHistogramName, | 571 kWheelHistogramName, |
| 570 cc::MainThreadScrollingReason::kNotScrollingOnMain, | 572 cc::MainThreadScrollingReason::kNotScrollingOnMain, |
| 571 mainThreadScrollingReasonEnumMax); | 573 mainThreadScrollingReasonEnumMax); |
| 572 } | 574 } |
| 573 } | 575 } |
| 574 | |
| 575 for (uint32_t i = 0; | |
|
bokan
2017/03/24 17:55:55
Sorry, on second thought, we shouldn't remove this
yigu
2017/03/27 21:02:08
Done.
| |
| 576 i < cc::MainThreadScrollingReason::kMainThreadScrollingReasonCount; | |
| 577 ++i) { | |
| 578 unsigned val = 1 << i; | |
| 579 if (reasons & val) { | |
| 580 if (val == cc::MainThreadScrollingReason::kHandlingScrollFromMainThread) { | |
| 581 // We only want to record "Handling scroll from main thread" reason if | |
| 582 // it's the only reason. If it's not the only reason, the "real" reason | |
| 583 // for scrolling on main is something else, and we only want to pay | |
| 584 // attention to that reason. | |
| 585 if (reasons & ~val) | |
| 586 continue; | |
| 587 } | |
| 588 if (device == blink::WebGestureDeviceTouchscreen) { | |
| 589 UMA_HISTOGRAM_ENUMERATION(kGestureHistogramName, i + 1, | |
| 590 mainThreadScrollingReasonEnumMax); | |
| 591 } else { | |
| 592 UMA_HISTOGRAM_ENUMERATION(kWheelHistogramName, i + 1, | |
| 593 mainThreadScrollingReasonEnumMax); | |
| 594 } | |
| 595 } | |
| 596 } | |
| 597 } | 576 } |
| 598 | 577 |
| 599 void InputHandlerProxy::RecordScrollingThreadStatus( | 578 void InputHandlerProxy::RecordScrollingThreadStatus( |
| 600 blink::WebGestureDevice device, | 579 blink::WebGestureDevice device, |
| 601 uint32_t reasons) { | 580 uint32_t reasons) { |
| 602 DCHECK(device == blink::WebGestureDeviceTouchpad || | 581 DCHECK(device == blink::WebGestureDeviceTouchpad || |
| 603 device == blink::WebGestureDeviceTouchscreen); | 582 device == blink::WebGestureDeviceTouchscreen); |
| 604 | 583 |
| 605 if (device != blink::WebGestureDeviceTouchpad && | 584 if (device != blink::WebGestureDeviceTouchpad && |
| 606 device != blink::WebGestureDeviceTouchscreen) { | 585 device != blink::WebGestureDeviceTouchscreen) { |
| (...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1616 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, | 1595 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, |
| 1617 scroll_result)); | 1596 scroll_result)); |
| 1618 } | 1597 } |
| 1619 | 1598 |
| 1620 void InputHandlerProxy::SetTickClockForTesting( | 1599 void InputHandlerProxy::SetTickClockForTesting( |
| 1621 std::unique_ptr<base::TickClock> tick_clock) { | 1600 std::unique_ptr<base::TickClock> tick_clock) { |
| 1622 tick_clock_ = std::move(tick_clock); | 1601 tick_clock_ = std::move(tick_clock); |
| 1623 } | 1602 } |
| 1624 | 1603 |
| 1625 } // namespace ui | 1604 } // namespace ui |
| OLD | NEW |