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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_popup_model.cc

Issue 342112: Try to add more sanity checking to help track down a crash.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/browser/autocomplete/autocomplete_popup_model.h" 5 #include "chrome/browser/autocomplete/autocomplete_popup_model.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/browser/autocomplete/autocomplete_edit.h" 8 #include "chrome/browser/autocomplete/autocomplete_edit.h"
9 #include "chrome/browser/autocomplete/autocomplete_popup_view.h" 9 #include "chrome/browser/autocomplete/autocomplete_popup_view.h"
10 #include "chrome/browser/profile.h" 10 #include "chrome/browser/profile.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // The query isn't running, so the standard result set can't possibly be out 168 // The query isn't running, so the standard result set can't possibly be out
169 // of date. 169 // of date.
170 // 170 //
171 // NOTE: In practice, it should actually be safe to use 171 // NOTE: In practice, it should actually be safe to use
172 // controller_->latest_result() here too, since the controller keeps that 172 // controller_->latest_result() here too, since the controller keeps that
173 // up-to-date. However we generally try to avoid referring to that. 173 // up-to-date. However we generally try to avoid referring to that.
174 result = &controller_->result(); 174 result = &controller_->result();
175 // If there are no results, the popup should be closed (so we should have 175 // If there are no results, the popup should be closed (so we should have
176 // failed the CHECK above), and URLsForDefaultMatch() should have been 176 // failed the CHECK above), and URLsForDefaultMatch() should have been
177 // called instead. 177 // called instead.
178 CHECK(!result->empty()); 178 if (result->empty()) {
179 // We're going to checkfail, but first see whether
180 // controller_->latest_result() is actually in sync with |result|.
181 CHECK(controller_->latest_result().empty());
182 CHECK(FALSE);
sky 2009/11/04 00:27:47 nit: FALSE -> false
183 }
179 CHECK(selected_line_ < result->size()); 184 CHECK(selected_line_ < result->size());
180 match = result->begin() + selected_line_; 185 match = result->begin() + selected_line_;
181 } 186 }
182 if (transition) 187 if (transition)
183 *transition = match->transition; 188 *transition = match->transition;
184 if (is_history_what_you_typed_match) 189 if (is_history_what_you_typed_match)
185 *is_history_what_you_typed_match = match->is_history_what_you_typed_match; 190 *is_history_what_you_typed_match = match->is_history_what_you_typed_match;
186 if (alternate_nav_url && manually_selected_match_.empty()) 191 if (alternate_nav_url && manually_selected_match_.empty())
187 *alternate_nav_url = result->alternate_nav_url(); 192 *alternate_nav_url = result->alternate_nav_url();
188 return match->destination_url; 193 return match->destination_url;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // There had better not be a nonempty result set with no default match. 283 // There had better not be a nonempty result set with no default match.
279 CHECK((selected_line_ != kNoMatch) || result->empty()); 284 CHECK((selected_line_ != kNoMatch) || result->empty());
280 // If we're going to trim the window size to no longer include the hovered 285 // If we're going to trim the window size to no longer include the hovered
281 // line, turn hover off. Practically, this shouldn't happen, but it 286 // line, turn hover off. Practically, this shouldn't happen, but it
282 // doesn't hurt to be defensive. 287 // doesn't hurt to be defensive.
283 if ((hovered_line_ != kNoMatch) && (result->size() <= hovered_line_)) 288 if ((hovered_line_ != kNoMatch) && (result->size() <= hovered_line_))
284 SetHoveredLine(kNoMatch); 289 SetHoveredLine(kNoMatch);
285 290
286 view_->UpdatePopupAppearance(); 291 view_->UpdatePopupAppearance();
287 } 292 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698