#include "third_party/blink/renderer/core/scheduler/dom_timer.h"
#include <limits>
#include "base/message_loop/message_pump.h"
#include "base/numerics/clamped_math.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/renderer/core/core_probes_inl.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/csp/content_security_policy.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/page_dismissal_scope.h"
#include "third_party/blink/renderer/core/inspector/inspector_trace_events.h"
#include "third_party/blink/renderer/core/probe/core_probes.h"
#include "third_party/blink/renderer/core/scheduler/scheduled_action.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/scheduler/public/scheduling_policy.h"
#include "third_party/blink/renderer/platform/weborigin/reporting_disposition.h"
namespace blink {
namespace {
constexpr int kMaxTimerNestingLevel = …;
constexpr base::TimeDelta kMinimumInterval = …;
base::TimeDelta GetMaxHighResolutionInterval() { … }
class DOMTimerCoordinator : public GarbageCollected<DOMTimerCoordinator>,
public Supplement<ExecutionContext> { … };
bool IsAllowed(ExecutionContext& context, bool is_eval, const String& source) { … }
}
int DOMTimer::setTimeout(ScriptState* script_state,
ExecutionContext& context,
V8Function* handler,
int timeout,
const HeapVector<ScriptValue>& arguments) { … }
int DOMTimer::setTimeout(ScriptState* script_state,
ExecutionContext& context,
const String& handler,
int timeout,
const HeapVector<ScriptValue>&) { … }
int DOMTimer::setInterval(ScriptState* script_state,
ExecutionContext& context,
V8Function* handler,
int timeout,
const HeapVector<ScriptValue>& arguments) { … }
int DOMTimer::setInterval(ScriptState* script_state,
ExecutionContext& context,
const String& handler,
int timeout,
const HeapVector<ScriptValue>&) { … }
void DOMTimer::clearTimeout(ExecutionContext& context, int timeout_id) { … }
void DOMTimer::clearInterval(ExecutionContext& context, int timeout_id) { … }
void DOMTimer::RemoveByID(ExecutionContext& context, int timeout_id) { … }
DOMTimer::DOMTimer(ExecutionContext& context,
ScheduledAction* action,
base::TimeDelta timeout,
bool single_shot)
: … { … }
DOMTimer::~DOMTimer() = default;
void DOMTimer::Dispose() { … }
void DOMTimer::Stop() { … }
void DOMTimer::ContextDestroyed() { … }
void DOMTimer::Fired() { … }
void DOMTimer::Trace(Visitor* visitor) const { … }
void DOMTimer::IncrementNestingLevel() { … }
}