Replace open-coded binary search in TextTrackCueList::add with upper_bound

TextTrackCueList::add is implemented as a recursive binary search. This
add() method is used both for adding (new) cues to the list, and to update
the position of a cue in the list after mutation of it.
These two use-cases have slightly different requirement, but it still
makes sense to reuse some parts of it.
Split out the binary search into a method of its own - replacing it with
std::upper_bound - and then call this from add() and updateCueIndex() while
open-coding the actual Vector::insert() and index-cache invalidation.
Add some notes about potential future improvements.

BUG=321654

Review URL: https://codereview.chromium.org/955443002

git-svn-id: svn://svn.chromium.org/blink/trunk@190908 bbb929c8-8fbe-4397-9dbb-9b2b20218538
2 files changed
tree: 2565b17f8859175a64d5a9858668d4545042f1ed
  1. third_party/