|
|
Created:
3 years, 7 months ago by Charlie Harrison Modified:
3 years, 7 months ago CC:
chromium-reviews, darin-cc_chromium.org, jam, subresource-filter-reviews_chromium.org Target Ref:
refs/heads/master Project:
chromium Visibility:
Public. |
Description[subresource_filter] s/ShouldSuppressActivation/OnPageActivationComputed
This patch slightly refactors the SubresourceFilterClient::ShouldSuppressActivation
to be the very last check in activation computation, as well renaming it to
OnPageActivationComputed (which takes an extra |activated| bool).
This will be used as an accurate //chrome level signal for when activation is disabled
for a given site.
BUG=689487
Review-Url: https://codereview.chromium.org/2874663002
Cr-Commit-Position: refs/heads/master@{#470885}
Committed: https://chromium.googlesource.com/chromium/src/+/61d9b5150be41b4e7e5390a5c1e242f90709539a
Patch Set 1 #Patch Set 2 : rename suppress #
Total comments: 8
Patch Set 3 : engedy review #
Total comments: 3
Patch Set 4 : Rebase on #470635 #Patch Set 5 : stl_util #Patch Set 6 : count() #
Total comments: 3
Patch Set 7 : moreee counting #Patch Set 8 : minor tweak #Patch Set 9 : update tests #Patch Set 10 #
Total comments: 4
Depends on Patchset: Messages
Total messages: 58 (40 generated)
The CQ bit was checked by csharrison@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...
Description was changed from ========== [subresource_filter] s/ShouldSuppressActivation/OnPageActivationComputed BUG= ========== to ========== [subresource_filter] s/ShouldSuppressActivation/OnPageActivationComputed This patch slightly refactors the SubresourceFilterClient::ShouldSuppressActivation to be the very last check in activation computation, as well renaming it to OnPageActivationComputed (which takes an extra |activated| bool). This will be used as an accurate //chrome level signal for when activation is disabled for a given site. BUG=689487 ==========
csharrison@chromium.org changed reviewers: + engedy@chromium.org, shivanisha@chromium.org
engedy, shivanisha: PTAL?
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_android_rel_ng on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_androi...) win_chromium_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_...)
The CQ bit was checked by csharrison@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.
LGTM % nits. Thanks! https://codereview.chromium.org/2874663002/diff/20001/components/subresource_... File components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc (right): https://codereview.chromium.org/2874663002/diff/20001/components/subresource_... components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc:190: // The client wants the best attempt at activation computation, so make sure nit: Check for the whitelisted status last, so that the client gets an accurate indication of whether there would be activation otherwise. https://codereview.chromium.org/2874663002/diff/20001/components/subresource_... File components/subresource_filter/content/browser/subresource_filter_client.h (right): https://codereview.chromium.org/2874663002/diff/20001/components/subresource_... components/subresource_filter/content/browser/subresource_filter_client.h:31: // Call when the activation is otherwise completely computedby the subresource nit: Called .. activation decision .. computed by https://codereview.chromium.org/2874663002/diff/20001/components/subresource_... components/subresource_filter/content/browser/subresource_filter_client.h:32: // filter. All that is left is embedder veto. Returns whether the activation nit: At this point, the embedder still has a chance to return false to suppress/veto the activation. https://codereview.chromium.org/2874663002/diff/20001/components/subresource_... components/subresource_filter/content/browser/subresource_filter_client.h:33: // should be whitelisted. What's the lifetime of the veto? This navigation? Forever? Let's mention that.
The CQ bit was checked by csharrison@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...
Thanks! Shivani PTAL? https://codereview.chromium.org/2874663002/diff/20001/components/subresource_... File components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc (right): https://codereview.chromium.org/2874663002/diff/20001/components/subresource_... components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc:190: // The client wants the best attempt at activation computation, so make sure On 2017/05/10 09:44:25, engedy wrote: > nit: Check for the whitelisted status last, so that the client gets an accurate > indication of whether there would be activation otherwise. Done. https://codereview.chromium.org/2874663002/diff/20001/components/subresource_... File components/subresource_filter/content/browser/subresource_filter_client.h (right): https://codereview.chromium.org/2874663002/diff/20001/components/subresource_... components/subresource_filter/content/browser/subresource_filter_client.h:31: // Call when the activation is otherwise completely computedby the subresource On 2017/05/10 09:44:25, engedy wrote: > nit: Called .. activation decision .. computed by Done. https://codereview.chromium.org/2874663002/diff/20001/components/subresource_... components/subresource_filter/content/browser/subresource_filter_client.h:32: // filter. All that is left is embedder veto. Returns whether the activation On 2017/05/10 09:44:25, engedy wrote: > nit: At this point, the embedder still has a chance to return false to > suppress/veto the activation. Done. https://codereview.chromium.org/2874663002/diff/20001/components/subresource_... components/subresource_filter/content/browser/subresource_filter_client.h:33: // should be whitelisted. On 2017/05/10 09:44:25, engedy wrote: > What's the lifetime of the veto? This navigation? Forever? Let's mention that. Added "should be whitelisted for this navigation"
LGTM, thanks!
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
lgtm % nit https://codereview.chromium.org/2874663002/diff/40001/components/subresource_... File components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc (right): https://codereview.chromium.org/2874663002/diff/40001/components/subresource_... components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc:196: whitelisted_hosts_.end(); nit (for sake of conciseness): return activated && whitelisted_hosts_.count(handle->GetURL().host()) != 0;
https://codereview.chromium.org/2874663002/diff/40001/components/subresource_... File components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc (right): https://codereview.chromium.org/2874663002/diff/40001/components/subresource_... components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc:196: whitelisted_hosts_.end(); On 2017/05/10 17:34:25, shivanisha wrote: > nit (for sake of conciseness): > > return activated && whitelisted_hosts_.count(handle->GetURL().host()) != 0; Actually, I just discovered there is base::ContainsValue(...) which does exactly this (and also terminates after the first match).
The CQ bit was checked by csharrison@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 checked by csharrison@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...
Thanks https://codereview.chromium.org/2874663002/diff/40001/components/subresource_... File components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc (right): https://codereview.chromium.org/2874663002/diff/40001/components/subresource_... components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc:196: whitelisted_hosts_.end(); On 2017/05/10 17:40:20, engedy wrote: > On 2017/05/10 17:34:25, shivanisha wrote: > > nit (for sake of conciseness): > > > > return activated && whitelisted_hosts_.count(handle->GetURL().host()) != 0; > > Actually, I just discovered there is base::ContainsValue(...) which does exactly > this (and also terminates after the first match). Changed to use base::ContainsValue, but it's a set so count() will also terminate after the first match.
On 2017/05/10 18:17:21, Charlie Harrison wrote: > Thanks > > https://codereview.chromium.org/2874663002/diff/40001/components/subresource_... > File > components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc > (right): > > https://codereview.chromium.org/2874663002/diff/40001/components/subresource_... > components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc:196: > whitelisted_hosts_.end(); > On 2017/05/10 17:40:20, engedy wrote: > > On 2017/05/10 17:34:25, shivanisha wrote: > > > nit (for sake of conciseness): > > > > > > return activated && whitelisted_hosts_.count(handle->GetURL().host()) != 0; > > > > Actually, I just discovered there is base::ContainsValue(...) which does > exactly > > this (and also terminates after the first match). > > Changed to use base::ContainsValue, but it's a set so count() will also > terminate after the first match. In that case we should use set::count, because base::ContainsValue will be O(n).
On 2017/05/10 18:18:27, engedy wrote: > On 2017/05/10 18:17:21, Charlie Harrison wrote: > > Thanks > > > > > https://codereview.chromium.org/2874663002/diff/40001/components/subresource_... > > File > > > components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc > > (right): > > > > > https://codereview.chromium.org/2874663002/diff/40001/components/subresource_... > > > components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc:196: > > whitelisted_hosts_.end(); > > On 2017/05/10 17:40:20, engedy wrote: > > > On 2017/05/10 17:34:25, shivanisha wrote: > > > > nit (for sake of conciseness): > > > > > > > > return activated && whitelisted_hosts_.count(handle->GetURL().host()) != > 0; > > > > > > Actually, I just discovered there is base::ContainsValue(...) which does > > exactly > > > this (and also terminates after the first match). > > > > Changed to use base::ContainsValue, but it's a set so count() will also > > terminate after the first match. > > In that case we should use set::count, because base::ContainsValue will be O(n). doh of course. I thought ContainsValue was just a wrapper around ".find() != .end()". Moved back to count()
The CQ bit was checked by csharrison@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...
https://codereview.chromium.org/2874663002/diff/100001/components/subresource... File components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc (right): https://codereview.chromium.org/2874663002/diff/100001/components/subresource... components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc:196: whitelisted_hosts_.end(); Did you mean to move back to count()?
The CQ bit was checked by csharrison@chromium.org to run a CQ dry run
https://codereview.chromium.org/2874663002/diff/100001/components/subresource... File components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc (right): https://codereview.chromium.org/2874663002/diff/100001/components/subresource... components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc:196: whitelisted_hosts_.end(); On 2017/05/10 18:43:18, shivanisha wrote: > Did you mean to move back to count()? Oh, I just forgot to update the test only implementation of the Mock client. I'll update this one to use count() too.
https://codereview.chromium.org/2874663002/diff/100001/components/subresource... File components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc (right): https://codereview.chromium.org/2874663002/diff/100001/components/subresource... components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc:196: whitelisted_hosts_.end(); On 2017/05/10 18:55:21, Charlie Harrison wrote: > On 2017/05/10 18:43:18, shivanisha wrote: > > Did you mean to move back to count()? > > Oh, I just forgot to update the test only implementation of the Mock client. > I'll update this one to use count() too. Done. OK landing now :)
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 csharrison@chromium.org
The CQ bit was checked by csharrison@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from shivanisha@chromium.org, engedy@chromium.org Link to the patchset: https://codereview.chromium.org/2874663002/#ps120001 (title: "moreee counting")
The CQ bit was unchecked by commit-bot@chromium.org
This CL has an open dependency (Issue 2871013002 Patch 40001). Please resolve the dependency and try again. If you are sure that there is no real dependency, please use one of the options listed in https://goo.gl/9Es4OR to land the CL.
The CQ bit was checked by csharrison@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: android_n5x_swarming_rel on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_n5x_...)
The CQ bit was checked by csharrison@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 checked by csharrison@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...
I had to make some minor tweaks to the code to get this working but it should be fairly straightforward. One last pass from one of you would be nice. Feel free to CQ too.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
Still LGTM. https://codereview.chromium.org/2874663002/diff/180001/components/subresource... File components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc (right): https://codereview.chromium.org/2874663002/diff/180001/components/subresource... components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc:200: // Check for whitelisted status last, so that the client gets an accurate follow up nit: Any reason to not do this block of logic at the very end of ComputeActivationForMainFrameNavigation? https://codereview.chromium.org/2874663002/diff/180001/components/subresource... File components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc (right): https://codereview.chromium.org/2874663002/diff/180001/components/subresource... components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc:802: // Whitelisting is only applied when the page will otherwise activate. I started deprioritizing ActivationDecision::WHITELISTED in the multiple simultaneous configs CL, and this concludes that change. I like it!
The CQ bit was checked by engedy@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from shivanisha@chromium.org Link to the patchset: https://codereview.chromium.org/2874663002/#ps180001 (title: "")
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": 180001, "attempt_start_ts": 1494494001332820, "parent_rev": "715c833d5ba12cedbf0250778ce9c7db4a517490", "commit_rev": "61d9b5150be41b4e7e5390a5c1e242f90709539a"}
Message was sent while issue was closed.
Description was changed from ========== [subresource_filter] s/ShouldSuppressActivation/OnPageActivationComputed This patch slightly refactors the SubresourceFilterClient::ShouldSuppressActivation to be the very last check in activation computation, as well renaming it to OnPageActivationComputed (which takes an extra |activated| bool). This will be used as an accurate //chrome level signal for when activation is disabled for a given site. BUG=689487 ========== to ========== [subresource_filter] s/ShouldSuppressActivation/OnPageActivationComputed This patch slightly refactors the SubresourceFilterClient::ShouldSuppressActivation to be the very last check in activation computation, as well renaming it to OnPageActivationComputed (which takes an extra |activated| bool). This will be used as an accurate //chrome level signal for when activation is disabled for a given site. BUG=689487 Review-Url: https://codereview.chromium.org/2874663002 Cr-Commit-Position: refs/heads/master@{#470885} Committed: https://chromium.googlesource.com/chromium/src/+/61d9b5150be41b4e7e5390a5c1e2... ==========
Message was sent while issue was closed.
Committed patchset #10 (id:180001) as https://chromium.googlesource.com/chromium/src/+/61d9b5150be41b4e7e5390a5c1e2...
Message was sent while issue was closed.
https://codereview.chromium.org/2874663002/diff/180001/components/subresource... File components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc (right): https://codereview.chromium.org/2874663002/diff/180001/components/subresource... components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc:200: // Check for whitelisted status last, so that the client gets an accurate On 2017/05/11 09:13:14, engedy wrote: > follow up nit: Any reason to not do this block of logic at the very end of > ComputeActivationForMainFrameNavigation? I chose to do this here so that we can continue to use early return semantics in ComputeActivation*. Otherwise the method gets messier and harder to reason about. I don't feel very strongly about it though. https://codereview.chromium.org/2874663002/diff/180001/components/subresource... File components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc (right): https://codereview.chromium.org/2874663002/diff/180001/components/subresource... components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc:802: // Whitelisting is only applied when the page will otherwise activate. On 2017/05/11 09:13:14, engedy wrote: > I started deprioritizing ActivationDecision::WHITELISTED in the multiple > simultaneous configs CL, and this concludes that change. I like it! woohoo! |