本文整理汇总了C++中DOMTimer类的典型用法代码示例。如果您正苦于以下问题:C++ DOMTimer类的具体用法?C++ DOMTimer怎么用?C++ DOMTimer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DOMTimer类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: didChangeTimerAlignmentInterval
void ScriptExecutionContext::didChangeTimerAlignmentInterval()
{
for (TimeoutMap::iterator iter = m_timeouts.begin(); iter != m_timeouts.end(); ++iter) {
DOMTimer* timer = iter->value;
timer->didChangeAlignmentInterval();
}
}
示例2: adjustMinimumTimerInterval
void ScriptExecutionContext::adjustMinimumTimerInterval(double oldMinimumTimerInterval)
{
if (minimumTimerInterval() != oldMinimumTimerInterval) {
for (TimeoutMap::iterator iter = m_timeouts.begin(); iter != m_timeouts.end(); ++iter) {
DOMTimer* timer = iter->second;
timer->adjustMinimumTimerInterval(oldMinimumTimerInterval);
}
}
}
示例3: removeByID
void DOMTimer::removeByID(ExecutionContext* context, int timeoutID)
{
DOMTimer* timer = context->timers()->removeTimeoutByID(timeoutID);
TRACE_EVENT_INSTANT1("devtools.timeline", "TimerRemove", TRACE_EVENT_SCOPE_THREAD, "data", InspectorTimerRemoveEvent::data(context, timeoutID));
InspectorInstrumentation::NativeBreakpoint nativeBreakpoint(context, "clearTimer", true);
// Eagerly unregister as ExecutionContext observer.
if (timer)
timer->clearContext();
}
示例4: removeTimeoutByID
DOMTimer* DOMTimerCoordinator::removeTimeoutByID(int timeoutID) {
if (timeoutID <= 0)
return nullptr;
DOMTimer* removedTimer = m_timers.take(timeoutID);
if (removedTimer)
removedTimer->stop();
return removedTimer;
}
示例5: DOMTimer
int DOMTimer::install(ScriptExecutionContext* context, PassOwnPtr<ScheduledAction> action, int timeout, bool singleShot)
{
// DOMTimer constructor links the new timer into a list of ActiveDOMObjects held by the 'context'.
// The timer is deleted when context is deleted (DOMTimer::contextDestroyed) or explicitly via DOMTimer::removeById(),
// or if it is a one-time timer and it has fired (DOMTimer::fired).
DOMTimer* timer = new DOMTimer(context, action, timeout, singleShot);
timer->suspendIfNeeded();
InspectorInstrumentation::didInstallTimer(context, timer->m_timeoutId, timeout, singleShot);
return timer->m_timeoutId;
}
示例6: ASSERT
int DOMTimerCoordinator::installNewTimeout(ExecutionContext* context, ScheduledAction* action, int timeout, bool singleShot)
{
// FIXME: DOMTimers depends heavily on ExecutionContext. Decouple them.
ASSERT(context->timers() == this);
int timeoutID = nextID();
TimeoutMap::AddResult result = m_timers.add(timeoutID, DOMTimer::create(context, action, timeout, singleShot, timeoutID));
ASSERT(result.isNewEntry);
DOMTimer* timer = result.storedValue->value.get();
timer->suspendIfNeeded();
return timeoutID;
}
示例7: while
int ExecutionContext::installNewTimeout(PassOwnPtr<ScheduledAction> action, int timeout, bool singleShot)
{
int timeoutID;
while (true) {
timeoutID = circularSequentialID();
if (!m_timeouts.contains(timeoutID))
break;
}
TimeoutMap::AddResult result = m_timeouts.add(timeoutID, DOMTimer::create(this, action, timeout, singleShot, timeoutID));
ASSERT(result.isNewEntry);
DOMTimer* timer = result.storedValue->value.get();
timer->suspendIfNeeded();
return timer->timeoutID();
}
示例8: DOMTimer
int DOMTimer::install(ScriptExecutionContext* context, PassOwnPtr<ScheduledAction> action, int timeout, bool singleShot)
{
// DOMTimer constructor links the new timer into a list of ActiveDOMObjects held by the 'context'.
// The timer is deleted when context is deleted (DOMTimer::contextDestroyed) or explicitly via DOMTimer::removeById(),
// or if it is a one-time timer and it has fired (DOMTimer::fired).
DOMTimer* timer = new DOMTimer(context, action, timeout, singleShot);
#if PLATFORM(IOS)
if (context->isDocument()) {
Document& document = toDocument(*context);
bool didDeferTimeout = document.frame() && document.frame()->timersPaused();
if (!didDeferTimeout && timeout <= 100 && singleShot) {
WKSetObservedContentChange(WKContentIndeterminateChange);
WebThreadAddObservedContentModifier(timer); // Will only take affect if not already visibility change.
}
}
#endif
timer->suspendIfNeeded();
InspectorInstrumentation::didInstallTimer(context, timer->m_timeoutId, timeout, singleShot);
return timer->m_timeoutId;
}
示例9: DOMTimer
int DOMTimer::install(ScriptExecutionContext* context, std::unique_ptr<ScheduledAction> action, int timeout, bool singleShot)
{
// DOMTimer constructor passes ownership of the initial ref on the object to the constructor.
// This reference will be released automatically when a one-shot timer fires, when the context
// is destroyed, or if explicitly cancelled by removeById.
DOMTimer* timer = new DOMTimer(context, WTF::move(action), timeout, singleShot);
#if PLATFORM(IOS)
if (context->isDocument()) {
Document& document = toDocument(*context);
bool didDeferTimeout = document.frame() && document.frame()->timersPaused();
if (!didDeferTimeout && timeout <= 100 && singleShot) {
WKSetObservedContentChange(WKContentIndeterminateChange);
WebThreadAddObservedContentModifier(timer); // Will only take affect if not already visibility change.
}
}
#endif
timer->suspendIfNeeded();
InspectorInstrumentation::didInstallTimer(context, timer->m_timeoutId, timeout, singleShot);
return timer->m_timeoutId;
}