#include "third_party/blink/renderer/core/frame/ad_tracker.h"
#include <memory>
#include <optional>
#include "base/compiler_specific.h"
#include "base/feature_list.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/core/core_probe_sink.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/probe/async_task_context.h"
#include "third_party/blink/renderer/core/probe/core_probes.h"
#include "third_party/blink/renderer/platform/bindings/source_location.h"
#include "third_party/blink/renderer/platform/bindings/thread_debugger.h"
#include "third_party/blink/renderer/platform/bindings/v8_binding.h"
#include "third_party/blink/renderer/platform/loader/fetch/fetch_initiator_type_names.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_request.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/wtf/casting.h"
#include "v8/include/v8-inspector.h"
#include "v8/include/v8.h"
namespace blink {
namespace {
bool IsKnownAdExecutionContext(ExecutionContext* execution_context) { … }
String GenerateFakeUrlFromScriptId(int script_id) { … }
}
AdTracker* AdTracker::FromExecutionContext(
ExecutionContext* execution_context) { … }
bool AdTracker::IsAdScriptExecutingInDocument(Document* document,
StackType stack_type) { … }
AdTracker::AdTracker(LocalFrame* local_root) : … { … }
AdTracker::~AdTracker() { … }
void AdTracker::Shutdown() { … }
String AdTracker::ScriptAtTopOfStack() { … }
ExecutionContext* AdTracker::GetCurrentExecutionContext() { … }
v8_inspector::V8DebuggerId GetDebuggerIdForContext(
const v8::Local<v8::Context>& v8_context) { … }
void AdTracker::WillExecuteScript(ExecutionContext* execution_context,
const v8::Local<v8::Context>& v8_context,
const String& script_url,
int script_id) { … }
void AdTracker::DidExecuteScript() { … }
void AdTracker::Will(const probe::ExecuteScript& probe) { … }
void AdTracker::Did(const probe::ExecuteScript& probe) { … }
void AdTracker::Will(const probe::CallFunction& probe) { … }
void AdTracker::Did(const probe::CallFunction& probe) { … }
bool AdTracker::CalculateIfAdSubresource(
ExecutionContext* execution_context,
const KURL& request_url,
ResourceType resource_type,
const FetchInitiatorInfo& initiator_info,
bool known_ad) { … }
void AdTracker::DidCreateAsyncTask(probe::AsyncTaskContext* task_context) { … }
void AdTracker::DidStartAsyncTask(probe::AsyncTaskContext* task_context) { … }
void AdTracker::DidFinishAsyncTask(probe::AsyncTaskContext* task_context) { … }
bool AdTracker::IsAdScriptInStack(
StackType stack_type,
std::optional<AdScriptIdentifier>* out_ad_script) { … }
bool AdTracker::IsKnownAdScript(ExecutionContext* execution_context,
const String& url) { … }
bool AdTracker::IsKnownAdScriptForCheckedContext(
ExecutionContext& execution_context,
const String& url) { … }
void AdTracker::AppendToKnownAdScripts(ExecutionContext& execution_context,
const String& url) { … }
void AdTracker::Trace(Visitor* visitor) const { … }
}