Exemplo n.º 1
0
void Geolocation::GeoNotifier::timerFired(Timer<GeoNotifier>*)
{
    m_timer.stop();

    // Protect this GeoNotifier object, since it
    // could be deleted by a call to clearWatch in a callback.
    RefPtr<GeoNotifier> protect(this);

    // Test for fatal error first. This is required for the case where the Frame is
    // disconnected and requests are cancelled.
    if (m_fatalError) {
        runErrorCallback(m_fatalError.get());
        // This will cause this notifier to be deleted.
        m_geolocation->fatalErrorOccurred(this);
        return;
    }

    if (m_useCachedPosition) {
        // Clear the cached position flag in case this is a watch request, which
        // will continue to run.
        m_useCachedPosition = false;
        m_geolocation->requestUsesCachedPosition(this);
        return;
    }

    if (m_errorCallback) {
        RefPtr<PositionError> error = PositionError::create(PositionError::TIMEOUT, ASCIILiteral("Timeout expired"));
        m_errorCallback->handleEvent(error.get());
    }
    m_geolocation->requestTimedOut(this);
}
Exemplo n.º 2
0
void GeoNotifier::timerFired(Timer<GeoNotifier>*)
{
    m_timer.stop();

    // Test for fatal error first. This is required for the case where the LocalFrame is
    // disconnected and requests are cancelled.
    if (m_fatalError) {
        runErrorCallback(m_fatalError.get());
        // This will cause this notifier to be deleted.
        m_geolocation->fatalErrorOccurred(this);
        return;
    }

    if (m_useCachedPosition) {
        // Clear the cached position flag in case this is a watch request, which
        // will continue to run.
        m_useCachedPosition = false;
        m_geolocation->requestUsesCachedPosition(this);
        return;
    }

    if (m_errorCallback)
        m_errorCallback->handleEvent(PositionError::create(PositionError::TIMEOUT, "Timeout expired"));
    m_geolocation->requestTimedOut(this);
}
Exemplo n.º 3
0
void GeoNotifier::timerFired(TimerBase*) {
  m_timer.stop();

  // Test for fatal error first. This is required for the case where the
  // LocalFrame is disconnected and requests are cancelled.
  if (m_fatalError) {
    runErrorCallback(m_fatalError);
    // This will cause this notifier to be deleted.
    m_geolocation->fatalErrorOccurred(this);
    return;
  }

  if (m_useCachedPosition) {
    // Clear the cached position flag in case this is a watch request, which
    // will continue to run.
    m_useCachedPosition = false;
    m_geolocation->requestUsesCachedPosition(this);
    return;
  }

  if (m_errorCallback)
    m_errorCallback->handleEvent(
        PositionError::create(PositionError::kTimeout, "Timeout expired"));

  DEFINE_STATIC_LOCAL(CustomCountHistogram, timeoutExpiredHistogram,
                      ("Geolocation.TimeoutExpired", 0,
                       1000 * 60 * 10 /* 10 minute max */, 20 /* buckets */));
  timeoutExpiredHistogram.count(m_options.timeout());

  m_geolocation->requestTimedOut(this);
}