Commit 0f348183 authored by Josh Karlin's avatar Josh Karlin Committed by Commit Bot

[AdTracking] Speed up SubresourceFilter::IsAdResource

Check if the frame is an ad frame before checking the filter list.

Bug: 807640
Change-Id: Ic8a3e1e4ceca3ed64ff39895c697205d3c1477b0
Reviewed-on: https://chromium-review.googlesource.com/1018426
Commit-Queue: Josh Karlin <jkarlin@chromium.org>
Reviewed-by: default avatarCharlie Harrison <csharrison@chromium.org>
Reviewed-by: default avatarNate Chapin <japhet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#552144}
parent a92b79e7
...@@ -98,6 +98,9 @@ bool SubresourceFilter::GetIsAssociatedWithAdSubframe() { ...@@ -98,6 +98,9 @@ bool SubresourceFilter::GetIsAssociatedWithAdSubframe() {
bool SubresourceFilter::IsAdResource( bool SubresourceFilter::IsAdResource(
const KURL& resource_url, const KURL& resource_url,
WebURLRequest::RequestContext request_context) { WebURLRequest::RequestContext request_context) {
if (subresource_filter_->GetIsAssociatedWithAdSubframe())
return true;
WebDocumentSubresourceFilter::LoadPolicy load_policy; WebDocumentSubresourceFilter::LoadPolicy load_policy;
if (last_resource_check_result_.first == if (last_resource_check_result_.first ==
std::make_pair(resource_url, request_context)) { std::make_pair(resource_url, request_context)) {
...@@ -107,10 +110,7 @@ bool SubresourceFilter::IsAdResource( ...@@ -107,10 +110,7 @@ bool SubresourceFilter::IsAdResource(
subresource_filter_->GetLoadPolicy(resource_url, request_context); subresource_filter_->GetLoadPolicy(resource_url, request_context);
} }
// If the subresource cannot be identified as an ad via load_policy, check if return load_policy != WebDocumentSubresourceFilter::kAllow;
// its frame is identified as an ad.
return load_policy != WebDocumentSubresourceFilter::kAllow ||
subresource_filter_->GetIsAssociatedWithAdSubframe();
} }
void SubresourceFilter::ReportLoad( void SubresourceFilter::ReportLoad(
......
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