|
|
Created:
4 years, 4 months ago by vitaliii Modified:
4 years, 3 months ago CC:
chromium-reviews, ntp-dev+reviews_chromium.org, tschumann, Philipp Keck, dgn Base URL:
https://chromium.googlesource.com/chromium/src.git@pw_provider Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionContentSuggestionsService providers registration refactoring.
BUG=633139
Committed: https://crrev.com/496451c110e32151e4ce05dc4e2e0ca83c69a3df
Cr-Commit-Position: refs/heads/master@{#414481}
Patch Set 1 #
Total comments: 6
Patch Set 2 : Marc's comments. #Patch Set 3 : rebase #
Total comments: 4
Patch Set 4 : dgn@ comments. #
Total comments: 2
Patch Set 5 : Marc's comment. #Patch Set 6 : Marked Android specific code. #Messages
Total messages: 45 (19 generated)
vitaliii@chromium.org changed reviewers: + treib@chromium.org, tschumann@chromium.org
treib@chromium.org changed reviewers: + pke@google.com
+pke FYI, since this will conflict with https://codereview.chromium.org/2245583002/ One of you will have to rebase :)
Thanks! Mostly looks good, just some small comments. https://codereview.chromium.org/2245633002/diff/1/chrome/browser/ntp_snippets... File chrome/browser/ntp_snippets/content_suggestions_service_factory.cc (right): https://codereview.chromium.org/2245633002/diff/1/chrome/browser/ntp_snippets... chrome/browser/ntp_snippets/content_suggestions_service_factory.cc:80: void RegisterOfflinePageSuggestionsProvider(ContentSuggestionsService* service, optional naming proposal: Should we remove "Suggestions" from all these function names? It'd make them a bit shorter, and it's IMO clear from context. https://codereview.chromium.org/2245633002/diff/1/chrome/browser/ntp_snippets... chrome/browser/ntp_snippets/content_suggestions_service_factory.cc:84: nit: I'd remove the empty line; the other Register* functions don't have it either. https://codereview.chromium.org/2245633002/diff/1/chrome/browser/ntp_snippets... chrome/browser/ntp_snippets/content_suggestions_service_factory.cc:113: content::BrowserContext* context) { Profile and BrowserContext are actually the same, it's enough to pass just the Profile and use that instead of context
Description was changed from ========== ContentSuggestionsService providers registration refactoring. BUG= ========== to ========== ContentSuggestionsService providers registration refactoring. BUG=637248 ==========
Ah, also: You can either add bug 633139 to the description, since that seems fitting, or just say "BUG=none".
Description was changed from ========== ContentSuggestionsService providers registration refactoring. BUG=637248 ========== to ========== ContentSuggestionsService providers registration refactoring. BUG=633139 ==========
https://codereview.chromium.org/2245633002/diff/1/chrome/browser/ntp_snippets... File chrome/browser/ntp_snippets/content_suggestions_service_factory.cc (right): https://codereview.chromium.org/2245633002/diff/1/chrome/browser/ntp_snippets... chrome/browser/ntp_snippets/content_suggestions_service_factory.cc:80: void RegisterOfflinePageSuggestionsProvider(ContentSuggestionsService* service, On 2016/08/12 12:18:45, Marc Treib wrote: > optional naming proposal: Should we remove "Suggestions" from all these function > names? It'd make them a bit shorter, and it's IMO clear from context. Done. https://codereview.chromium.org/2245633002/diff/1/chrome/browser/ntp_snippets... chrome/browser/ntp_snippets/content_suggestions_service_factory.cc:84: On 2016/08/12 12:18:45, Marc Treib wrote: > nit: I'd remove the empty line; the other Register* functions don't have it > either. Done. https://codereview.chromium.org/2245633002/diff/1/chrome/browser/ntp_snippets... chrome/browser/ntp_snippets/content_suggestions_service_factory.cc:113: content::BrowserContext* context) { On 2016/08/12 12:18:45, Marc Treib wrote: > Profile and BrowserContext are actually the same, it's enough to pass just the > Profile and use that instead of context Done.
LGTM, thanks! (but please coordinate with Philipp about landing)
lgtm
Still LGTM after the rebase
The CQ bit was checked by vitaliii@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from tschumann@chromium.org Link to the patchset: https://codereview.chromium.org/2245633002/#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: chromeos_amd64-generic_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_amd64-...) linux_chromium_asan_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
dgn@chromium.org changed reviewers: + dgn@chromium.org
drive by nit https://codereview.chromium.org/2245633002/diff/40001/chrome/browser/ntp_snip... File chrome/browser/ntp_snippets/content_suggestions_service_factory.cc (right): https://codereview.chromium.org/2245633002/diff/40001/chrome/browser/ntp_snip... chrome/browser/ntp_snippets/content_suggestions_service_factory.cc:121: SigninManagerFactory::GetForProfile(profile); We need to specifically declare the dependency on other services in the factory's constructor, so I'd move getting these services out of the helper functions and back in BuildServiceInstanceFor, it would make it clearer what the dependencies are for IMO.
https://codereview.chromium.org/2245633002/diff/40001/chrome/browser/ntp_snip... File chrome/browser/ntp_snippets/content_suggestions_service_factory.cc (right): https://codereview.chromium.org/2245633002/diff/40001/chrome/browser/ntp_snip... chrome/browser/ntp_snippets/content_suggestions_service_factory.cc:121: SigninManagerFactory::GetForProfile(profile); On 2016/08/17 14:07:29, dgn wrote: > We need to specifically declare the dependency on other services in the > factory's constructor, so I'd move getting these services out of the helper > functions and back in BuildServiceInstanceFor, it would make it clearer what the > dependencies are for IMO. So you are concerned about keeping the DependsOn() calls in sync with accessing the factories? This is a challenge we're facing anyways. Especially looking at the insanely growing BuildInstanceFor() function (where we need to keep track of those as well). Ideally, issues like these would be caught by unit tests -- and the fact that we don't have tests here at all is actually really concerning. How hard would it be to have these things tested? Lacking tests, anything can happen ;-) IMO, this CL already improves the situation as I can skim BuildInstanceFor() quickly and see which providers get registered at a glance. We could better reflect these dependencies by handing in the service's themselves instead of the profile and have the function call GetForProfile(). Then at the calling side, you'd see the accessed services.
https://codereview.chromium.org/2245633002/diff/40001/chrome/browser/ntp_snip... File chrome/browser/ntp_snippets/content_suggestions_service_factory.cc (right): https://codereview.chromium.org/2245633002/diff/40001/chrome/browser/ntp_snip... chrome/browser/ntp_snippets/content_suggestions_service_factory.cc:121: SigninManagerFactory::GetForProfile(profile); On 2016/08/18 17:41:29, tschumann wrote: > On 2016/08/17 14:07:29, dgn wrote: > > We need to specifically declare the dependency on other services in the > > factory's constructor, so I'd move getting these services out of the helper > > functions and back in BuildServiceInstanceFor, it would make it clearer what > the > > dependencies are for IMO. > > So you are concerned about keeping the DependsOn() calls in sync with accessing > the factories? > This is a challenge we're facing anyways. Especially looking at the insanely > growing BuildInstanceFor() function (where we need to keep track of those as > well). > > Ideally, issues like these would be caught by unit tests -- and the fact that we > don't have tests here at all is actually really concerning. How hard would it be > to have these things tested? > Lacking tests, anything can happen ;-) > > IMO, this CL already improves the situation as I can skim BuildInstanceFor() > quickly and see which providers get registered at a glance. We could better > reflect these dependencies by handing in the service's themselves instead of the > profile and have the function call GetForProfile(). > > Then at the calling side, you'd see the accessed services. > > Yes, I agree, this CL already helps a lot. What I was suggesting is just that it would be nice to have BuildInstanceFor grab all the services, instead of the registration functions doing that. So something like Constructor() { Dependson(FactoryA) Dependson(FactoryB) Dependson(FactoryC) } BuildInstanceFor() { A = FactoryA::GetInstance() B = FactoryB::GetInstance() C = FactoryC::GetInstance() RegisterProviderX() RegisterProviderY(A, B) RegisterProviderZ(C) } That makes tracking why dependencies are needed clearer. I guess that's what you're describing in your last paragraph. But anyway, that's just a nit, I think it would be a nice addition but don't feel too strongly about it.
Btw, there's also the IOSChromeContentSuggestionsServiceFactory: https://codereview.chromium.org/2232473002/
Patchset #4 (id:60001) has been deleted
vitaliii@chromium.org changed reviewers: - dgn@chromium.org, pke@google.com, tschumann@chromium.org
Hi Marc, would you mind to have a look one more time? https://codereview.chromium.org/2245633002/diff/40001/chrome/browser/ntp_snip... File chrome/browser/ntp_snippets/content_suggestions_service_factory.cc (right): https://codereview.chromium.org/2245633002/diff/40001/chrome/browser/ntp_snip... chrome/browser/ntp_snippets/content_suggestions_service_factory.cc:121: SigninManagerFactory::GetForProfile(profile); On 2016/08/19 09:25:14, dgn wrote: > On 2016/08/18 17:41:29, tschumann wrote: > > On 2016/08/17 14:07:29, dgn wrote: > > > We need to specifically declare the dependency on other services in the > > > factory's constructor, so I'd move getting these services out of the helper > > > functions and back in BuildServiceInstanceFor, it would make it clearer what > > the > > > dependencies are for IMO. > > > > So you are concerned about keeping the DependsOn() calls in sync with > accessing > > the factories? > > This is a challenge we're facing anyways. Especially looking at the insanely > > growing BuildInstanceFor() function (where we need to keep track of those as > > well). > > > > Ideally, issues like these would be caught by unit tests -- and the fact that > we > > don't have tests here at all is actually really concerning. How hard would it > be > > to have these things tested? > > Lacking tests, anything can happen ;-) > > > > IMO, this CL already improves the situation as I can skim BuildInstanceFor() > > quickly and see which providers get registered at a glance. We could better > > reflect these dependencies by handing in the service's themselves instead of > the > > profile and have the function call GetForProfile(). > > > > Then at the calling side, you'd see the accessed services. > > > > > > Yes, I agree, this CL already helps a lot. What I was suggesting is just that it > would be nice to have BuildInstanceFor grab all the services, instead of the > registration functions doing that. So something like > > Constructor() { > Dependson(FactoryA) > Dependson(FactoryB) > Dependson(FactoryC) > } > > BuildInstanceFor() { > A = FactoryA::GetInstance() > B = FactoryB::GetInstance() > C = FactoryC::GetInstance() > > RegisterProviderX() > RegisterProviderY(A, B) > RegisterProviderZ(C) > } > > That makes tracking why dependencies are needed clearer. I guess that's what > you're describing in your last paragraph. But anyway, that's just a nit, I think > it would be a nice addition but don't feel too strongly about it. Done.
https://codereview.chromium.org/2245633002/diff/80001/chrome/browser/ntp_snip... File chrome/browser/ntp_snippets/content_suggestions_service_factory.cc (right): https://codereview.chromium.org/2245633002/diff/80001/chrome/browser/ntp_snip... chrome/browser/ntp_snippets/content_suggestions_service_factory.cc:95: if (recent_tabs_enabled || downloads_enabled) { Hm, so this method checks the features itself, but all the others don't. Can we make that consistent?
Hi Marc, please have a look. https://codereview.chromium.org/2245633002/diff/80001/chrome/browser/ntp_snip... File chrome/browser/ntp_snippets/content_suggestions_service_factory.cc (right): https://codereview.chromium.org/2245633002/diff/80001/chrome/browser/ntp_snip... chrome/browser/ntp_snippets/content_suggestions_service_factory.cc:95: if (recent_tabs_enabled || downloads_enabled) { On 2016/08/25 13:51:54, Marc Treib wrote: > Hm, so this method checks the features itself, but all the others don't. Can we > make that consistent? Done.
LGTM, thanks!
The CQ bit was checked by vitaliii@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from tschumann@chromium.org Link to the patchset: https://codereview.chromium.org/2245633002/#ps100001 (title: "Marc's comment.")
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: chromeos_amd64-generic_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_amd64-...) chromeos_daisy_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_daisy_...)
The CQ bit was checked by vitaliii@chromium.org
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: chromeos_daisy_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_daisy_...) chromeos_x86-generic_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_x86-ge...) linux_chromium_chromeos_compile_dbg_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
The CQ bit was checked by vitaliii@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/2245633002/#ps120001 (title: "Marked Android specific code.")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Description was changed from ========== ContentSuggestionsService providers registration refactoring. BUG=633139 ========== to ========== ContentSuggestionsService providers registration refactoring. BUG=633139 ==========
Message was sent while issue was closed.
Committed patchset #6 (id:120001)
Message was sent while issue was closed.
Description was changed from ========== ContentSuggestionsService providers registration refactoring. BUG=633139 ========== to ========== ContentSuggestionsService providers registration refactoring. BUG=633139 Committed: https://crrev.com/496451c110e32151e4ce05dc4e2e0ca83c69a3df Cr-Commit-Position: refs/heads/master@{#414481} ==========
Message was sent while issue was closed.
Patchset 6 (id:??) landed as https://crrev.com/496451c110e32151e4ce05dc4e2e0ca83c69a3df Cr-Commit-Position: refs/heads/master@{#414481} |