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

Unified Diff: components/browsing_data/core/counters/autofill_counter.cc

Issue 2555373007: In case of an error in AutofillCounter's queries, do not crash. (Closed)
Patch Set: rev Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/browsing_data/core/counters/autofill_counter.cc
diff --git a/components/browsing_data/core/counters/autofill_counter.cc b/components/browsing_data/core/counters/autofill_counter.cc
index a852db41549344abd96c50f54d186ca9a06272d9..b0e55d0f7a60e7d18cdd146243487a7c163dceb1 100644
--- a/components/browsing_data/core/counters/autofill_counter.cc
+++ b/components/browsing_data/core/counters/autofill_counter.cc
@@ -81,7 +81,20 @@ void AutofillCounter::OnWebDataServiceRequestDone(
WebDataServiceBase::Handle handle,
std::unique_ptr<WDTypedResult> result) {
DCHECK(thread_checker_.CalledOnValidThread());
+
if (!result) {
+ // CancelAllRequests will cancel all queries that are active; the query that
+ // just failed is complete and cannot be canceled so zero it out.
+ if (handle == suggestions_query_) {
+ suggestions_query_ = 0;
+ } else if (handle == credit_cards_query_) {
+ credit_cards_query_ = 0;
+ } else if (handle == addresses_query_) {
+ addresses_query_ = 0;
+ } else {
+ NOTREACHED();
+ }
+
CancelAllRequests();
return;
}
« 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