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

Issue 1170833004: Indexed DB: Simplify cursor iteration logic (Closed)

Created:
5 years, 6 months ago by jsbell
Modified:
5 years, 6 months ago
Reviewers:
cmumford
CC:
chromium-reviews, darin-cc_chromium.org, dgrogan, jsbell+idb_chromium.org, jam, cmumford
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

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 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+177 lines, -70 lines) Patch
M content/browser/indexed_db/indexed_db_backing_store.h View 1 1 chunk +13 lines, -0 lines 0 comments Download
M content/browser/indexed_db/indexed_db_backing_store.cc View 1 3 chunks +164 lines, -70 lines 0 comments Download

Messages

Total messages: 11 (3 generated)
jsbell
cmumford@ - please take a look? https://codereview.chromium.org/1170833004/diff/1/content/browser/indexed_db/indexed_db_backing_store.cc File content/browser/indexed_db/indexed_db_backing_store.cc (right): https://codereview.chromium.org/1170833004/diff/1/content/browser/indexed_db/indexed_db_backing_store.cc#newcode3281 content/browser/indexed_db/indexed_db_backing_store.cc:3281: bool find_first_duplicate = ...
5 years, 6 months ago (2015-06-09 15:47:33 UTC) #1
jsbell
cmumford@ - please take a look? (now actually added you as a reviewer)
5 years, 6 months ago (2015-06-09 15:53:36 UTC) #3
cmumford
lgtm https://codereview.chromium.org/1170833004/diff/1/content/browser/indexed_db/indexed_db_backing_store.cc File content/browser/indexed_db/indexed_db_backing_store.cc (right): https://codereview.chromium.org/1170833004/diff/1/content/browser/indexed_db/indexed_db_backing_store.cc#newcode3207 content/browser/indexed_db/indexed_db_backing_store.cc:3207: // Cursor may be at the next value ...
5 years, 6 months ago (2015-06-09 17:06:24 UTC) #4
jsbell
A few "notes to self" reviewing the code. https://codereview.chromium.org/1170833004/diff/1/content/browser/indexed_db/indexed_db_backing_store.cc File content/browser/indexed_db/indexed_db_backing_store.cc (right): https://codereview.chromium.org/1170833004/diff/1/content/browser/indexed_db/indexed_db_backing_store.cc#newcode3198 content/browser/indexed_db/indexed_db_backing_store.cc:3198: if ...
5 years, 6 months ago (2015-06-09 18:52:19 UTC) #5
jsbell
https://codereview.chromium.org/1170833004/diff/1/content/browser/indexed_db/indexed_db_backing_store.cc File content/browser/indexed_db/indexed_db_backing_store.cc (right): https://codereview.chromium.org/1170833004/diff/1/content/browser/indexed_db/indexed_db_backing_store.cc#newcode3198 content/browser/indexed_db/indexed_db_backing_store.cc:3198: if (next_state == SEEK && key) { On 2015/06/09 ...
5 years, 6 months ago (2015-06-10 17:51:58 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1170833004/20001
5 years, 6 months ago (2015-06-10 18:01:31 UTC) #9
commit-bot: I haz the power
Committed patchset #2 (id:20001)
5 years, 6 months ago (2015-06-10 20:09:18 UTC) #10
commit-bot: I haz the power
5 years, 6 months ago (2015-06-10 20:10:10 UTC) #11
Message was sent while issue was closed.
Patchset 2 (id:??) landed as
https://crrev.com/1f54336fed5113fc440658d2a8465ae7a4d9a02c
Cr-Commit-Position: refs/heads/master@{#333780}

Powered by Google App Engine
This is Rietveld 408576698