Commit Graph

18 Commits

Author SHA1 Message Date
John Firebaugh
54fc3831f2 [core] Use Seconds::max() rather than -1 for simpler logic 2016-01-13 13:38:12 -08:00
John Firebaugh
96781c0a8d [core] Inline OnlineFileRequestImpl::setResponse
In the cache response case, we don't want the failedRequests logic; cached errors, should they occur, shouldn't affect the scheduling behavior for real requests.
2016-01-13 13:38:12 -08:00
John Firebaugh
601e3d9d45 [core] Refactor down to two methods for scheduling a cache or real request 2016-01-13 13:38:12 -08:00
John Firebaugh
682b2335e5 [core] Inline OnlineFileRequestImpl::getRetryTimeout 2016-01-13 13:38:12 -08:00
John Firebaugh
ea45075e4d [core] Inline OnlineFileRequestImpl::checkResponseFreshness 2016-01-13 13:38:12 -08:00
John Firebaugh
6f9de6ae47 [core] Refactor to instance methods on OnlineFileRequestImpl 2016-01-13 13:38:12 -08:00
John Firebaugh
e9eb29719b [core] Simplify logic for notification with pre-existing response
We already had a condition that checks if a response is immediately available for an incoming request. Call the callback there, rather than in addObserver.
2016-01-13 13:38:12 -08:00
John Firebaugh
dd3ca81589 [core] Inline sole use of OnlineFileSource::Impl::update 2016-01-13 13:38:12 -08:00
John Firebaugh
f8d3cf41ae [core] Simplify OnlineFileSource::Impl::reschedule 2016-01-13 13:38:12 -08:00
Thiago Marcos P. Santos
d7fdcc73bf [core] Get rid of ::unref() for Timer and AsyncTask
Not need, legacy from libuv. The RunLoop keep the main
loop running until is explicitly no longer needed.
2016-01-09 01:26:29 +02:00
John Firebaugh
0a8fef1f51 [core] Merge OnlineFileRequestImpl::notify into OnlineFileRequestImpl::setResponse
In every case where setResponse is called, notify was called soon after. In one case immediately, in another, after intervening functions which are safe to reorder after notifications.

The null-check of response is safe to eliminate because response must not be null inside setResponse.
2016-01-08 12:29:11 -08:00
John Firebaugh
adf3dea4e5 [core] Simplify OnlineFileSource's Timer use
There is no need for the timer to be created only under certain conditions. Stopping a non-started timer is a no-op. Therefore it can simply be a direct member.

While here, rename the variable. It's a timer, not a request.
2016-01-08 12:23:48 -08:00
Konstantin Käfer
a06f28ddb7 [core] only cache successful or NotFound responses
We don't want other types of error end up in our cache, since it'll likely evict perfectly good content.
2016-01-08 16:25:54 +01:00
Konstantin Käfer
4479f5db6c [core] don't consult cache for asset resources 2016-01-08 13:05:51 +01:00
Konstantin Käfer
bc309d84d7 [core] unify URL prefix detection (asset:// and mapbox://) 2016-01-08 12:14:39 +01:00
John Firebaugh
7a6076ea9d [tests] Test with OnlineFileSource
When we introduce OfflineFileSource, the behavior of existing tests should
not change.
2015-12-23 14:55:12 -08:00
John Firebaugh
c972a251da [core] Remove Resource dependency from low-level classes
These classes should not be coupled to domain-specific resource types.
2015-12-23 14:30:20 -08:00
John Firebaugh
ab0efe5d00 [core] Move OnlineFileSource to platform
Preparation for OfflineFileSource which depends on SQLite
2015-12-22 12:09:14 -08:00