| 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 "content/renderer/input/input_handler_proxy.h" | 5 #include "content/renderer/input/input_handler_proxy.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 return; | 125 return; |
| 126 } | 126 } |
| 127 | 127 |
| 128 ui::LatencyInfo::LatencyMap::const_iterator it = | 128 ui::LatencyInfo::LatencyMap::const_iterator it = |
| 129 latency_info.latency_components.find(std::make_pair( | 129 latency_info.latency_components.find(std::make_pair( |
| 130 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0)); | 130 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0)); |
| 131 | 131 |
| 132 if (it == latency_info.latency_components.end()) | 132 if (it == latency_info.latency_components.end()) |
| 133 return; | 133 return; |
| 134 | 134 |
| 135 base::TimeDelta delta = base::TimeTicks::HighResNow() - it->second.event_time; | 135 base::TimeDelta delta = base::TimeTicks::Now() - it->second.event_time; |
| 136 for (size_t i = 0; i < it->second.event_count; ++i) { | 136 for (size_t i = 0; i < it->second.event_count; ++i) { |
| 137 switch (event.type) { | 137 switch (event.type) { |
| 138 case blink::WebInputEvent::GestureScrollBegin: | 138 case blink::WebInputEvent::GestureScrollBegin: |
| 139 UMA_HISTOGRAM_CUSTOM_COUNTS( | 139 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 140 "Event.Latency.RendererImpl.GestureScrollBegin", | 140 "Event.Latency.RendererImpl.GestureScrollBegin", |
| 141 delta.InMicroseconds(), 1, 1000000, 100); | 141 delta.InMicroseconds(), 1, 1000000, 100); |
| 142 break; | 142 break; |
| 143 case blink::WebInputEvent::GestureScrollUpdate: | 143 case blink::WebInputEvent::GestureScrollUpdate: |
| 144 UMA_HISTOGRAM_CUSTOM_COUNTS( | 144 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 145 // So named for historical reasons. | 145 // So named for historical reasons. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 deferred_fling_cancel_time_seconds_(0), | 179 deferred_fling_cancel_time_seconds_(0), |
| 180 #ifndef NDEBUG | 180 #ifndef NDEBUG |
| 181 expect_scroll_update_end_(false), | 181 expect_scroll_update_end_(false), |
| 182 #endif | 182 #endif |
| 183 gesture_scroll_on_impl_thread_(false), | 183 gesture_scroll_on_impl_thread_(false), |
| 184 gesture_pinch_on_impl_thread_(false), | 184 gesture_pinch_on_impl_thread_(false), |
| 185 fling_may_be_active_on_main_thread_(false), | 185 fling_may_be_active_on_main_thread_(false), |
| 186 disallow_horizontal_fling_scroll_(false), | 186 disallow_horizontal_fling_scroll_(false), |
| 187 disallow_vertical_fling_scroll_(false), | 187 disallow_vertical_fling_scroll_(false), |
| 188 has_fling_animation_started_(false), | 188 has_fling_animation_started_(false), |
| 189 uma_latency_reporting_enabled_( | 189 uma_latency_reporting_enabled_(base::TimeTicks::IsHighResolution()) { |
| 190 base::TimeTicks::IsHighResNowFastAndReliable()) { | |
| 191 DCHECK(client); | 190 DCHECK(client); |
| 192 input_handler_->BindToClient(this); | 191 input_handler_->BindToClient(this); |
| 193 smooth_scroll_enabled_ = base::CommandLine::ForCurrentProcess()->HasSwitch( | 192 smooth_scroll_enabled_ = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 194 switches::kEnableSmoothScrolling); | 193 switches::kEnableSmoothScrolling); |
| 195 cc::ScrollElasticityHelper* scroll_elasticity_helper = | 194 cc::ScrollElasticityHelper* scroll_elasticity_helper = |
| 196 input_handler_->CreateScrollElasticityHelper(); | 195 input_handler_->CreateScrollElasticityHelper(); |
| 197 if (scroll_elasticity_helper) { | 196 if (scroll_elasticity_helper) { |
| 198 scroll_elasticity_controller_.reset( | 197 scroll_elasticity_controller_.reset( |
| 199 new InputScrollElasticityController(scroll_elasticity_helper)); | 198 new InputScrollElasticityController(scroll_elasticity_helper)); |
| 200 } | 199 } |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 924 // trigger a scroll, e.g., with a trivial time delta between fling updates. | 923 // trigger a scroll, e.g., with a trivial time delta between fling updates. |
| 925 // Return true in this case to prevent early fling termination. | 924 // Return true in this case to prevent early fling termination. |
| 926 if (std::abs(clipped_increment.width) < kScrollEpsilon && | 925 if (std::abs(clipped_increment.width) < kScrollEpsilon && |
| 927 std::abs(clipped_increment.height) < kScrollEpsilon) | 926 std::abs(clipped_increment.height) < kScrollEpsilon) |
| 928 return true; | 927 return true; |
| 929 | 928 |
| 930 return did_scroll; | 929 return did_scroll; |
| 931 } | 930 } |
| 932 | 931 |
| 933 } // namespace content | 932 } // namespace content |
| OLD | NEW |