summaryrefslogtreecommitdiff
path: root/platform/darwin
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-04-17 12:37:43 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-04-28 09:16:26 -0400
commit8e5fa341ebdc1699f08a1dbf4b0dfd98a9969948 (patch)
tree49da2be53cc5ef4ea1bdf3394dad10facf56a061 /platform/darwin
parentcdd8f3ac3235e1d5aab47a6d32c48a0b82a3a1b9 (diff)
downloadqtlocation-mapboxgl-8e5fa341ebdc1699f08a1dbf4b0dfd98a9969948.tar.gz
Remove RequestBase::start
Requests are always started immediately upon construction. While here, use typed pointers, not void*.
Diffstat (limited to 'platform/darwin')
-rw-r--r--platform/darwin/http_request_nsurl.mm23
1 files changed, 10 insertions, 13 deletions
diff --git a/platform/darwin/http_request_nsurl.mm b/platform/darwin/http_request_nsurl.mm
index 07ac16e058..f5e7888f57 100644
--- a/platform/darwin/http_request_nsurl.mm
+++ b/platform/darwin/http_request_nsurl.mm
@@ -200,7 +200,7 @@ void HTTPRequestImpl::handleResponse() {
}
context->removeRequest(request);
- request->ptr = nullptr;
+ request->impl = nullptr;
delete request;
request = nullptr;
}
@@ -243,7 +243,7 @@ HTTPRequestImpl::~HTTPRequestImpl() {
if (request) {
context->removeRequest(request);
- request->ptr = nullptr;
+ request->impl = nullptr;
}
}
@@ -398,24 +398,21 @@ void HTTPRequestImpl::restart(uv_timer_t *timer, int) {
// -------------------------------------------------------------------------------------------------
-HTTPRequest::HTTPRequest(const Resource& resource, Callback callback)
- : RequestBase(resource, callback) {
+HTTPRequest::HTTPRequest(const Resource& resource, Callback callback,
+ uv_loop_t* loop, std::shared_ptr<const Response> response)
+ : RequestBase(resource, callback)
+ , impl(new HTTPRequestImpl(this, loop, response)) {
}
HTTPRequest::~HTTPRequest() {
- if (ptr) {
- reinterpret_cast<HTTPRequestImpl *>(ptr)->cancel();
+ if (impl) {
+ impl->cancel();
}
}
-void HTTPRequest::start(uv_loop_t *loop, std::shared_ptr<const Response> response) {
- assert(!ptr);
- ptr = new HTTPRequestImpl(this, loop, response);
-}
-
void HTTPRequest::retryImmediately() {
- if (ptr) {
- reinterpret_cast<HTTPRequestImpl *>(ptr)->retryImmediately();
+ if (impl) {
+ impl->retryImmediately();
}
}