DescriptionIndexed DB: Simplify cursor iteration logic
The internal logic for cursor iteration in Continue()
needs to handle four cases: "next", "nextunique", "prev",
"prevunique". This was handled in a single function with a
single loop and hairy `if (forwards) {} else {}` and `if
(unique) {}` clauses, which made understanding and
extending it difficult.
This CL splits the function into two cases: ContinueNext()
for "next"/"nextunique" cursors and ContinuePrevious() for
"prev"/"prevunique" cursors, which greatly simplifies the
logic for each.
The "prevunique" case is particularly complex, since the
spec requires that the first duplicate (in index order) is
returned rather than the last (the one encountered first
when iterating backwards). This was previously done by
iterating further then reversing, all within the same
loop. Now, this case is handled by a subsequent loop.
BUG=497454
R=cmumford@chromium.org
Committed: https://crrev.com/1f54336fed5113fc440658d2a8465ae7a4d9a02c
Cr-Commit-Position: refs/heads/master@{#333780}
Patch Set 1 #
Total comments: 20
Patch Set 2 : Review feedback and comments #
Messages
Total messages: 11 (3 generated)
|