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

Unified Diff: components/omnibox/browser/url_index_private_data.cc

Issue 2776793002: Make flat containers stable, allow constructing from vector. (Closed)
Patch Set: Merge Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: components/omnibox/browser/url_index_private_data.cc
diff --git a/components/omnibox/browser/url_index_private_data.cc b/components/omnibox/browser/url_index_private_data.cc
index f7baf3417f1c23b0e06029d6a6f1460403979eeb..e328464200c555e7ca85bdf31f73a490df0b8375 100644
--- a/components/omnibox/browser/url_index_private_data.cc
+++ b/components/omnibox/browser/url_index_private_data.cc
@@ -604,7 +604,8 @@ HistoryIDSet URLIndexPrivateData::HistoryIDsForTerm(
word_history_id_set.end());
}
}
- HistoryIDSet history_id_set(buffer.begin(), buffer.end());
+ HistoryIDSet history_id_set(buffer.begin(), buffer.end(),
+ base::KEEP_FIRST_OF_DUPES);
// Record a new cache entry for this word if the term is longer than
// a single character.
@@ -1094,7 +1095,8 @@ bool URLIndexPrivateData::RestoreCharWordMap(
return false;
base::char16 uni_char = static_cast<base::char16>(entry.char_16());
const RepeatedField<int32_t>& word_ids = entry.word_id();
- char_word_map_[uni_char] = {word_ids.begin(), word_ids.end()};
+ char_word_map_[uni_char] =
+ WordIDSet(word_ids.begin(), word_ids.end(), base::KEEP_FIRST_OF_DUPES);
}
return true;
}
@@ -1115,7 +1117,8 @@ bool URLIndexPrivateData::RestoreWordIDHistoryMap(
return false;
WordID word_id = entry.word_id();
const RepeatedField<int64_t>& history_ids = entry.history_id();
- word_id_history_map_[word_id] = {history_ids.begin(), history_ids.end()};
+ word_id_history_map_[word_id] = HistoryIDSet(
+ history_ids.begin(), history_ids.end(), base::KEEP_FIRST_OF_DUPES);
for (HistoryID history_id : history_ids)
history_id_word_map_[history_id].insert(word_id);
}

Powered by Google App Engine
This is Rietveld 408576698