OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "content/browser/renderer_host/input/input_ack_handler.h" | 7 #include "content/browser/renderer_host/input/input_ack_handler.h" |
8 #include "content/browser/renderer_host/input/input_router_client.h" | 8 #include "content/browser/renderer_host/input/input_router_client.h" |
9 #include "content/browser/renderer_host/input/input_router_impl.h" | 9 #include "content/browser/renderer_host/input/input_router_impl.h" |
10 #include "content/common/input/web_input_event_traits.h" | 10 #include "content/common/input/web_input_event_traits.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 sent_count_ = 0; | 102 sent_count_ = 0; |
103 return message_count; | 103 return message_count; |
104 } | 104 } |
105 | 105 |
106 bool HasMessages() const { return sent_count_ > 0; } | 106 bool HasMessages() const { return sent_count_ > 0; } |
107 | 107 |
108 private: | 108 private: |
109 size_t sent_count_; | 109 size_t sent_count_; |
110 }; | 110 }; |
111 | 111 |
112 // TODO(jdduke): Use synthetic gesture pipeline, crbug.com/344598. | |
113 typedef std::vector<WebGestureEvent> Gestures; | 112 typedef std::vector<WebGestureEvent> Gestures; |
114 Gestures BuildScrollSequence(size_t steps, | 113 Gestures BuildScrollSequence(size_t steps, |
115 const gfx::Vector2dF& origin, | 114 const gfx::Vector2dF& origin, |
116 const gfx::Vector2dF& distance) { | 115 const gfx::Vector2dF& distance) { |
117 Gestures gestures; | 116 Gestures gestures; |
118 const gfx::Vector2dF delta = ScaleVector2d(distance, 1.f / steps); | 117 const gfx::Vector2dF delta = ScaleVector2d(distance, 1.f / steps); |
119 | 118 |
120 WebGestureEvent gesture; | 119 WebGestureEvent gesture; |
121 gesture.type = WebInputEvent::GestureScrollBegin; | 120 gesture.type = WebInputEvent::GestureScrollBegin; |
122 gesture.x = origin.x(); | 121 gesture.x = origin.x(); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 | 260 |
262 ui::LatencyInfo CreateLatencyInfo() { | 261 ui::LatencyInfo CreateLatencyInfo() { |
263 ui::LatencyInfo latency; | 262 ui::LatencyInfo latency; |
264 latency.AddLatencyNumber( | 263 latency.AddLatencyNumber( |
265 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT, 1, 0); | 264 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT, 1, 0); |
266 latency.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 1, | 265 latency.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 1, |
267 NextLatencyID()); | 266 NextLatencyID()); |
268 return latency; | 267 return latency; |
269 } | 268 } |
270 | 269 |
271 // TODO(jdduke): Use synthetic gesture pipeline, crbug.com/344598. | |
272 template <typename EventType> | 270 template <typename EventType> |
273 void SimulateEventSequence(const char* test_name, | 271 void SimulateEventSequence(const char* test_name, |
274 const std::vector<EventType>& events, | 272 const std::vector<EventType>& events, |
275 bool ack_delay, | 273 bool ack_delay, |
276 size_t iterations) { | 274 size_t iterations) { |
277 OnHasTouchEventHandlers(true); | 275 OnHasTouchEventHandlers(true); |
278 | 276 |
279 const size_t event_count = events.size(); | 277 const size_t event_count = events.size(); |
280 const size_t total_event_count = event_count * iterations; | 278 const size_t total_event_count = event_count * iterations; |
281 | 279 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 | 376 |
379 TEST_F(InputRouterImplPerfTest, TouchSwipeToGestureScroll) { | 377 TEST_F(InputRouterImplPerfTest, TouchSwipeToGestureScroll) { |
380 SimulateTouchAndScrollEventSequence("TouchSwipeToGestureScroll ", | 378 SimulateTouchAndScrollEventSequence("TouchSwipeToGestureScroll ", |
381 kDefaultSteps, | 379 kDefaultSteps, |
382 kDefaultOrigin, | 380 kDefaultOrigin, |
383 kDefaultDistance, | 381 kDefaultDistance, |
384 kDefaultIterations); | 382 kDefaultIterations); |
385 } | 383 } |
386 | 384 |
387 } // namespace content | 385 } // namespace content |
OLD | NEW |