| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/gpu/input_handler_proxy.h" | 5 #include "content/renderer/gpu/input_handler_proxy.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "content/renderer/gpu/input_handler_proxy_client.h" | 10 #include "content/renderer/gpu/input_handler_proxy_client.h" |
| 11 #include "third_party/WebKit/public/platform/Platform.h" | 11 #include "third_party/WebKit/public/platform/Platform.h" |
| 12 #include "third_party/WebKit/public/web/WebInputEvent.h" | 12 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 13 #include "ui/events/latency_info.h" | 13 #include "ui/events/latency_info.h" |
| 14 | 14 |
| 15 using WebKit::WebFloatPoint; | 15 using blink::WebFloatPoint; |
| 16 using WebKit::WebFloatSize; | 16 using blink::WebFloatSize; |
| 17 using WebKit::WebGestureEvent; | 17 using blink::WebGestureEvent; |
| 18 using WebKit::WebInputEvent; | 18 using blink::WebInputEvent; |
| 19 using WebKit::WebMouseEvent; | 19 using blink::WebMouseEvent; |
| 20 using WebKit::WebMouseWheelEvent; | 20 using blink::WebMouseWheelEvent; |
| 21 using WebKit::WebPoint; | 21 using blink::WebPoint; |
| 22 using WebKit::WebTouchEvent; | 22 using blink::WebTouchEvent; |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 void SendScrollLatencyUma(const WebInputEvent& event, | 26 void SendScrollLatencyUma(const WebInputEvent& event, |
| 27 const ui::LatencyInfo& latency_info) { | 27 const ui::LatencyInfo& latency_info) { |
| 28 if (!(event.type == WebInputEvent::GestureScrollBegin || | 28 if (!(event.type == WebInputEvent::GestureScrollBegin || |
| 29 event.type == WebInputEvent::GestureScrollUpdate || | 29 event.type == WebInputEvent::GestureScrollUpdate || |
| 30 event.type == WebInputEvent::GestureScrollUpdateWithoutPropagation)) | 30 event.type == WebInputEvent::GestureScrollUpdateWithoutPropagation)) |
| 31 return; | 31 return; |
| 32 | 32 |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 | 256 |
| 257 switch (scroll_status) { | 257 switch (scroll_status) { |
| 258 case cc::InputHandler::ScrollStarted: { | 258 case cc::InputHandler::ScrollStarted: { |
| 259 if (gesture_event.sourceDevice == WebGestureEvent::Touchpad) | 259 if (gesture_event.sourceDevice == WebGestureEvent::Touchpad) |
| 260 input_handler_->ScrollEnd(); | 260 input_handler_->ScrollEnd(); |
| 261 | 261 |
| 262 fling_curve_.reset(client_->CreateFlingAnimationCurve( | 262 fling_curve_.reset(client_->CreateFlingAnimationCurve( |
| 263 gesture_event.sourceDevice, | 263 gesture_event.sourceDevice, |
| 264 WebFloatPoint(gesture_event.data.flingStart.velocityX, | 264 WebFloatPoint(gesture_event.data.flingStart.velocityX, |
| 265 gesture_event.data.flingStart.velocityY), | 265 gesture_event.data.flingStart.velocityY), |
| 266 WebKit::WebSize())); | 266 blink::WebSize())); |
| 267 fling_overscrolled_horizontally_ = false; | 267 fling_overscrolled_horizontally_ = false; |
| 268 fling_overscrolled_vertically_ = false; | 268 fling_overscrolled_vertically_ = false; |
| 269 TRACE_EVENT_ASYNC_BEGIN0( | 269 TRACE_EVENT_ASYNC_BEGIN0( |
| 270 "renderer", | 270 "renderer", |
| 271 "InputHandlerProxy::HandleGestureFling::started", | 271 "InputHandlerProxy::HandleGestureFling::started", |
| 272 this); | 272 this); |
| 273 fling_parameters_.delta = | 273 fling_parameters_.delta = |
| 274 WebFloatPoint(gesture_event.data.flingStart.velocityX, | 274 WebFloatPoint(gesture_event.data.flingStart.velocityX, |
| 275 gesture_event.data.flingStart.velocityY); | 275 gesture_event.data.flingStart.velocityY); |
| 276 fling_parameters_.point = WebPoint(gesture_event.x, gesture_event.y); | 276 fling_parameters_.point = WebPoint(gesture_event.x, gesture_event.y); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 this); | 358 this); |
| 359 } | 359 } |
| 360 | 360 |
| 361 TRACE_EVENT_INSTANT1("renderer", | 361 TRACE_EVENT_INSTANT1("renderer", |
| 362 "InputHandlerProxy::CancelCurrentFling", | 362 "InputHandlerProxy::CancelCurrentFling", |
| 363 TRACE_EVENT_SCOPE_THREAD, | 363 TRACE_EVENT_SCOPE_THREAD, |
| 364 "had_fling_animation", | 364 "had_fling_animation", |
| 365 had_fling_animation); | 365 had_fling_animation); |
| 366 fling_curve_.reset(); | 366 fling_curve_.reset(); |
| 367 gesture_scroll_on_impl_thread_ = false; | 367 gesture_scroll_on_impl_thread_ = false; |
| 368 fling_parameters_ = WebKit::WebActiveWheelFlingParameters(); | 368 fling_parameters_ = blink::WebActiveWheelFlingParameters(); |
| 369 return had_fling_animation; | 369 return had_fling_animation; |
| 370 } | 370 } |
| 371 | 371 |
| 372 bool InputHandlerProxy::TouchpadFlingScroll( | 372 bool InputHandlerProxy::TouchpadFlingScroll( |
| 373 const WebFloatSize& increment) { | 373 const WebFloatSize& increment) { |
| 374 WebMouseWheelEvent synthetic_wheel; | 374 WebMouseWheelEvent synthetic_wheel; |
| 375 synthetic_wheel.type = WebInputEvent::MouseWheel; | 375 synthetic_wheel.type = WebInputEvent::MouseWheel; |
| 376 synthetic_wheel.deltaX = increment.width; | 376 synthetic_wheel.deltaX = increment.width; |
| 377 synthetic_wheel.deltaY = increment.height; | 377 synthetic_wheel.deltaY = increment.height; |
| 378 synthetic_wheel.hasPreciseScrollingDeltas = true; | 378 synthetic_wheel.hasPreciseScrollingDeltas = true; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 TRACE_EVENT2("renderer", | 453 TRACE_EVENT2("renderer", |
| 454 "InputHandlerProxy::notifyCurrentFlingVelocity", | 454 "InputHandlerProxy::notifyCurrentFlingVelocity", |
| 455 "vx", | 455 "vx", |
| 456 velocity.width, | 456 velocity.width, |
| 457 "vy", | 457 "vy", |
| 458 velocity.height); | 458 velocity.height); |
| 459 input_handler_->NotifyCurrentFlingVelocity(ToClientScrollIncrement(velocity)); | 459 input_handler_->NotifyCurrentFlingVelocity(ToClientScrollIncrement(velocity)); |
| 460 } | 460 } |
| 461 | 461 |
| 462 } // namespace content | 462 } // namespace content |
| OLD | NEW |