Bug 1253159 - Remove locationUpdatePending and restore request timeout. r=jdm

This commit is contained in:
Doug Turner 2016-03-02 21:48:00 -05:00
Родитель cabee82044
Коммит 1a1dd4f3c7
5 изменённых файлов: 3 добавлений и 85 удалений

Просмотреть файл

@ -407,21 +407,17 @@ NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsGeolocationRequest)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsGeolocationRequest)
NS_IMPL_CYCLE_COLLECTION(nsGeolocationRequest, mCallback, mErrorCallback, mLocator)
void
nsGeolocationRequest::Notify()
{
StopTimeoutTimer();
SetTimeoutTimer();
NotifyErrorAndShutdown(nsIDOMGeoPositionError::TIMEOUT);
}
void
nsGeolocationRequest::NotifyErrorAndShutdown(uint16_t aErrorCode)
{
MOZ_ASSERT(!mShutdown, "timeout after shutdown");
if (!mIsWatchPositionRequest) {
Shutdown();
mLocator->RemoveRequest(this);
@ -718,16 +714,13 @@ nsGeolocationRequest::SendLocation(nsIDOMGeoPosition* aPosition)
callback->Call(*wrapped);
} else {
nsIDOMGeoPositionCallback* callback = mCallback.GetXPCOMCallback();
MOZ_ASSERT(callback);
callback->HandleEvent(aPosition);
}
StopTimeoutTimer();
SetTimeoutTimer();
MOZ_ASSERT(mShutdown || mIsWatchPositionRequest,
"non-shutdown getCurrentPosition request after callback!");
}
nsIPrincipal*
nsGeolocationRequest::GetPrincipal()
{
@ -745,22 +738,10 @@ nsGeolocationRequest::Update(nsIDOMGeoPosition* aPosition)
NS_DispatchToMainThread(ev);
return NS_OK;
}
NS_IMETHODIMP
nsGeolocationRequest::LocationUpdatePending()
{
if (!mTimeoutTimer) {
SetTimeoutTimer();
}
return NS_OK;
}
NS_IMETHODIMP
nsGeolocationRequest::NotifyError(uint16_t aErrorCode)
{
MOZ_ASSERT(NS_IsMainThread());
RefPtr<PositionError> positionError = new PositionError(mLocator, aErrorCode);
positionError->NotifyCallback(mErrorCallback);
return NS_OK;
@ -1030,30 +1011,17 @@ nsGeolocationService::Update(nsIDOMGeoPosition *aSomewhere)
if (aSomewhere) {
SetCachedPosition(aSomewhere);
}
for (uint32_t i = 0; i< mGeolocators.Length(); i++) {
mGeolocators[i]->Update(aSomewhere);
}
return NS_OK;
}
NS_IMETHODIMP
nsGeolocationService::LocationUpdatePending()
{
for (uint32_t i = 0; i< mGeolocators.Length(); i++) {
mGeolocators[i]->LocationUpdatePending();
}
return NS_OK;
}
NS_IMETHODIMP
nsGeolocationService::NotifyError(uint16_t aErrorCode)
{
for (uint32_t i = 0; i < mGeolocators.Length(); i++) {
mGeolocators[i]->NotifyError(aErrorCode);
}
return NS_OK;
}
@ -1476,21 +1444,8 @@ Geolocation::Update(nsIDOMGeoPosition *aSomewhere)
for (uint32_t i = 0; i < mWatchingCallbacks.Length(); i++) {
mWatchingCallbacks[i]->Update(aSomewhere);
}
return NS_OK;
}
NS_IMETHODIMP
Geolocation::LocationUpdatePending()
{
// this event is only really interesting for watch callbacks
for (uint32_t i = 0; i < mWatchingCallbacks.Length(); i++) {
mWatchingCallbacks[i]->LocationUpdatePending();
}
return NS_OK;
}
NS_IMETHODIMP
Geolocation::NotifyError(uint16_t aErrorCode)
{
@ -1498,7 +1453,6 @@ Geolocation::NotifyError(uint16_t aErrorCode)
Shutdown();
return NS_OK;
}
mozilla::Telemetry::Accumulate(mozilla::Telemetry::GEOLOCATION_ERROR, true);
for (uint32_t i = mPendingCallbacks.Length(); i > 0; i--) {

Просмотреть файл

@ -964,23 +964,14 @@ GonkGPSGeolocationProvider::NetworkLocationUpdate::Update(nsIDOMGeoPosition *pos
provider->mLocationCallback->Update(provider->mLastGPSPosition);
}
}
provider->InjectLocation(lat, lon, acc);
return NS_OK;
}
NS_IMETHODIMP
GonkGPSGeolocationProvider::NetworkLocationUpdate::LocationUpdatePending()
{
return NS_OK;
}
NS_IMETHODIMP
GonkGPSGeolocationProvider::NetworkLocationUpdate::NotifyError(uint16_t error)
{
return NS_OK;
}
NS_IMETHODIMP
GonkGPSGeolocationProvider::Startup()
{

Просмотреть файл

@ -125,25 +125,16 @@ CoreLocationLocationProvider::MLSUpdate::Update(nsIDOMGeoPosition *position)
if (!coords) {
return NS_ERROR_FAILURE;
}
mParentLocationProvider.Update(position);
Telemetry::Accumulate(Telemetry::GEOLOCATION_OSX_SOURCE_IS_MLS, true);
return NS_OK;
}
NS_IMETHODIMP
CoreLocationLocationProvider::MLSUpdate::LocationUpdatePending()
{
return NS_OK;
}
NS_IMETHODIMP
CoreLocationLocationProvider::MLSUpdate::NotifyError(uint16_t error)
{
mParentLocationProvider.NotifyError(error);
return NS_OK;
}
class CoreLocationObjects {
public:
NS_METHOD Init(CoreLocationLocationProvider* aProvider) {

Просмотреть файл

@ -34,18 +34,9 @@ WindowsLocationProvider::MLSUpdate::Update(nsIDOMGeoPosition *aPosition)
if (!coords) {
return NS_ERROR_FAILURE;
}
Telemetry::Accumulate(Telemetry::GEOLOCATION_WIN8_SOURCE_IS_MLS, true);
return mCallback->Update(aPosition);
}
NS_IMETHODIMP
WindowsLocationProvider::MLSUpdate::LocationUpdatePending()
{
return NS_OK;
}
NS_IMETHODIMP
WindowsLocationProvider::MLSUpdate::NotifyError(uint16_t aError)
{
@ -55,7 +46,6 @@ WindowsLocationProvider::MLSUpdate::NotifyError(uint16_t aError)
return mCallback->NotifyError(aError);
}
class LocationEvent final : public ILocationEvents
{
public:

Просмотреть файл

@ -26,14 +26,6 @@ interface nsIGeolocationUpdate : nsISupports {
* This must be called on the main thread
*/
void update(in nsIDOMGeoPosition position);
/**
* Notify the geolocation service that the location has
* potentially changed, and thus a new position is in the
* process of being acquired.
*/
void locationUpdatePending();
/**
* Notify the geolocation service of an error.
* This must be called on the main thread.
@ -83,7 +75,7 @@ interface nsIGeolocationProvider : nsISupports {
};
%{C++
/*
/*
This must be implemented by geolocation providers. It
must support nsIGeolocationProvider.
*/