Bug 1231975 - Part 3: Break a reference cycle between PendingResolution and DNSRequestChild. r=drno

MozReview-Commit-ID: CS1q6LyUsIe

--HG--
extra : rebase_source : d42f45b1e2bd7b96808ca814d25258904ce6ebfe
extra : source : 68ac205949c9b5d57f85689f660ebf9de119d384
This commit is contained in:
Byron Campen [:bwc] 2016-04-07 13:12:54 -05:00
Родитель 7239d5fd9b
Коммит 0654267081
2 изменённых файлов: 4 добавлений и 5 удалений

Просмотреть файл

@ -199,7 +199,7 @@ nsresult NrIceResolver::PendingResolution::OnLookupComplete(
ASSERT_ON_THREAD(thread_);
// First check if we've been canceled. This is single-threaded on the STS
// thread, but cancel() cannot guarantee this event isn't on the queue.
if (!canceled_) {
if (request_) {
nr_transport_addr *cb_addr = nullptr;
nr_transport_addr ta;
// TODO(jib@mozilla.com): Revisit when we do TURN.
@ -212,6 +212,7 @@ nsresult NrIceResolver::PendingResolution::OnLookupComplete(
}
}
cb_(cb_arg_, cb_addr);
request_ = nullptr;
Release();
}
return NS_OK;
@ -226,7 +227,7 @@ int NrIceResolver::cancel(void *obj, void *handle) {
int NrIceResolver::PendingResolution::cancel() {
request_->Cancel (NS_ERROR_ABORT);
canceled_ = true; // in case OnLookupComplete is already on event queue.
request_ = nullptr;
Release();
return 0;
}

Просмотреть файл

@ -95,8 +95,7 @@ class NrIceResolver
thread_(thread),
port_(port),
transport_(transport),
cb_(cb), cb_arg_(cb_arg),
canceled_ (false) {}
cb_(cb), cb_arg_(cb_arg) {}
NS_IMETHOD OnLookupComplete(nsICancelable *request, nsIDNSRecord *record,
nsresult status) override;
int cancel();
@ -110,7 +109,6 @@ class NrIceResolver
int transport_;
int (*cb_)(void *cb_arg, nr_transport_addr *addr);
void *cb_arg_;
bool canceled_;
};
nr_resolver_vtbl* vtbl_;