|
|
Description[Bookmark suggestions] Clean-up in the api: switch const* to const&
This CL cleans up the API in bookmark_last_visit_utils.h to use const&
instead of const* where appropriate.
BUG=652740
Committed: https://crrev.com/d43cbc46d55a25252f04431df5da5303ad066696
Cr-Commit-Position: refs/heads/master@{#436297}
Patch Set 1 #Patch Set 2 : Rebase #
Total comments: 7
Patch Set 3 : Rebase #Patch Set 4 : Rebase fix #
Messages
Total messages: 38 (24 generated)
jkrcal@chromium.org changed reviewers: + tschumann@chromium.org
Tim, I got back to one of your comments. Could you PTAL?
The CQ bit was checked by jkrcal@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: ios-device on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device/builds...) ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/bui...)
The CQ bit was checked by jkrcal@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
On 2016/11/21 15:31:08, jkrcal wrote: > Tim, I got back to one of your comments. Could you PTAL? Friendly ping!
LGTM with some nits. sorry for the delay. https://codereview.chromium.org/2518033002/diff/20001/components/ntp_snippets... File components/ntp_snippets/bookmarks/bookmark_last_visit_utils.cc (right): https://codereview.chromium.org/2518033002/diff/20001/components/ntp_snippets... components/ntp_snippets/bookmarks/bookmark_last_visit_utils.cc:197: std::vector<RecentBookmark> bookmarks; nit: unrelated to your change, but consider moving these two variables down to line 228 where they get used first. this reduces the scope of the variable and gives much better context when reading the code. https://codereview.chromium.org/2518033002/diff/20001/components/ntp_snippets... File components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc (right): https://codereview.chromium.org/2518033002/diff/20001/components/ntp_snippets... components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc:240: if (!GetLastVisitDateForNTPBookmark(*node, creation_date_fallback_, is |node| guaranteed to be non-null here and in BookmarkMetaInfoChanged()?
Thanks, Tim! Scott, could you please clarify one point related to BookmarkModelObserver below? https://codereview.chromium.org/2518033002/diff/20001/components/ntp_snippets... File components/ntp_snippets/bookmarks/bookmark_last_visit_utils.cc (right): https://codereview.chromium.org/2518033002/diff/20001/components/ntp_snippets... components/ntp_snippets/bookmarks/bookmark_last_visit_utils.cc:197: std::vector<RecentBookmark> bookmarks; On 2016/11/25 13:47:43, tschumann wrote: > nit: unrelated to your change, but consider moving these two variables down to > line 228 where they get used first. this reduces the scope of the variable and > gives much better context when reading the code. Both these variables should outlive the for-cycle starting at line 201. I am surprised that - it would work what you suggest (wouldn't the variables be local to the cycle?) and - you would consider it more readable. Are you sure? https://codereview.chromium.org/2518033002/diff/20001/components/ntp_snippets... File components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc (right): https://codereview.chromium.org/2518033002/diff/20001/components/ntp_snippets... components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc:240: if (!GetLastVisitDateForNTPBookmark(*node, creation_date_fallback_, On 2016/11/25 13:47:43, tschumann wrote: > is |node| guaranteed to be non-null here and in BookmarkMetaInfoChanged()? I am not sure. I see no info on this in BookmarkModelObserver. sky: - What is the reason for passing the bookmark nodes as const* and not const&? - Are they guaranteed to be non-null?
https://codereview.chromium.org/2518033002/diff/20001/components/ntp_snippets... File components/ntp_snippets/bookmarks/bookmark_last_visit_utils.cc (right): https://codereview.chromium.org/2518033002/diff/20001/components/ntp_snippets... components/ntp_snippets/bookmarks/bookmark_last_visit_utils.cc:197: std::vector<RecentBookmark> bookmarks; On 2016/11/25 14:05:36, jkrcal wrote: > On 2016/11/25 13:47:43, tschumann wrote: > > nit: unrelated to your change, but consider moving these two variables down to > > line 228 where they get used first. this reduces the scope of the variable and > > gives much better context when reading the code. > > Both these variables should outlive the for-cycle starting at line 201. I am > surprised that > - it would work what you suggest (wouldn't the variables be local to the > cycle?) and > - you would consider it more readable. > Are you sure? ahh... i see... the nesting tricked me in the diff view. Someday we should probably split up that method, but it's not today ;-)
treib@chromium.org changed reviewers: + treib@chromium.org
https://codereview.chromium.org/2518033002/diff/20001/components/ntp_snippets... File components/ntp_snippets/bookmarks/bookmark_last_visit_utils.cc (right): https://codereview.chromium.org/2518033002/diff/20001/components/ntp_snippets... components/ntp_snippets/bookmarks/bookmark_last_visit_utils.cc:197: std::vector<RecentBookmark> bookmarks; On 2016/11/25 15:38:14, tschumann wrote: > On 2016/11/25 14:05:36, jkrcal wrote: > > On 2016/11/25 13:47:43, tschumann wrote: > > > nit: unrelated to your change, but consider moving these two variables down > to > > > line 228 where they get used first. this reduces the scope of the variable > and > > > gives much better context when reading the code. > > > > Both these variables should outlive the for-cycle starting at line 201. I am > > surprised that > > - it would work what you suggest (wouldn't the variables be local to the > > cycle?) and > > - you would consider it more readable. > > Are you sure? > > ahh... i see... the nesting tricked me in the diff view. Someday we should > probably split up that method, but it's not today ;-) Semi-related: I just sent out a CL which significantly shortens this method, https://codereview.chromium.org/2533443004/ :)
Also, drive-by LGTM!
jkrcal@chromium.org changed reviewers: + sky@chromium.org
+sky Scott, could you please clarify one point related to BookmarkModelObserver below? https://codereview.chromium.org/2518033002/diff/20001/components/ntp_snippets... File components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc (right): https://codereview.chromium.org/2518033002/diff/20001/components/ntp_snippets... components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc:240: if (!GetLastVisitDateForNTPBookmark(*node, creation_date_fallback_, On 2016/11/25 13:47:43, tschumann wrote: > is |node| guaranteed to be non-null here and in BookmarkMetaInfoChanged()? I am not sure. I see no info on this in BookmarkModelObserver. sky: - What is the reason for passing the bookmark nodes as const* and not const&? - Are they guaranteed to be non-null?
https://codereview.chromium.org/2518033002/diff/20001/components/ntp_snippets... File components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc (right): https://codereview.chromium.org/2518033002/diff/20001/components/ntp_snippets... components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc:240: if (!GetLastVisitDateForNTPBookmark(*node, creation_date_fallback_, On 2016/11/25 14:05:36, jkrcal wrote: > On 2016/11/25 13:47:43, tschumann wrote: > > is |node| guaranteed to be non-null here and in BookmarkMetaInfoChanged()? > > I am not sure. I see no info on this in BookmarkModelObserver. > sky: > - What is the reason for passing the bookmark nodes as const* and not const&? > - Are they guaranteed to be non-null? They will never be null. I agree a const BookmarkNode& would be better here, and in many other methods in BookmarkModelObserver.
The CQ bit was checked by jkrcal@chromium.org
The CQ bit was unchecked by jkrcal@chromium.org
The CQ bit was checked by jkrcal@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from treib@chromium.org, tschumann@chromium.org Link to the patchset: https://codereview.chromium.org/2518033002/#ps40001 (title: "Rebase")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: ios-device on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device/builds...)
The CQ bit was checked by jkrcal@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by jkrcal@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from treib@chromium.org, tschumann@chromium.org Link to the patchset: https://codereview.chromium.org/2518033002/#ps60001 (title: "Rebase fix")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch. Bot data: {"patchset_id": 60001, "attempt_start_ts": 1480952409459570, "parent_rev": "18fc6d0b5215bbdcab46c858c73d3d6f9dd9aa66", "commit_rev": "fbc1478c016bf13c0ea0496bea28d213f7dd2c2a"}
Message was sent while issue was closed.
Committed patchset #4 (id:60001)
Message was sent while issue was closed.
Description was changed from ========== [Bookmark suggestions] Clean-up in the api: switch const* to const& This CL cleans up the API in bookmark_last_visit_utils.h to use const& instead of const* where appropriate. BUG=652740 ========== to ========== [Bookmark suggestions] Clean-up in the api: switch const* to const& This CL cleans up the API in bookmark_last_visit_utils.h to use const& instead of const* where appropriate. BUG=652740 Committed: https://crrev.com/d43cbc46d55a25252f04431df5da5303ad066696 Cr-Commit-Position: refs/heads/master@{#436297} ==========
Message was sent while issue was closed.
Patchset 4 (id:??) landed as https://crrev.com/d43cbc46d55a25252f04431df5da5303ad066696 Cr-Commit-Position: refs/heads/master@{#436297} |