-
Tommy Li authored
In the new world where we are no longer uniquifying keywords, and instead tolerating multiple engines with the same keyword (we pretty much have to), it's more convenient for us to use an std::multimap to map keywords to engines rather than use std::map. This is to unblock a few ideas I have: - Currently, to detect conflicts between engines, we traverse through the whole list of TemplateURLs during Add() and Update(). During startup and Sync, when we are adding a bunch of these engines, that makes the whole process O(n^2). I'd like to use this multimap to remove those loops (in a future CL). - Although it SEEMS like we may no longer need to detect conflicts in the new world of tolerating conflicts, that's not true. We still want to remove replaceable conflicting engines, and so we still want to detect them. - I also hope the multimap will enable me to unify and simplify the currently complicated logic that does the removal of replaceable conflicting engines. - Finally, I think the multimap won't be expensive to retrieve the "best" engine for any given keyword, since the typical number of values we linearly go through per keyword is going to be one to three... definitely single digits. Multimaps don't sort on value. These things are going to be in followup CLs that are enabled by the multimap. See also: https://chromium-review.googlesource.com/c/chromium/src/+/2519775 Bug: 1022775 Change-Id: I631ea6c3cf442736273e23fcda15f72095dca28a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2530801 Commit-Queue: Tommy Li <tommycli@chromium.org> Reviewed-by:
Peter Kasting <pkasting@chromium.org> Cr-Commit-Position: refs/heads/master@{#826545}
70e3528f