mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 14:58:37 +09:00
moebius#161: The Performance Resource Timing (make timestamps be relative to startTime)
https://github.com/MoonchildProductions/moebius/pull/161
This commit is contained in:
parent
5558924d7c
commit
e8dbb561f6
20 changed files with 520 additions and 154 deletions
|
|
@ -25,7 +25,8 @@ NS_IMPL_RELEASE_INHERITED(PerformanceResourceTiming, PerformanceEntry)
|
|||
|
||||
PerformanceResourceTiming::PerformanceResourceTiming(PerformanceTiming* aPerformanceTiming,
|
||||
Performance* aPerformance,
|
||||
const nsAString& aName)
|
||||
const nsAString& aName,
|
||||
nsIHttpChannel* aChannel)
|
||||
: PerformanceEntry(aPerformance, aName, NS_LITERAL_STRING("resource")),
|
||||
mTiming(aPerformanceTiming),
|
||||
mEncodedBodySize(0),
|
||||
|
|
@ -33,6 +34,34 @@ PerformanceResourceTiming::PerformanceResourceTiming(PerformanceTiming* aPerform
|
|||
mDecodedBodySize(0)
|
||||
{
|
||||
MOZ_ASSERT(aPerformance, "Parent performance object should be provided");
|
||||
SetPropertiesFromChannel(aChannel);
|
||||
}
|
||||
|
||||
void
|
||||
PerformanceResourceTiming::SetPropertiesFromChannel(nsIHttpChannel* aChannel)
|
||||
{
|
||||
if (!aChannel) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoCString protocol;
|
||||
Unused << aChannel->GetProtocolVersion(protocol);
|
||||
SetNextHopProtocol(NS_ConvertUTF8toUTF16(protocol));
|
||||
|
||||
uint64_t encodedBodySize = 0;
|
||||
Unused << aChannel->GetEncodedBodySize(&encodedBodySize);
|
||||
SetEncodedBodySize(encodedBodySize);
|
||||
|
||||
uint64_t transferSize = 0;
|
||||
Unused << aChannel->GetTransferSize(&transferSize);
|
||||
SetTransferSize(transferSize);
|
||||
|
||||
uint64_t decodedBodySize = 0;
|
||||
Unused << aChannel->GetDecodedBodySize(&decodedBodySize);
|
||||
if (decodedBodySize == 0) {
|
||||
decodedBodySize = encodedBodySize;
|
||||
}
|
||||
SetDecodedBodySize(decodedBodySize);
|
||||
}
|
||||
|
||||
PerformanceResourceTiming::~PerformanceResourceTiming()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue