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

Issue 2525663002: Refactor Reading List Model to use URL as key. (Closed)

Created:
4 years ago by Olivier
Modified:
4 years ago
CC:
chromium-reviews, pkl (ping after 24h if needed), mac-reviews_chromium.org, sdefresne+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Refactor Reading List Model to use URL as key. Here are the new principles for ReadingList model. - Entries are uniquely defined by their URL. All methods to access or alter entries in the model are therefore using URL as key. - All observers callbacks are therefore give the URL of the entry being modified, with the exception of WillAddEntry that takes the whole entry (as it is not yet in the model). A DidAddEntry observer is added if an observer want to do operation on this newly added entry. - Model is now backed up by an unordered_map<GURL, ReadingListEntry>. This will make all operations accessing or updating entries O(1) instead of O(n). - The read/unread status is now in the ReadingListEntry because - most operation on entries are read status independant, so have the read status in the model requires to have two paths for each operations. Having the read status in the entry makes all operations easier - ReadingListEntries in Chrome have always a defined read/unread status - ReadingListEntry now reflect the sync counterpart ReadingListSpecifics. - To display the entries, they must be ordered by UpdateTime. This CL adds a cache that allows to access the entries with GetReadEntryAt(size_t index) and GetUnreadEntryAt(size_t index). This cache will be moved in the ReadingListViewController later - This CL adds dummy methods for downstream compatibility. These will be removed later. BUG=664924 Committed: https://crrev.com/448b3411da25817b84202bff7c37bbc816c4b2b2 Cr-Commit-Position: refs/heads/master@{#435236}

Patch Set 1 #

Patch Set 2 : format #

Total comments: 52

Patch Set 3 : feedback #

Total comments: 59

Patch Set 4 : keep unreadsize #

Patch Set 5 : keep unread_size #

Total comments: 1

Patch Set 6 : typo #

Patch Set 7 : jif feedback #

Total comments: 8

Patch Set 8 : feedback #

Patch Set 9 : fix #

Unified diffs Side-by-side diffs Delta from patch set Stats (+703 lines, -798 lines) Patch
M components/reading_list/ios/reading_list_entry.h View 1 2 3 4 5 6 7 5 chunks +8 lines, -5 lines 0 comments Download
M components/reading_list/ios/reading_list_entry.cc View 1 2 13 chunks +30 lines, -6 lines 0 comments Download
M components/reading_list/ios/reading_list_entry_unittest.cc View 1 2 5 chunks +8 lines, -7 lines 0 comments Download
M components/reading_list/ios/reading_list_model.h View 1 2 3 4 5 6 7 5 chunks +24 lines, -27 lines 0 comments Download
M components/reading_list/ios/reading_list_model_bridge_observer.h View 1 2 3 chunks +16 lines, -24 lines 0 comments Download
M components/reading_list/ios/reading_list_model_bridge_observer.mm View 1 2 2 chunks +21 lines, -42 lines 0 comments Download
M components/reading_list/ios/reading_list_model_impl.h View 1 2 3 4 5 6 7 6 chunks +34 lines, -30 lines 0 comments Download
M components/reading_list/ios/reading_list_model_impl.cc View 1 2 3 4 5 6 7 11 chunks +222 lines, -242 lines 0 comments Download
M components/reading_list/ios/reading_list_model_observer.h View 1 2 3 4 5 6 7 2 chunks +31 lines, -23 lines 0 comments Download
M components/reading_list/ios/reading_list_model_storage.h View 1 2 1 chunk +1 line, -1 line 0 comments Download
M components/reading_list/ios/reading_list_model_unittest.mm View 1 2 3 4 5 6 7 22 chunks +198 lines, -217 lines 0 comments Download
M components/reading_list/ios/reading_list_store.h View 1 2 2 chunks +2 lines, -3 lines 0 comments Download
M components/reading_list/ios/reading_list_store.cc View 1 2 3 4 5 6 7 11 chunks +36 lines, -55 lines 0 comments Download
M components/reading_list/ios/reading_list_store_delegate.h View 1 2 3 4 5 6 7 1 chunk +6 lines, -6 lines 0 comments Download
M components/reading_list/ios/reading_list_store_unittest.mm View 1 2 3 4 5 6 7 9 chunks +21 lines, -17 lines 0 comments Download
M ios/chrome/browser/reading_list/reading_list_download_service.h View 1 2 2 chunks +7 lines, -19 lines 0 comments Download
M ios/chrome/browser/reading_list/reading_list_download_service.cc View 1 2 3 4 5 6 7 8 3 chunks +37 lines, -72 lines 0 comments Download
M ios/chrome/browser/reading_list/reading_list_web_state_observer.mm View 1 2 1 chunk +1 line, -2 lines 0 comments Download

Messages

Total messages: 29 (11 generated)
Olivier
This is not ready for review. Please give your comments on the new APIs.
4 years ago (2016-11-22 17:06:46 UTC) #3
jif-google
thanks, it's much better :) Overall I agree with all your choices. Ping me when ...
4 years ago (2016-11-22 18:21:46 UTC) #5
gambard
Way better! https://codereview.chromium.org/2525663002/diff/20001/ios/chrome/browser/reading_list/reading_list_download_service.cc File ios/chrome/browser/reading_list/reading_list_download_service.cc (right): https://codereview.chromium.org/2525663002/diff/20001/ios/chrome/browser/reading_list/reading_list_download_service.cc#newcode107 ios/chrome/browser/reading_list/reading_list_download_service.cc:107: void ReadingListDownloadService::ScheduleDownloadEntryFromURL(const GURL& url) { Exist only ...
4 years ago (2016-11-23 12:11:07 UTC) #6
Olivier
Thanks. PTAL. This version is downstream compatible. https://codereview.chromium.org/2525663002/diff/20001/ios/chrome/browser/reading_list/reading_list_download_service.cc File ios/chrome/browser/reading_list/reading_list_download_service.cc (right): https://codereview.chromium.org/2525663002/diff/20001/ios/chrome/browser/reading_list/reading_list_download_service.cc#newcode107 ios/chrome/browser/reading_list/reading_list_download_service.cc:107: void ReadingListDownloadService::ScheduleDownloadEntryFromURL(const ...
4 years ago (2016-11-28 14:54:15 UTC) #7
Olivier
4 years ago (2016-11-28 14:55:50 UTC) #10
noyau (Ping after 24h)
https://codereview.chromium.org/2525663002/diff/40001/components/reading_list/ios/reading_list_entry.h File components/reading_list/ios/reading_list_entry.h (right): https://codereview.chromium.org/2525663002/diff/40001/components/reading_list/ios/reading_list_entry.h#newcode35 components/reading_list/ios/reading_list_entry.h:35: std::unordered_map<GURL, ReadingListEntry, GURLHasher>; Why is this here actually? It ...
4 years ago (2016-11-28 15:29:32 UTC) #11
noyau (Ping after 24h)
https://codereview.chromium.org/2525663002/diff/80001/components/reading_list/ios/reading_list_model_unittest.mm File components/reading_list/ios/reading_list_model_unittest.mm (right): https://codereview.chromium.org/2525663002/diff/80001/components/reading_list/ios/reading_list_model_unittest.mm#newcode211 components/reading_list/ios/reading_list_model_unittest.mm:211: DCHECK_EQ(size, morel_->unread_size()); morel?
4 years ago (2016-11-28 15:30:15 UTC) #12
Olivier
https://codereview.chromium.org/2525663002/diff/40001/components/reading_list/ios/reading_list_entry.h File components/reading_list/ios/reading_list_entry.h (right): https://codereview.chromium.org/2525663002/diff/40001/components/reading_list/ios/reading_list_entry.h#newcode35 components/reading_list/ios/reading_list_entry.h:35: std::unordered_map<GURL, ReadingListEntry, GURLHasher>; On 2016/11/28 15:29:31, noyau wrote: > ...
4 years ago (2016-11-28 15:38:10 UTC) #13
Olivier
https://codereview.chromium.org/2525663002/diff/40001/components/reading_list/ios/reading_list_model.h File components/reading_list/ios/reading_list_model.h (right): https://codereview.chromium.org/2525663002/diff/40001/components/reading_list/ios/reading_list_model.h#newcode57 components/reading_list/ios/reading_list_model.h:57: virtual const ReadingListEntries::iterator end() const = 0; On 2016/11/28 ...
4 years ago (2016-11-28 16:16:56 UTC) #14
jif-google
My wrist hurt from scrolling. Overall LG, just nits. https://codereview.chromium.org/2525663002/diff/40001/components/reading_list/ios/reading_list_model.h File components/reading_list/ios/reading_list_model.h (right): https://codereview.chromium.org/2525663002/diff/40001/components/reading_list/ios/reading_list_model.h#newcode83 components/reading_list/ios/reading_list_model.h:83: ...
4 years ago (2016-11-28 16:28:22 UTC) #15
Olivier
Thanks PTAL https://codereview.chromium.org/2525663002/diff/40001/components/reading_list/ios/reading_list_model.h File components/reading_list/ios/reading_list_model.h (right): https://codereview.chromium.org/2525663002/diff/40001/components/reading_list/ios/reading_list_model.h#newcode83 components/reading_list/ios/reading_list_model.h:83: // If the |url| is in the ...
4 years ago (2016-11-28 17:58:25 UTC) #16
jif
https://codereview.chromium.org/2525663002/diff/40001/components/reading_list/ios/reading_list_model_impl.cc File components/reading_list/ios/reading_list_model_impl.cc (right): https://codereview.chromium.org/2525663002/diff/40001/components/reading_list/ios/reading_list_model_impl.cc#newcode211 components/reading_list/ios/reading_list_model_impl.cc:211: GURL url = entry->URL(); On 2016/11/28 17:58:25, Olivier Robin ...
4 years ago (2016-11-28 18:15:32 UTC) #17
gambard
lgtm with comments https://codereview.chromium.org/2525663002/diff/120001/components/reading_list/ios/reading_list_model_observer.h File components/reading_list/ios/reading_list_model_observer.h (right): https://codereview.chromium.org/2525663002/diff/120001/components/reading_list/ios/reading_list_model_observer.h#newcode43 components/reading_list/ios/reading_list_model_observer.h:43: // |index| is the original position ...
4 years ago (2016-11-29 10:09:23 UTC) #18
Olivier
https://codereview.chromium.org/2525663002/diff/40001/components/reading_list/ios/reading_list_entry.h File components/reading_list/ios/reading_list_entry.h (right): https://codereview.chromium.org/2525663002/diff/40001/components/reading_list/ios/reading_list_entry.h#newcode35 components/reading_list/ios/reading_list_entry.h:35: std::unordered_map<GURL, ReadingListEntry, GURLHasher>; On 2016/11/28 15:38:10, Olivier Robin wrote: ...
4 years ago (2016-11-30 09:15:23 UTC) #19
jif
lgtm
4 years ago (2016-11-30 10:25:26 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2525663002/160001
4 years ago (2016-11-30 12:54:18 UTC) #24
commit-bot: I haz the power
Committed patchset #9 (id:160001)
4 years ago (2016-11-30 13:04:20 UTC) #27
commit-bot: I haz the power
4 years ago (2016-11-30 13:05:54 UTC) #29
Message was sent while issue was closed.
Patchset 9 (id:??) landed as
https://crrev.com/448b3411da25817b84202bff7c37bbc816c4b2b2
Cr-Commit-Position: refs/heads/master@{#435236}

Powered by Google App Engine
This is Rietveld 408576698