mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 1147857: followup patch to continue BuildStats cleanup r=jib
This commit is contained in:
parent
f3376e46f8
commit
17af11b276
@ -2810,13 +2810,6 @@ PeerConnectionImpl::BuildStatsQuery_m(
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
// Note: mMedia->ice_ctx() is deleted on STS thread; so make sure we grab and hold
|
||||
// a ref instead of making multiple calls. NrIceCtx uses threadsafe refcounting.
|
||||
query->iceCtx = mMedia->ice_ctx();
|
||||
if (!query->iceCtx) {
|
||||
CSFLogError(logTag, "Could not build stats query, no ice_ctx");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
if (!mThread) {
|
||||
CSFLogError(logTag, "Could not build stats query, no MainThread");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
@ -2828,6 +2821,16 @@ PeerConnectionImpl::BuildStatsQuery_m(
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Note: mMedia->ice_ctx() is deleted on STS thread; so make sure we grab and hold
|
||||
// a ref instead of making multiple calls. NrIceCtx uses threadsafe refcounting.
|
||||
// NOTE: Do this after all other failure tests, to ensure we don't
|
||||
// accidentally release the Ctx on Mainthread.
|
||||
query->iceCtx = mMedia->ice_ctx();
|
||||
if (!query->iceCtx) {
|
||||
CSFLogError(logTag, "Could not build stats query, no ice_ctx");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
// We do not use the pcHandle here, since that's risky to expose to content.
|
||||
query->report = new RTCStatsReportInternalConstruct(
|
||||
NS_ConvertASCIItoUTF16(mName.c_str()),
|
||||
|
@ -167,23 +167,31 @@ WebrtcGlobalInformation::GetAllStats(
|
||||
pcIdFilter.Value().EqualsASCII(p->second->GetIdAsAscii().c_str())) {
|
||||
if (p->second->HasMedia()) {
|
||||
queries->append(nsAutoPtr<RTCStatsQuery>(new RTCStatsQuery(true)));
|
||||
p->second->BuildStatsQuery_m(nullptr, // all tracks
|
||||
queries->back());
|
||||
if (NS_WARN_IF(NS_FAILED(p->second->BuildStatsQuery_m(nullptr, // all tracks
|
||||
queries->back())))) {
|
||||
queries->popBack();
|
||||
} else {
|
||||
MOZ_ASSERT(queries->back()->report);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CallbackObject does not support threadsafe refcounting, and must be
|
||||
// destroyed on main.
|
||||
nsMainThreadPtrHandle<WebrtcGlobalStatisticsCallback> callbackHandle(
|
||||
new nsMainThreadPtrHolder<WebrtcGlobalStatisticsCallback>(&aStatsCallback));
|
||||
if (!queries->empty()) {
|
||||
// CallbackObject does not support threadsafe refcounting, and must be
|
||||
// destroyed on main.
|
||||
nsMainThreadPtrHandle<WebrtcGlobalStatisticsCallback> callbackHandle(
|
||||
new nsMainThreadPtrHolder<WebrtcGlobalStatisticsCallback>(&aStatsCallback));
|
||||
|
||||
rv = RUN_ON_THREAD(stsThread,
|
||||
WrapRunnableNM(&GetAllStats_s, callbackHandle, queries),
|
||||
NS_DISPATCH_NORMAL);
|
||||
rv = RUN_ON_THREAD(stsThread,
|
||||
WrapRunnableNM(&GetAllStats_s, callbackHandle, queries),
|
||||
NS_DISPATCH_NORMAL);
|
||||
|
||||
aRv = rv;
|
||||
aRv = rv;
|
||||
} else {
|
||||
aRv = NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user