Bug 1147857: followup patch to continue BuildStats cleanup r=jib

This commit is contained in:
Randell Jesup 2015-03-28 21:45:42 -04:00
Родитель f3376e46f8
Коммит 17af11b276
2 изменённых файлов: 28 добавлений и 17 удалений

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

@ -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,13 +167,18 @@ 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);
}
}
}
}
}
if (!queries->empty()) {
// CallbackObject does not support threadsafe refcounting, and must be
// destroyed on main.
nsMainThreadPtrHandle<WebrtcGlobalStatisticsCallback> callbackHandle(
@ -184,6 +189,9 @@ WebrtcGlobalInformation::GetAllStats(
NS_DISPATCH_NORMAL);
aRv = rv;
} else {
aRv = NS_OK;
}
}
void