Commit 5921f848 authored by Charlie Harrison's avatar Charlie Harrison Committed by Commit Bot

[ad-tagging] speculate DRYRUN for activation computation

This CL initializes main frame activation computating throttles with
a DRYRUN page activation, so they can speculatively access the ruleset
on start + redirects.

This should be the final CL to drive ActivationComputingDelay metrics
to 0.

Bug: 809504
Change-Id: If2b3e871cc97a00400e777081a8bace80f728e9f
Reviewed-on: https://chromium-review.googlesource.com/967663
Commit-Queue: Charlie Harrison <csharrison@chromium.org>
Reviewed-by: default avatarJosh Karlin <jkarlin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#545527}
parent 48761da1
......@@ -943,10 +943,14 @@ IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest,
IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest,
ExpectHistogramsNotRecordedWhenFilteringNotActivated) {
ResetConfigurationToEnableOnPhishingSites(
true /* measure_performance */, false /* whitelist_site_on_reload */);
// This test only makes sense when AdTagging is disabled.
base::test::ScopedFeatureList scoped_tagging;
scoped_tagging.InitAndDisableFeature(kAdTagging);
ASSERT_NO_FATAL_FAILURE(SetRulesetToDisallowURLsWithPathSuffix(
"suffix-that-does-not-match-anything"));
ResetConfigurationToEnableOnPhishingSites(
true /* measure_performance */, false /* whitelist_site_on_reload */);
const GURL url = GetTestUrl(kTestFrameSetPath);
// Note: The |url| is not configured to be fishing.
......
......@@ -7,6 +7,7 @@
#include <utility>
#include "base/bind.h"
#include "base/feature_list.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/stl_util.h"
......@@ -20,6 +21,7 @@
#include "components/subresource_filter/content/common/subresource_filter_messages.h"
#include "components/subresource_filter/content/common/subresource_filter_utils.h"
#include "components/subresource_filter/core/browser/subresource_filter_constants.h"
#include "components/subresource_filter/core/browser/subresource_filter_features.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/navigation_throttle.h"
#include "content/public/browser/render_frame_host.h"
......@@ -285,8 +287,14 @@ ContentSubresourceFilterThrottleManager::
content::NavigationHandle* navigation_handle) {
// Main frames: create unconditionally.
if (navigation_handle->IsInMainFrame()) {
return ActivationStateComputingNavigationThrottle::CreateForMainFrame(
navigation_handle);
auto throttle =
ActivationStateComputingNavigationThrottle::CreateForMainFrame(
navigation_handle);
if (base::FeatureList::IsEnabled(kAdTagging)) {
throttle->NotifyPageActivationWithRuleset(
EnsureRulesetHandle(), ActivationState(ActivationLevel::DRYRUN));
}
return throttle;
}
// Subframes: create only for frames with activated parents.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment