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

Issue 955443002: Replace open-coded binary search in TextTrackCueList::add with upper_bound (Closed)

Created:
5 years, 10 months ago by fs
Modified:
5 years, 10 months ago
Reviewers:
philipj_slow
CC:
blink-reviews, nessy, gasubic, fs, eric.carlson_apple.com, blink-reviews-html_chromium.org, dglazkov+blink, vcarbune.chromium
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

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 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=190908

Patch Set 1 #

Total comments: 16

Patch Set 2 : More FIXMEs; Update URL; Drop returned bool. #

Patch Set 3 : Re-add add() in updateCueIndex. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+37 lines, -29 lines) Patch
M Source/core/html/track/TextTrackCueList.h View 1 1 chunk +2 lines, -2 lines 0 comments Download
M Source/core/html/track/TextTrackCueList.cpp View 1 2 4 chunks +35 lines, -27 lines 0 comments Download

Messages

Total messages: 13 (2 generated)
fs
5 years, 10 months ago (2015-02-23 21:39:27 UTC) #2
philipj_slow
https://codereview.chromium.org/955443002/diff/1/Source/core/html/track/TextTrackCueList.cpp File Source/core/html/track/TextTrackCueList.cpp (right): https://codereview.chromium.org/955443002/diff/1/Source/core/html/track/TextTrackCueList.cpp#newcode85 Source/core/html/track/TextTrackCueList.cpp:85: // http://www.whatwg.org/specs/web-apps/current-work/#text-track-cue-order https://html.spec.whatwg.org/#text-track-cue-order https://codereview.chromium.org/955443002/diff/1/Source/core/html/track/TextTrackCueList.cpp#newcode123 Source/core/html/track/TextTrackCueList.cpp:123: bool TextTrackCueList::updateCueIndex(TextTrackCue* cue) Here ...
5 years, 10 months ago (2015-02-25 02:28:40 UTC) #3
fs
https://codereview.chromium.org/955443002/diff/1/Source/core/html/track/TextTrackCueList.cpp File Source/core/html/track/TextTrackCueList.cpp (right): https://codereview.chromium.org/955443002/diff/1/Source/core/html/track/TextTrackCueList.cpp#newcode123 Source/core/html/track/TextTrackCueList.cpp:123: bool TextTrackCueList::updateCueIndex(TextTrackCue* cue) On 2015/02/25 02:28:40, philipj_UTC7 wrote: > ...
5 years, 10 months ago (2015-02-25 13:09:49 UTC) #4
philipj_slow
I think this will be OK with the return value dropped given your future ambitions ...
5 years, 10 months ago (2015-02-25 15:38:54 UTC) #5
fs
https://codereview.chromium.org/955443002/diff/1/Source/core/html/track/TextTrackCueList.cpp File Source/core/html/track/TextTrackCueList.cpp (right): https://codereview.chromium.org/955443002/diff/1/Source/core/html/track/TextTrackCueList.cpp#newcode85 Source/core/html/track/TextTrackCueList.cpp:85: // http://www.whatwg.org/specs/web-apps/current-work/#text-track-cue-order On 2015/02/25 02:28:40, philipj_UTC7 wrote: > https://html.spec.whatwg.org/#text-track-cue-order ...
5 years, 10 months ago (2015-02-25 16:39:49 UTC) #6
philipj_slow
https://codereview.chromium.org/955443002/diff/1/Source/core/html/track/TextTrackCueList.cpp File Source/core/html/track/TextTrackCueList.cpp (right): https://codereview.chromium.org/955443002/diff/1/Source/core/html/track/TextTrackCueList.cpp#newcode123 Source/core/html/track/TextTrackCueList.cpp:123: bool TextTrackCueList::updateCueIndex(TextTrackCue* cue) On 2015/02/25 16:39:49, fs wrote: > ...
5 years, 10 months ago (2015-02-26 01:54:34 UTC) #7
fs
https://codereview.chromium.org/955443002/diff/1/Source/core/html/track/TextTrackCueList.cpp File Source/core/html/track/TextTrackCueList.cpp (right): https://codereview.chromium.org/955443002/diff/1/Source/core/html/track/TextTrackCueList.cpp#newcode123 Source/core/html/track/TextTrackCueList.cpp:123: bool TextTrackCueList::updateCueIndex(TextTrackCue* cue) On 2015/02/26 01:54:34, philipj_UTC7 wrote: > ...
5 years, 10 months ago (2015-02-26 09:37:57 UTC) #8
fs
https://codereview.chromium.org/955443002/diff/1/Source/core/html/track/TextTrackCueList.cpp File Source/core/html/track/TextTrackCueList.cpp (right): https://codereview.chromium.org/955443002/diff/1/Source/core/html/track/TextTrackCueList.cpp#newcode123 Source/core/html/track/TextTrackCueList.cpp:123: bool TextTrackCueList::updateCueIndex(TextTrackCue* cue) On 2015/02/26 09:37:57, fs wrote: > ...
5 years, 10 months ago (2015-02-26 09:43:36 UTC) #9
philipj_slow
On 2015/02/26 09:37:57, fs wrote: > https://codereview.chromium.org/955443002/diff/1/Source/core/html/track/TextTrackCueList.cpp > File Source/core/html/track/TextTrackCueList.cpp (right): > > https://codereview.chromium.org/955443002/diff/1/Source/core/html/track/TextTrackCueList.cpp#newcode123 > ...
5 years, 10 months ago (2015-02-26 10:25:12 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/955443002/40001
5 years, 10 months ago (2015-02-26 10:28:30 UTC) #12
commit-bot: I haz the power
5 years, 10 months ago (2015-02-26 11:14:42 UTC) #13
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as
https://src.chromium.org/viewvc/blink?view=rev&revision=190908

Powered by Google App Engine
This is Rietveld 408576698