mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 970685 - tweak internal RTCStatsQuery to use nsAutoPtr for report, so it can be stolen
This commit is contained in:
parent
5a69172b88
commit
723947759f
@ -263,7 +263,7 @@ EverySecondTelemetryCallback_s(nsAutoPtr<RTCStatsQueries> aQueryList) {
|
||||
|
||||
for (auto q = aQueryList->begin(); q != aQueryList->end(); ++q) {
|
||||
PeerConnectionImpl::ExecuteStatsQuery_s(*q);
|
||||
auto& r = (*q)->report;
|
||||
auto& r = *(*q)->report;
|
||||
if (r.mInboundRTPStreamStats.WasPassed()) {
|
||||
auto& array = r.mInboundRTPStreamStats.Value();
|
||||
for (uint32_t i = 0; i < array.Length(); i++) {
|
||||
|
@ -2151,7 +2151,7 @@ PeerConnectionImpl::BuildStatsQuery_m(
|
||||
}
|
||||
|
||||
// We do not use the pcHandle here, since that's risky to expose to content.
|
||||
query->report = RTCStatsReportInternalConstruct(
|
||||
query->report = new RTCStatsReportInternalConstruct(
|
||||
NS_ConvertASCIItoUTF16(mName.c_str()),
|
||||
query->now);
|
||||
|
||||
@ -2160,9 +2160,9 @@ PeerConnectionImpl::BuildStatsQuery_m(
|
||||
|
||||
// Populate SDP on main
|
||||
if (query->internalStats) {
|
||||
query->report.mLocalSdp.Construct(
|
||||
query->report->mLocalSdp.Construct(
|
||||
NS_ConvertASCIItoUTF16(mLocalSDP.c_str()));
|
||||
query->report.mRemoteSdp.Construct(
|
||||
query->report->mRemoteSdp.Construct(
|
||||
NS_ConvertASCIItoUTF16(mRemoteSDP.c_str()));
|
||||
}
|
||||
|
||||
@ -2353,7 +2353,7 @@ PeerConnectionImpl::ExecuteStatsQuery_s(RTCStatsQuery *query) {
|
||||
s.mBytesReceived.Construct(bytesReceived);
|
||||
s.mPacketsLost.Construct(packetsLost);
|
||||
s.mMozRtt.Construct(rtt);
|
||||
query->report.mInboundRTPStreamStats.Value().AppendElement(s);
|
||||
query->report->mInboundRTPStreamStats.Value().AppendElement(s);
|
||||
}
|
||||
}
|
||||
// Then, fill in local side (with cross-link to remote only if present)
|
||||
@ -2369,7 +2369,7 @@ PeerConnectionImpl::ExecuteStatsQuery_s(RTCStatsQuery *query) {
|
||||
s.mIsRemote = false;
|
||||
s.mPacketsSent.Construct(mp.rtp_packets_sent());
|
||||
s.mBytesSent.Construct(mp.rtp_bytes_sent());
|
||||
query->report.mOutboundRTPStreamStats.Value().AppendElement(s);
|
||||
query->report->mOutboundRTPStreamStats.Value().AppendElement(s);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -2400,7 +2400,7 @@ PeerConnectionImpl::ExecuteStatsQuery_s(RTCStatsQuery *query) {
|
||||
s.mIsRemote = true;
|
||||
s.mPacketsSent.Construct(packetsSent);
|
||||
s.mBytesSent.Construct(bytesSent);
|
||||
query->report.mOutboundRTPStreamStats.Value().AppendElement(s);
|
||||
query->report->mOutboundRTPStreamStats.Value().AppendElement(s);
|
||||
}
|
||||
}
|
||||
// Then, fill in local side (with cross-link to remote only if present)
|
||||
@ -2434,7 +2434,7 @@ PeerConnectionImpl::ExecuteStatsQuery_s(RTCStatsQuery *query) {
|
||||
s.mMozAvSyncDelay.Construct(avSyncDelta);
|
||||
}
|
||||
}
|
||||
query->report.mInboundRTPStreamStats.Value().AppendElement(s);
|
||||
query->report->mInboundRTPStreamStats.Value().AppendElement(s);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2445,7 +2445,7 @@ PeerConnectionImpl::ExecuteStatsQuery_s(RTCStatsQuery *query) {
|
||||
RecordIceStats_s(*query->streams[s],
|
||||
query->internalStats,
|
||||
query->now,
|
||||
&(query->report));
|
||||
query->report);
|
||||
}
|
||||
|
||||
// NrIceCtx and NrIceMediaStream must be destroyed on STS, so it is not safe
|
||||
@ -2488,7 +2488,7 @@ void PeerConnectionImpl::DeliverStatsReportToPCObserver_m(
|
||||
if (pco) {
|
||||
JSErrorResult rv;
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
pco->OnGetStatsSuccess(query->report, rv);
|
||||
pco->OnGetStatsSuccess(*query->report, rv);
|
||||
} else {
|
||||
pco->OnGetStatsError(kInternalError,
|
||||
ObString("Failed to fetch statistics"),
|
||||
|
@ -172,7 +172,7 @@ class RTCStatsQuery {
|
||||
explicit RTCStatsQuery(bool internalStats);
|
||||
~RTCStatsQuery();
|
||||
|
||||
mozilla::dom::RTCStatsReportInternal report;
|
||||
nsAutoPtr<mozilla::dom::RTCStatsReportInternal> report;
|
||||
std::string error;
|
||||
// A timestamp to help with telemetry.
|
||||
mozilla::TimeStamp iceStartTime;
|
||||
|
@ -57,7 +57,7 @@ static void OnStatsReport_m(
|
||||
// Reports for the currently active PeerConnections
|
||||
for (auto q = aQueryList->begin(); q != aQueryList->end(); ++q) {
|
||||
MOZ_ASSERT(*q);
|
||||
report.mReports.Value().AppendElement((*q)->report);
|
||||
report.mReports.Value().AppendElement(*(*q)->report);
|
||||
}
|
||||
|
||||
PeerConnectionCtx* ctx = GetPeerConnectionCtx();
|
||||
@ -240,11 +240,11 @@ static void StoreLongTermICEStatisticsImpl_m(
|
||||
|
||||
if (NS_FAILED(result) ||
|
||||
!query->error.empty() ||
|
||||
!query->report.mIceCandidateStats.WasPassed()) {
|
||||
!query->report->mIceCandidateStats.WasPassed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
query->report.mClosed.Construct(true);
|
||||
query->report->mClosed.Construct(true);
|
||||
|
||||
// First, store stuff in telemetry
|
||||
enum {
|
||||
@ -267,10 +267,10 @@ static void StoreLongTermICEStatisticsImpl_m(
|
||||
|
||||
// Build list of streams, and whether or not they failed.
|
||||
for (size_t i = 0;
|
||||
i < query->report.mIceCandidatePairStats.Value().Length();
|
||||
i < query->report->mIceCandidatePairStats.Value().Length();
|
||||
++i) {
|
||||
const RTCIceCandidatePairStats &pair =
|
||||
query->report.mIceCandidatePairStats.Value()[i];
|
||||
query->report->mIceCandidatePairStats.Value()[i];
|
||||
|
||||
if (!pair.mState.WasPassed() || !pair.mComponentId.WasPassed()) {
|
||||
MOZ_CRASH();
|
||||
@ -288,10 +288,10 @@ static void StoreLongTermICEStatisticsImpl_m(
|
||||
}
|
||||
|
||||
for (size_t i = 0;
|
||||
i < query->report.mIceCandidateStats.Value().Length();
|
||||
i < query->report->mIceCandidateStats.Value().Length();
|
||||
++i) {
|
||||
const RTCIceCandidateStats &cand =
|
||||
query->report.mIceCandidateStats.Value()[i];
|
||||
query->report->mIceCandidateStats.Value()[i];
|
||||
|
||||
if (!cand.mType.WasPassed() ||
|
||||
!cand.mCandidateType.WasPassed() ||
|
||||
@ -344,7 +344,7 @@ static void StoreLongTermICEStatisticsImpl_m(
|
||||
|
||||
PeerConnectionCtx *ctx = GetPeerConnectionCtx();
|
||||
if (ctx) {
|
||||
ctx->mStatsForClosedPeerConnections.AppendElement(query->report);
|
||||
ctx->mStatsForClosedPeerConnections.AppendElement(*query->report);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user