void ProxyDestinationMap::setResetTimer(std::chrono::milliseconds interval) { assert(interval.count() > 0); inactivityTimeout_ = static_cast<uint32_t>(interval.count()); resetTimer_ = folly::AsyncTimeout::make(proxy_->eventBase(), [this]() noexcept { resetAllInactive(); scheduleTimer(false /* initialAttempt */); }); scheduleTimer(true /* initialAttempt */); }
void MC6845::notify(OEComponent *sender, int notification, void *data) { if (sender == controlBus) { switch (notification) { case CONTROLBUS_POWERSTATE_DID_CHANGE: powerState = *((ControlBusPowerState *)data); updateVideoEnabled(); break; case CONTROLBUS_TIMER_DID_FIRE: scheduleTimer(((ControlBusTimer *)data)->cycles); break; case CONTROLBUS_RESET_DID_ASSERT: inReset = true; updateVideoEnabled(); break; case CONTROLBUS_RESET_DID_CLEAR: inReset = false; updateVideoEnabled(); break; } } }
void IncrementalSweeper::startSweeping(const HashSet<MarkedBlock*>& blockSnapshot) { m_blocksToSweep.resize(blockSnapshot.size()); CopyFunctor functor(m_blocksToSweep); m_globalData->heap.objectSpace().forEachBlock(functor); m_currentBlockToSweepIndex = 0; m_structuresCanBeSwept = false; scheduleTimer(); }
void DefaultGCActivityCallback::didAllocate(size_t bytes) { // The first byte allocated in an allocation cycle will report 0 bytes to didAllocate. // We pretend it's one byte so that we don't ignore this allocation entirely. if (!bytes) bytes = 1; Heap* heap = static_cast<Heap*>(&m_vm->heap); double gcTimeSlice = std::min((static_cast<double>(bytes) / MB) * gcTimeSlicePerMB, maxGCTimeSlice); double newDelay = heap->lastGCLength() / gcTimeSlice; scheduleTimer(newDelay); }
void GCActivityCallback::doWork() { Heap* heap = &m_vm->heap; if (!isEnabled()) return; JSLockHolder locker(m_vm); if (heap->isDeferred()) { scheduleTimer(0); return; } doCollection(); }
void IncrementalSweeper::doSweep(double sweepBeginTime) { while (m_currentBlockToSweepIndex < m_blocksToSweep.size()) { sweepNextBlock(); double elapsedTime = WTF::monotonicallyIncreasingTime() - sweepBeginTime; if (elapsedTime < sweepTimeSlice) continue; scheduleTimer(); return; } m_blocksToSweep.clear(); cancelTimer(); }
void GCActivityCallback::didAllocate(size_t bytes) { #if PLATFORM(EFL) if (!isEnabled()) return; ASSERT(WTF::isMainThread()); #endif // The first byte allocated in an allocation cycle will report 0 bytes to didAllocate. // We pretend it's one byte so that we don't ignore this allocation entirely. if (!bytes) bytes = 1; double bytesExpectedToReclaim = static_cast<double>(bytes) * deathRate(); double newDelay = lastGCLength() / gcTimeSlice(bytesExpectedToReclaim); scheduleTimer(newDelay); }
void MC6845::updateTiming() { float controlBusClockFrequency; controlBus->postMessage(this, CONTROLBUS_GET_CLOCKFREQUENCY, &controlBusClockFrequency); clockMultiplier = clockFrequency / controlBusClockFrequency; vertTotal = vertTotalCell * scanline + vertTotalAdjust; vertDisplayed = vertDisplayedCell * scanline; vertSyncPosition = vertSyncPositionCell * scanline; frameCycleNum = horizTotal * vertTotal; controlBus->postMessage(this, CONTROLBUS_GET_CYCLES, &lastCycles); OEInt id = 0; controlBus->postMessage(this, CONTROLBUS_INVALIDATE_TIMERS, &id); scheduleTimer(0); refreshVideo(); }
void DefaultGCActivityCallback::doWork() { Heap* heap = &m_vm->heap; if (!isEnabled()) return; JSLockHolder locker(m_vm); if (heap->isDeferred()) { scheduleTimer(0); return; } #if !PLATFORM(IOS) double startTime = WTF::monotonicallyIncreasingTime(); if (heap->isPagedOut(startTime + pagingTimeOut)) { heap->activityCallback()->cancel(); heap->increaseLastGCLength(pagingTimeOut); return; } #endif heap->gcTimerDidFire(); heap->collect(); }
void DefaultGCActivityCallback::didAbandonObjectGraph() { scheduleTimer(d.get()); }
void DefaultGCActivityCallback::didAllocate(size_t bytes) { if (bytes < minBytesBeforeCollect) return; scheduleTimer(d.get()); }
void IncrementalSweeper::startSweeping(Vector<MarkedBlock*>& blockSnapshot) { m_blocksToSweep = blockSnapshot; m_currentBlockToSweepIndex = 0; scheduleTimer(); }
/* // repeating timer long setInterval(Function handler, optional long timeout, any... args); long setInterval([AllowAny] DOMString handler, optional long timeout, any... args); void clearInterval(long handle); */ static v8::Handle<v8::Value> v8setInterval( const v8::Arguments& args ){ v8::HandleScope handlescope; scheduleTimer( args, true ); }
/* // one-shot timer long setTimeout(Function handler, optional long timeout, any... args); long setTimeout([AllowAny] DOMString handler, optional long timeout, any... args); void clearTimeout(long handle); TODO: arguments */ static v8::Handle<v8::Value> v8setTimeout( const v8::Arguments& args ){ v8::HandleScope handlescope; return scheduleTimer( args, false ); }