#include "third_party/blink/renderer/core/script/script_runner.h"
#include <algorithm>
#include "base/feature_list.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/strcat.h"
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/typed_macros.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/scriptable_document_parser.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/loader/document_loader.h"
#include "third_party/blink/renderer/core/script/script_loader.h"
#include "third_party/blink/renderer/platform/scheduler/public/cooperative_scheduling_manager.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h"
#include "third_party/blink/renderer/platform/wtf/casting.h"
namespace {
enum class RaceTaskPriority { … };
const char* RaceTaskPriorityToString(RaceTaskPriority task_priority) { … }
void PostTaskWithLowPriorityUntilTimeout(
const base::Location& from_here,
base::OnceClosure task,
base::TimeDelta timeout,
scoped_refptr<base::SingleThreadTaskRunner> lower_priority_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> normal_priority_task_runner) { … }
}
namespace blink {
void PostTaskWithLowPriorityUntilTimeoutForTesting(
const base::Location& from_here,
base::OnceClosure task,
base::TimeDelta timeout,
scoped_refptr<base::SingleThreadTaskRunner> lower_priority_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> normal_priority_task_runner) { … }
ScriptRunner::ScriptRunner(Document* document)
: … { … }
void ScriptRunner::QueueScriptForExecution(PendingScript* pending_script,
DelayReasons delay_reasons) { … }
void ScriptRunner::AddDelayReason(DelayReason delay_reason) { … }
void ScriptRunner::RemoveDelayReason(DelayReason delay_reason) { … }
void ScriptRunner::RemoveDelayReasonFromScript(PendingScript* pending_script,
DelayReason delay_reason) { … }
void ScriptRunner::ExecuteAsyncPendingScript(
PendingScript* pending_script,
base::TimeTicks ready_to_evaluate_time) { … }
void ScriptRunner::ExecuteForceInOrderPendingScript(
PendingScript* pending_script) { … }
void ScriptRunner::ExecuteParserBlockingScriptsBlockedByForceInOrder() { … }
void ScriptRunner::PendingScriptFinished(PendingScript* pending_script) { … }
void ScriptRunner::ExecutePendingScript(PendingScript* pending_script) { … }
void ScriptRunner::Trace(Visitor* visitor) const { … }
ScriptRunnerDelayer::ScriptRunnerDelayer(ScriptRunner* script_runner,
ScriptRunner::DelayReason delay_reason)
: … { … }
void ScriptRunnerDelayer::Activate() { … }
void ScriptRunnerDelayer::Deactivate() { … }
void ScriptRunnerDelayer::Trace(Visitor* visitor) const { … }
}