Commit d2dc7a9e authored by Josh Karlin's avatar Josh Karlin Committed by Commit Bot

Rename AnyExecutingScriptsTaggedAsAdResource to IsAdScriptInStack

Rename to simplify the code

Bug: 807640
Change-Id: Ib7a7e76ec6db79cbd4423de60719d53f79e02926
Reviewed-on: https://chromium-review.googlesource.com/1035466Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Josh Karlin <jkarlin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#554845}
parent 0ede27bc
...@@ -84,8 +84,7 @@ void AdTracker::WillSendRequest(ExecutionContext* execution_context, ...@@ -84,8 +84,7 @@ void AdTracker::WillSendRequest(ExecutionContext* execution_context,
Resource::Type resource_type) { Resource::Type resource_type) {
// If the resource is not already marked as an ad, check if any executing // If the resource is not already marked as an ad, check if any executing
// script is an ad. If yes, mark this as an ad. // script is an ad. If yes, mark this as an ad.
if (!request.IsAdResource() && if (!request.IsAdResource() && IsAdScriptInStack(execution_context))
AnyExecutingScriptsTaggedAsAdResource(execution_context))
request.SetIsAdResource(); request.SetIsAdResource();
// If it is a script marked as an ad, append it to the known ad scripts set. // If it is a script marked as an ad, append it to the known ad scripts set.
...@@ -93,8 +92,7 @@ void AdTracker::WillSendRequest(ExecutionContext* execution_context, ...@@ -93,8 +92,7 @@ void AdTracker::WillSendRequest(ExecutionContext* execution_context,
AppendToKnownAdScripts(request.Url()); AppendToKnownAdScripts(request.Url());
} }
bool AdTracker::AnyExecutingScriptsTaggedAsAdResource( bool AdTracker::IsAdScriptInStack(ExecutionContext* execution_context) {
ExecutionContext* execution_context) {
// The pseudo-stack contains entry points into the stack (e.g., when v8 is // The pseudo-stack contains entry points into the stack (e.g., when v8 is
// executed) but not the entire stack. It's cheap to retrieve the top of the // executed) but not the entire stack. It's cheap to retrieve the top of the
// stack so scan that as well. // stack so scan that as well.
......
...@@ -53,7 +53,7 @@ class CORE_EXPORT AdTracker : public GarbageCollectedFinalized<AdTracker> { ...@@ -53,7 +53,7 @@ class CORE_EXPORT AdTracker : public GarbageCollectedFinalized<AdTracker> {
// Returns true if any script in the pseudo call stack have previously been // Returns true if any script in the pseudo call stack have previously been
// identified as an ad resource. // identified as an ad resource.
bool AnyExecutingScriptsTaggedAsAdResource(ExecutionContext*); bool IsAdScriptInStack(ExecutionContext*);
virtual void Trace(blink::Visitor*); virtual void Trace(blink::Visitor*);
......
...@@ -47,8 +47,7 @@ class AdTrackerTest : public testing::Test { ...@@ -47,8 +47,7 @@ class AdTrackerTest : public testing::Test {
} }
bool AnyExecutingScriptsTaggedAsAdResource() { bool AnyExecutingScriptsTaggedAsAdResource() {
return ad_tracker_->AnyExecutingScriptsTaggedAsAdResource( return ad_tracker_->IsAdScriptInStack(&page_holder_->GetDocument());
&page_holder_->GetDocument());
} }
void AppendToKnownAdScripts(const KURL& url) { void AppendToKnownAdScripts(const KURL& url) {
......
...@@ -1155,8 +1155,7 @@ bool LocalFrame::ComputeIsAdSubFrame() const { ...@@ -1155,8 +1155,7 @@ bool LocalFrame::ComputeIsAdSubFrame() const {
// it's remote, then blink relies on the embedder to call SetIsAdFrame. // it's remote, then blink relies on the embedder to call SetIsAdFrame.
bool parent_is_ad = bool parent_is_ad =
parent->IsLocalFrame() && ToLocalFrame(parent)->IsAdSubframe(); parent->IsLocalFrame() && ToLocalFrame(parent)->IsAdSubframe();
return parent_is_ad || return parent_is_ad || ad_tracker_->IsAdScriptInStack(GetDocument());
ad_tracker_->AnyExecutingScriptsTaggedAsAdResource(GetDocument());
} }
service_manager::InterfaceProvider& LocalFrame::GetInterfaceProvider() { service_manager::InterfaceProvider& LocalFrame::GetInterfaceProvider() {
......
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