Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: ui/events/gestures/gesture_recognizer_impl.cc

Issue 466323004: The GestureRecognizer should never map an ID to a NULL consumer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/gestures/gesture_recognizer_impl.h" 5 #include "ui/events/gestures/gesture_recognizer_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 // Checks if this finger is already down, if so, returns the current target. 81 // Checks if this finger is already down, if so, returns the current target.
82 // Otherwise, returns NULL. 82 // Otherwise, returns NULL.
83 GestureConsumer* GestureRecognizerImpl::GetTouchLockedTarget( 83 GestureConsumer* GestureRecognizerImpl::GetTouchLockedTarget(
84 const TouchEvent& event) { 84 const TouchEvent& event) {
85 return touch_id_target_[event.touch_id()]; 85 return touch_id_target_[event.touch_id()];
86 } 86 }
87 87
88 GestureConsumer* GestureRecognizerImpl::GetTargetForGestureEvent( 88 GestureConsumer* GestureRecognizerImpl::GetTargetForGestureEvent(
89 const GestureEvent& event) { 89 const GestureEvent& event) {
90 GestureConsumer* target = NULL;
91 int touch_id = event.details().oldest_touch_id(); 90 int touch_id = event.details().oldest_touch_id();
92 target = touch_id_target_for_gestures_[touch_id]; 91 if (!touch_id_target_for_gestures_.count(touch_id)) {
93 return target; 92 NOTREACHED() << "Touch ID does not map to a valid GestureConsumer.";
tdanderson 2014/08/13 15:48:00 Running this through the trybots to see if anythin
93 return NULL;
94 }
95
96 return touch_id_target_for_gestures_.at(touch_id);
94 } 97 }
95 98
96 GestureConsumer* GestureRecognizerImpl::GetTargetForLocation( 99 GestureConsumer* GestureRecognizerImpl::GetTargetForLocation(
97 const gfx::PointF& location, int source_device_id) { 100 const gfx::PointF& location, int source_device_id) {
98 const int max_distance = 101 const int max_distance =
99 GestureConfiguration::max_separation_for_gesture_touches_in_pixels(); 102 GestureConfiguration::max_separation_for_gesture_touches_in_pixels();
100 103
101 if (!use_unified_gesture_detector_) { 104 if (!use_unified_gesture_detector_) {
102 const GesturePoint* closest_point = NULL; 105 const GesturePoint* closest_point = NULL;
103 int64 closest_distance_squared = 0; 106 int64 closest_distance_squared = 0;
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 std::vector<GestureEventHelper*>::iterator it; 423 std::vector<GestureEventHelper*>::iterator it;
421 for (it = helpers.begin(); it != helpers.end(); ++it) 424 for (it = helpers.begin(); it != helpers.end(); ++it)
422 gesture_recognizer->AddGestureEventHelper(*it); 425 gesture_recognizer->AddGestureEventHelper(*it);
423 426
424 helpers.clear(); 427 helpers.clear();
425 g_gesture_recognizer_instance = 428 g_gesture_recognizer_instance =
426 static_cast<GestureRecognizerImpl*>(gesture_recognizer); 429 static_cast<GestureRecognizerImpl*>(gesture_recognizer);
427 } 430 }
428 431
429 } // namespace ui 432 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698