Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Add pause/resume API to DefaultFileSource #5236

Closed
boundsj opened this issue Jun 4, 2016 · 3 comments
Closed

Add pause/resume API to DefaultFileSource #5236

boundsj opened this issue Jun 4, 2016 · 3 comments
Assignees
Labels
performance Speed, stability, CPU usage, memory usage, or power usage
Milestone

Comments

@boundsj
Copy link
Contributor

boundsj commented Jun 4, 2016

Currently, instances of DefaultFileSource allow revalidation requests regardless of if the host process is running in the background and the map that would benefit from the requests is visible. Mobile applications that are extremely concerned about limiting network requests that is not strictly necessary may see battery performance gains if the revalidation requests were not made in the background.

In general, this behavior probably makes sense as the default on both iOS and Android. In addition, as usage of the SDK grows, the backend will benefit from not having to respond to as many requests as it does today.

We should consider adding and exposing an API to DefaultFileSource (or similar approach) so that each platform can inform it if it makes sense to carryout network requests based on background state (or other factors).

cc @jfirebaugh @1ec5 @mick

@boundsj boundsj added the performance Speed, stability, CPU usage, memory usage, or power usage label Jun 4, 2016
@1ec5
Copy link
Contributor

1ec5 commented Jun 4, 2016

In the iOS SDK, we have a natural mechanism to make use of a request-pausing API, in -[MGLMapView sleepGL:] (which happens when the application recedes to the background or enters background mode) or a similar method that would be added to MGLOfflineStorage.

We could also more aggressively pause at the point where we stop a map view's CADisplayLink (which would also happen when the map view is removed from the view hierarchy or hidden). However, the catch is that the application could have multiple views, so we'd need to refcount somehow to avoid interfering with still-visible views.

@tmpsantos
Copy link
Contributor

This could maybe implemented more generically at our class abstraction like util::Thread::pause().

@boundsj
Copy link
Contributor Author

boundsj commented Mar 1, 2017

This was fixed by #8125 and #8194

@boundsj boundsj closed this as completed Mar 1, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
performance Speed, stability, CPU usage, memory usage, or power usage
Projects
None yet
Development

No branches or pull requests

3 participants