diff --git a/platform/darwin/http_request_nsurl.mm b/platform/darwin/http_request_nsurl.mm index 207c33b23..10774587c 100644 --- a/platform/darwin/http_request_nsurl.mm +++ b/platform/darwin/http_request_nsurl.mm @@ -1,4 +1,5 @@ #include +#include #include #include @@ -12,36 +13,6 @@ namespace mbgl { -enum class ResponseStatus : uint8_t { - // This error probably won't be resolved by retrying anytime soon. We are giving up. - PermanentError, - - // This error might be resolved by waiting some time (e.g. server issues). - // We are going to do an exponential back-off and will try again in a few seconds. - TemporaryError, - - // This error was caused by a temporary error and it is likely that it will be resolved - // immediately. We are going to try again right away. This is like the TemporaryError, except - // that we will not perform exponential back-off. - SingularError, - - // This error might be resolved once the network reachability status changes. - // We are going to watch the network status for changes and will retry as soon as the - // operating system notifies us of a network status change. - ConnectionError, - - // The request was canceled mid-way. - Canceled, - - // The request returned data successfully. We retrieved and decoded the data successfully. - Successful, - - // The request confirmed that the data wasn't changed. We already have the data. - NotModified, -}; - -// ------------------------------------------------------------------------------------------------- - class HTTPNSURLContext; class HTTPRequest : public RequestBase { diff --git a/platform/default/http_request_curl.cpp b/platform/default/http_request_curl.cpp index b3d6418c0..cdd1de9dd 100644 --- a/platform/default/http_request_curl.cpp +++ b/platform/default/http_request_curl.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -34,26 +35,6 @@ void handleError(CURLcode code) { namespace mbgl { -enum class ResponseStatus : int8_t { - // This error probably won't be resolved by retrying anytime soon. We are giving up. - PermanentError, - - // This error might be resolved by waiting some time (e.g. server issues). - // We are going to do an exponential back-off and will try again in a few seconds. - TemporaryError, - - // This error might be resolved once the network reachability status changes. - // We are going to watch the network status for changes and will retry as soon as the - // operating system notifies us of a network status change. - ConnectionError, - - // The request returned data successfully. We retrieved and decoded the data successfully. - Successful, - - // The request confirmed that the data wasn't changed. We already have the data. - NotModified, -}; - class HTTPRequest; class HTTPCURLContext : public HTTPContext { diff --git a/src/mbgl/storage/http_request_base.hpp b/src/mbgl/storage/http_request_base.hpp new file mode 100644 index 000000000..2e976a856 --- /dev/null +++ b/src/mbgl/storage/http_request_base.hpp @@ -0,0 +1,36 @@ +#ifndef MBGL_STORAGE_HTTP_REQUEST_BASE +#define MBGL_STORAGE_HTTP_REQUEST_BASE + +namespace mbgl { + +enum class ResponseStatus : uint8_t { + // This error probably won't be resolved by retrying anytime soon. We are giving up. + PermanentError, + + // This error might be resolved by waiting some time (e.g. server issues). + // We are going to do an exponential back-off and will try again in a few seconds. + TemporaryError, + + // This error was caused by a temporary error and it is likely that it will be resolved + // immediately. We are going to try again right away. This is like the TemporaryError, except + // that we will not perform exponential back-off. + SingularError, + + // This error might be resolved once the network reachability status changes. + // We are going to watch the network status for changes and will retry as soon as the + // operating system notifies us of a network status change. + ConnectionError, + + // The request was canceled mid-way. + Canceled, + + // The request returned data successfully. We retrieved and decoded the data successfully. + Successful, + + // The request confirmed that the data wasn't changed. We already have the data. + NotModified, +}; + +} // namespace mbgl + +#endif // MBGL_STORAGE_HTTP_REQUEST_BASE