> File //depot/googleclient/gears/opensource/gears/geolocation/geolocation.cc 
> (snapshot 4)
> ------------------------------------
> Line 620: AddProvidersToRequest(urls, info.get());
> But later we check for a 0 timeout and remove them. How about checking for a 0
> timeout up-front and not bothering starting any providers if 0 is the timeout?
When maximumAge is zero (the default), we should throw an exception if
no (valid) providers are supplied. This is to maintain compatibility
with the behaviour from before maximumAge was added. We should do this
whether or not the timeout is zero.

So when maximumAge is zero, we need to check whether there are any
valid providers, even if timeout is also zero. The only way to do this
is by trying to add the providers to the request, since checking
network provider URLs and checking for GPS capability is handled by
the location provider pool.

I've added an optimisation to not add providers if maximumAge is
non-zero and timeout is zero, but we still need the code to
subsequently remove the providers for the case where timeout is zero,
maximumAge is zero and valid providers are supplied.

> ------------------------------------
> Line 647: info->timeout != 0 &&
> Why do we check for a non-zero timeout here?
If there are nor providers and we don't have a suitable cached
position, and the timeout is zero, we should call back with a timeout
error, not a cached position error. This is handled by
StartTimeoutTimer below.

New snapshot uploaded.

Reply via email to