summaryrefslogtreecommitdiffstats
path: root/dom/performance/PerformanceResourceTiming.h
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/performance/PerformanceResourceTiming.h
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/performance/PerformanceResourceTiming.h')
-rw-r--r--dom/performance/PerformanceResourceTiming.h185
1 files changed, 185 insertions, 0 deletions
diff --git a/dom/performance/PerformanceResourceTiming.h b/dom/performance/PerformanceResourceTiming.h
new file mode 100644
index 000000000..abb653d66
--- /dev/null
+++ b/dom/performance/PerformanceResourceTiming.h
@@ -0,0 +1,185 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_dom_PerformanceResourceTiming_h___
+#define mozilla_dom_PerformanceResourceTiming_h___
+
+#include "nsCOMPtr.h"
+#include "nsIChannel.h"
+#include "nsITimedChannel.h"
+#include "Performance.h"
+#include "PerformanceEntry.h"
+#include "PerformanceTiming.h"
+
+namespace mozilla {
+namespace dom {
+
+// http://www.w3.org/TR/resource-timing/#performanceresourcetiming
+class PerformanceResourceTiming final : public PerformanceEntry
+{
+public:
+ typedef mozilla::TimeStamp TimeStamp;
+
+ NS_DECL_ISUPPORTS_INHERITED
+ NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
+ PerformanceResourceTiming,
+ PerformanceEntry)
+
+ PerformanceResourceTiming(PerformanceTiming* aPerformanceTiming,
+ Performance* aPerformance,
+ const nsAString& aName);
+
+ virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
+
+
+ virtual DOMHighResTimeStamp StartTime() const override;
+
+ virtual DOMHighResTimeStamp Duration() const override
+ {
+ return ResponseEnd() - StartTime();
+ }
+
+ void GetInitiatorType(nsAString& aInitiatorType) const
+ {
+ aInitiatorType = mInitiatorType;
+ }
+
+ void SetInitiatorType(const nsAString& aInitiatorType)
+ {
+ mInitiatorType = aInitiatorType;
+ }
+
+ void GetNextHopProtocol(nsAString& aNextHopProtocol) const
+ {
+ aNextHopProtocol = mNextHopProtocol;
+ }
+
+ void SetNextHopProtocol(const nsAString& aNextHopProtocol)
+ {
+ mNextHopProtocol = aNextHopProtocol;
+ }
+
+ DOMHighResTimeStamp FetchStart() const {
+ return mTiming
+ ? mTiming->FetchStartHighRes()
+ : 0;
+ }
+
+ DOMHighResTimeStamp RedirectStart() const {
+ // We have to check if all the redirect URIs had the same origin (since
+ // there is no check in RedirectEndHighRes())
+ return mTiming && mTiming->ShouldReportCrossOriginRedirect()
+ ? mTiming->RedirectStartHighRes()
+ : 0;
+ }
+
+ DOMHighResTimeStamp RedirectEnd() const {
+ // We have to check if all the redirect URIs had the same origin (since
+ // there is no check in RedirectEndHighRes())
+ return mTiming && mTiming->ShouldReportCrossOriginRedirect()
+ ? mTiming->RedirectEndHighRes()
+ : 0;
+ }
+
+ DOMHighResTimeStamp DomainLookupStart() const {
+ return mTiming && mTiming->TimingAllowed()
+ ? mTiming->DomainLookupStartHighRes()
+ : 0;
+ }
+
+ DOMHighResTimeStamp DomainLookupEnd() const {
+ return mTiming && mTiming->TimingAllowed()
+ ? mTiming->DomainLookupEndHighRes()
+ : 0;
+ }
+
+ DOMHighResTimeStamp ConnectStart() const {
+ return mTiming && mTiming->TimingAllowed()
+ ? mTiming->ConnectStartHighRes()
+ : 0;
+ }
+
+ DOMHighResTimeStamp ConnectEnd() const {
+ return mTiming && mTiming->TimingAllowed()
+ ? mTiming->ConnectEndHighRes()
+ : 0;
+ }
+
+ DOMHighResTimeStamp RequestStart() const {
+ return mTiming && mTiming->TimingAllowed()
+ ? mTiming->RequestStartHighRes()
+ : 0;
+ }
+
+ DOMHighResTimeStamp ResponseStart() const {
+ return mTiming && mTiming->TimingAllowed()
+ ? mTiming->ResponseStartHighRes()
+ : 0;
+ }
+
+ DOMHighResTimeStamp ResponseEnd() const {
+ return mTiming
+ ? mTiming->ResponseEndHighRes()
+ : 0;
+ }
+
+ DOMHighResTimeStamp SecureConnectionStart() const
+ {
+ // This measurement is not available for Navigation Timing either.
+ // There is a different bug submitted for it.
+ return 0;
+ }
+
+ virtual const PerformanceResourceTiming* ToResourceTiming() const override
+ {
+ return this;
+ }
+
+ uint64_t TransferSize() const
+ {
+ return mTiming && mTiming->TimingAllowed() ? mTransferSize : 0;
+ }
+
+ uint64_t EncodedBodySize() const
+ {
+ return mTiming && mTiming->TimingAllowed() ? mEncodedBodySize : 0;
+ }
+
+ uint64_t DecodedBodySize() const
+ {
+ return mTiming && mTiming->TimingAllowed() ? mDecodedBodySize : 0;
+ }
+
+ void SetEncodedBodySize(uint64_t aEncodedBodySize)
+ {
+ mEncodedBodySize = aEncodedBodySize;
+ }
+
+ void SetTransferSize(uint64_t aTransferSize)
+ {
+ mTransferSize = aTransferSize;
+ }
+
+ void SetDecodedBodySize(uint64_t aDecodedBodySize)
+ {
+ mDecodedBodySize = aDecodedBodySize;
+ }
+
+protected:
+ virtual ~PerformanceResourceTiming();
+
+ nsString mInitiatorType;
+ nsString mNextHopProtocol;
+ RefPtr<PerformanceTiming> mTiming;
+ uint64_t mEncodedBodySize;
+ uint64_t mTransferSize;
+ uint64_t mDecodedBodySize;
+};
+
+} // namespace dom
+} // namespace mozilla
+
+#endif /* mozilla_dom_PerformanceResourceTiming_h___ */