Indexed 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 Review URL: https://codereview.chromium.org/1170833004 Cr-Commit-Position: refs/heads/master@{#333780}
Showing
Please register or sign in to comment