chromium/third_party/blink/renderer/core/scheduler/dom_timer.cc

/*
 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */
#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 {

// Step 11 of the algorithm at
// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html requires
// that a timeout less than 4ms is increased to 4ms when the nesting level is
// greater than 5.
constexpr int kMaxTimerNestingLevel =;
constexpr base::TimeDelta kMinimumInterval =;

base::TimeDelta GetMaxHighResolutionInterval() {}

// Maintains a set of DOMTimers for a given ExecutionContext. Assigns IDs to
// timers; these IDs are the ones returned to web authors from setTimeout or
// setInterval. It also tracks recursive creation or iterative scheduling of
// timers, which is used as a signal for throttling repetitive timers.
class DOMTimerCoordinator : public GarbageCollected<DOMTimerCoordinator>,
                            public Supplement<ExecutionContext> {};

bool IsAllowed(ExecutionContext& context, bool is_eval, const String& source) {}

}  // namespace

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() {}

}  // namespace blink