Beispiel #1
0
void LayerTreeHostGtk::layerFlushTimerFired()
{
    double fireTime = monotonicallyIncreasingTime();
    flushAndRenderLayers();
    if (m_layerFlushTimerCallback.isScheduled() || !toTextureMapperLayer(m_rootLayer.get())->descendantsOrSelfHaveRunningAnimations())
        return;

    static const double targetFramerate = 1 / 60.0;
    // When rendering layers takes more time than the target delay (0.016), we end up scheduling layer flushes
    // immediately. Since the layer flush timer has a higher priority than WebCore timers, these are never
    // fired while we keep scheduling layer flushes immediately.
    double current = monotonicallyIncreasingTime();
    double timeToNextFlush = std::max(targetFramerate - (current - fireTime), 0.0);
    if (timeToNextFlush)
        m_lastImmediateFlushTime = 0;
    else if (!m_lastImmediateFlushTime)
        m_lastImmediateFlushTime = current;

    if (shouldSkipNextFrameBecauseOfContinousImmediateFlushes(current, m_lastImmediateFlushTime)) {
        timeToNextFlush = targetFramerate;
        m_lastImmediateFlushTime = 0;
    }

// Modified by ZRL for compiling
#if 0
    m_layerFlushTimerCallback.scheduleAfterDelay("[WebKit] layerFlushTimer", std::bind(&LayerTreeHostGtk::layerFlushTimerFired, this),
        std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::duration<double>(timeToNextFlush)), layerFlushTimerPriority);
#else
    std::function<void ()> fp = std::bind(&LayerTreeHostGtk::layerFlushTimerFired, this);
    m_layerFlushTimerCallback.scheduleAfterDelay("[WebKit] layerFlushTimer", fp,
        std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::duration<double>(timeToNextFlush)), layerFlushTimerPriority);
#endif
}
Beispiel #2
0
void LayerTreeHostGtk::RenderFrameScheduler::nextFrame()
{
    static const double targetFramerate = 1 / 60.0;
    // When rendering layers takes more time than the target delay (0.016), we end up scheduling layer flushes
    // immediately. Since the layer flush timer has a higher priority than WebCore timers, these are never
    // fired while we keep scheduling layer flushes immediately.
    double current = monotonicallyIncreasingTime();
    double timeToNextFlush = std::max(targetFramerate - (current - m_fireTime), 0.0);
    if (timeToNextFlush)
        m_lastImmediateFlushTime = 0;
    else if (!m_lastImmediateFlushTime)
        m_lastImmediateFlushTime = current;

    if (shouldSkipNextFrameBecauseOfContinousImmediateFlushes(current, m_lastImmediateFlushTime)) {
        timeToNextFlush = targetFramerate;
        m_lastImmediateFlushTime = 0;
    }

    m_timer.startOneShot(timeToNextFlush);
}