summaryrefslogtreecommitdiff
path: root/platform/darwin
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-04-17 09:58:24 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-04-28 09:16:26 -0400
commitcdd8f3ac3235e1d5aab47a6d32c48a0b82a3a1b9 (patch)
treebcfa045fa4527a6f3fba094b49ecb981f671425d /platform/darwin
parent359aca6624f183099a9afe58aae5a41bd2cb3772 (diff)
downloadqtlocation-mapboxgl-cdd8f3ac3235e1d5aab47a6d32c48a0b82a3a1b9.tar.gz
Separate RequestBase from DefaultFileSource internals
SharedRequestBase was trying to do two different jobs: be a base class for Asset/HttpRequest and track internal state for DefaultFileSource. Now we have RequestBase for the former, and DefaultFileRequest for the latter.
Diffstat (limited to 'platform/darwin')
-rw-r--r--platform/darwin/http_request_nsurl.mm13
1 files changed, 3 insertions, 10 deletions
diff --git a/platform/darwin/http_request_nsurl.mm b/platform/darwin/http_request_nsurl.mm
index 24b31ae0a9..07ac16e058 100644
--- a/platform/darwin/http_request_nsurl.mm
+++ b/platform/darwin/http_request_nsurl.mm
@@ -1,5 +1,6 @@
#include <mbgl/storage/http_request.hpp>
#include <mbgl/storage/http_context.hpp>
+#include <mbgl/storage/resource.hpp>
#include <mbgl/storage/response.hpp>
#include <mbgl/util/uv.hpp>
@@ -397,36 +398,28 @@ void HTTPRequestImpl::restart(uv_timer_t *timer, int) {
// -------------------------------------------------------------------------------------------------
-HTTPRequest::HTTPRequest(DefaultFileSource::Impl &source, const Resource &resource)
- : SharedRequestBase(source, resource) {
+HTTPRequest::HTTPRequest(const Resource& resource, Callback callback)
+ : RequestBase(resource, callback) {
}
HTTPRequest::~HTTPRequest() {
- MBGL_VERIFY_THREAD(tid);
-
if (ptr) {
reinterpret_cast<HTTPRequestImpl *>(ptr)->cancel();
}
}
void HTTPRequest::start(uv_loop_t *loop, std::shared_ptr<const Response> response) {
- MBGL_VERIFY_THREAD(tid);
-
assert(!ptr);
ptr = new HTTPRequestImpl(this, loop, response);
}
void HTTPRequest::retryImmediately() {
- MBGL_VERIFY_THREAD(tid);
-
if (ptr) {
reinterpret_cast<HTTPRequestImpl *>(ptr)->retryImmediately();
}
}
void HTTPRequest::cancel() {
- MBGL_VERIFY_THREAD(tid);
-
delete this;
}