New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 752051 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Task



Sign in to add a comment

Use OnceCallback in ntp_snippets

Project Member Reported by gaschler@chromium.org, Aug 3 2017

Issue description

Move-only type callbacks (OnceCallback<>) are the new and preferred type of callback because the lifetime is clear.
https://chromium.googlesource.com/chromium/src/+/lkcr/docs/callback.md

It would be good to replace the existing base::Callback<> to base::OnceCallback<> in the component ntp_snippets.
https://cs.chromium.org/search/?q=f:ntp_snippets+base::callback

The project-wide effort is tracked by issue https://bugs.chromium.org/p/chromium/issues/detail?id=714018

 
Project Member

Comment 1 by bugdroid1@chromium.org, Aug 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/42544c124aaf522d306ca0b1959142444ee1e451

commit 42544c124aaf522d306ca0b1959142444ee1e451
Author: gaschler <gaschler@chromium.org>
Date: Thu Aug 03 15:43:26 2017

Make ImageFetchedCallback a OnceCallback

Refactor ImageFetchedCallback to be a move-only type callback,
which has a clear lifetime.

Bug: 752051
Change-Id: I46c8f47f60d88afd3f3825f20404189ff7cb5cc1
Reviewed-on: https://chromium-review.googlesource.com/600052
Commit-Queue: Andre Gaschler <gaschler@chromium.org>
Reviewed-by: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491748}
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/chrome/browser/ntp_snippets/download_suggestions_provider.cc
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/chrome/browser/ntp_snippets/download_suggestions_provider.h
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/bookmarks/bookmark_suggestions_provider.h
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/breaking_news/breaking_news_suggestions_provider.cc
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/breaking_news/breaking_news_suggestions_provider.h
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/callbacks.h
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/content_suggestions_provider.h
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/content_suggestions_service.cc
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/content_suggestions_service.h
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/content_suggestions_service_unittest.cc
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/contextual_suggestions_source.cc
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/contextual_suggestions_source.h
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/mock_content_suggestions_provider.cc
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/mock_content_suggestions_provider.h
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.cc
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.h
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/physical_web_pages/physical_web_page_suggestions_provider.cc
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/physical_web_pages/physical_web_page_suggestions_provider.h
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/reading_list/reading_list_suggestions_provider.cc
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/reading_list/reading_list_suggestions_provider.h
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/remote/cached_image_fetcher.cc
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/remote/cached_image_fetcher.h
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/remote/cached_image_fetcher_unittest.cc
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/remote/remote_suggestions_provider_impl.cc
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/remote/remote_suggestions_provider_impl.h
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/remote/remote_suggestions_scheduler_impl_unittest.cc
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/sessions/foreign_sessions_suggestions_provider.cc
[modify] https://crrev.com/42544c124aaf522d306ca0b1959142444ee1e451/components/ntp_snippets/sessions/foreign_sessions_suggestions_provider.h

Project Member

Comment 2 by bugdroid1@chromium.org, Aug 4 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/df40dcca9ac7b2713710b5567170ee07e1042438

commit df40dcca9ac7b2713710b5567170ee07e1042438
Author: gaschler <gaschler@chromium.org>
Date: Fri Aug 04 14:06:37 2017

Use OnceCallback in ntp_snippets

Refactor FetchDoneCallback and DismissedSuggestionsCallback
to move-only type callbacks, which have a clear lifetime.

Bug: 752051
Change-Id: I0def6b9e9414095f5e7c6dd85f900df36f2f233d
Reviewed-on: https://chromium-review.googlesource.com/602033
Commit-Queue: Andre Gaschler <gaschler@chromium.org>
Reviewed-by: Gauthier Ambard <gambard@chromium.org>
Reviewed-by: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#492018}
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/chrome/browser/ntp_snippets/download_suggestions_provider.cc
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/chrome/browser/ntp_snippets/download_suggestions_provider.h
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/components/ntp_snippets/bookmarks/bookmark_suggestions_provider.cc
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/components/ntp_snippets/bookmarks/bookmark_suggestions_provider.h
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/components/ntp_snippets/breaking_news/breaking_news_suggestions_provider.cc
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/components/ntp_snippets/breaking_news/breaking_news_suggestions_provider.h
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/components/ntp_snippets/callbacks.h
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/components/ntp_snippets/content_suggestions_provider.h
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/components/ntp_snippets/content_suggestions_service.cc
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/components/ntp_snippets/content_suggestions_service.h
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/components/ntp_snippets/content_suggestions_service_unittest.cc
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/components/ntp_snippets/mock_content_suggestions_provider.cc
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/components/ntp_snippets/mock_content_suggestions_provider.h
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.cc
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.h
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/components/ntp_snippets/physical_web_pages/physical_web_page_suggestions_provider.cc
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/components/ntp_snippets/physical_web_pages/physical_web_page_suggestions_provider.h
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/components/ntp_snippets/reading_list/reading_list_suggestions_provider.cc
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/components/ntp_snippets/reading_list/reading_list_suggestions_provider.h
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/components/ntp_snippets/remote/remote_suggestions_provider_impl.cc
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/components/ntp_snippets/remote/remote_suggestions_provider_impl.h
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/components/ntp_snippets/remote/remote_suggestions_scheduler_impl_unittest.cc
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/components/ntp_snippets/sessions/foreign_sessions_suggestions_provider.cc
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/components/ntp_snippets/sessions/foreign_sessions_suggestions_provider.h
[modify] https://crrev.com/df40dcca9ac7b2713710b5567170ee07e1042438/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm

Description: Show this description
Labels: -Restrict-View-Google
Components: UI>Browser>ContentSuggestions
Labels: -Type-Bug Type-Task
Owner: ----
Status: Available (was: Assigned)

Sign in to add a comment