summaryrefslogtreecommitdiffstats
path: root/dom/performance/PerformanceResourceTiming.cpp
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-29 14:15:18 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-29 14:15:18 +0200
commit306db80410e802b0fe9a3b5273d4cf29586a1b17 (patch)
tree5e2370df03be5b04ea225afa1e720d46840dd9bf /dom/performance/PerformanceResourceTiming.cpp
parent92d3042138babf4f82d254f6cb6e11831dcca506 (diff)
downloadUXP-306db80410e802b0fe9a3b5273d4cf29586a1b17.tar
UXP-306db80410e802b0fe9a3b5273d4cf29586a1b17.tar.gz
UXP-306db80410e802b0fe9a3b5273d4cf29586a1b17.tar.lz
UXP-306db80410e802b0fe9a3b5273d4cf29586a1b17.tar.xz
UXP-306db80410e802b0fe9a3b5273d4cf29586a1b17.zip
moebius#161: The Performance Resource Timing (make timestamps be relative to startTime)
https://github.com/MoonchildProductions/moebius/pull/161
Diffstat (limited to 'dom/performance/PerformanceResourceTiming.cpp')
-rw-r--r--dom/performance/PerformanceResourceTiming.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/dom/performance/PerformanceResourceTiming.cpp b/dom/performance/PerformanceResourceTiming.cpp
index 94df27408..2eaa4eb9a 100644
--- a/dom/performance/PerformanceResourceTiming.cpp
+++ b/dom/performance/PerformanceResourceTiming.cpp
@@ -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()