Quellcode-Bibliothek PerformanceTiming.h
Sprache: C
/* -*- 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/. */
class PerformanceTiming; enumclass RenderBlockingStatusType : uint8_t;
class PerformanceTimingData final : public CacheablePerformanceTimingData { friendclass PerformanceTiming; friendstruct mozilla::ipc::IPDLParamTraits<
mozilla::dom::PerformanceTimingData>;
/** * @param aStamp * The TimeStamp recorded for a specific event. This TimeStamp can * be null. * @return the duration of an event with a given TimeStamp, relative to the * navigationStart TimeStamp (the moment the user landed on the * page), if the given TimeStamp is valid. Otherwise, it will return * the FetchStart timing value.
*/ inline DOMHighResTimeStamp TimeStampToReducedDOMHighResOrFetchStart(
Performance* aPerformance, TimeStamp aStamp) {
MOZ_ASSERT(aPerformance);
if (aStamp.IsNull()) { return FetchStartHighRes(aPerformance);
}
/** * The nsITimedChannel records an absolute timestamp for each event. * The nsDOMNavigationTiming will record the moment when the user landed on * the page. This is a window.performance unique timestamp, so it can be used * for all the events (navigation timing and resource timing events). * * The algorithm operates in 2 steps: * 1. The first step is to subtract the two timestamps: the argument (the * event's timestamp) and the navigation start timestamp. This will result in * a relative timestamp of the event (relative to the navigation start - * window.performance.timing.navigationStart). * 2. The second step is to add any required offset (the mZeroTime). For now, * this offset value is either 0 (for the resource timing), or equal to * "performance.navigationStart" (for navigation timing). * For the resource timing, mZeroTime is set to 0, causing the result to be a * relative time. * For the navigation timing, mZeroTime is set to * "performance.navigationStart" causing the result be an absolute time. * * @param aStamp * The TimeStamp recorded for a specific event. This TimeStamp can't * be null. * @return number of milliseconds value as one of: * - relative to the navigation start time, time the user has landed on the * page * - an absolute wall clock time since the unix epoch
*/ inline DOMHighResTimeStamp TimeStampToDOMHighRes(Performance* aPerformance,
TimeStamp aStamp) const {
MOZ_ASSERT(aPerformance);
MOZ_ASSERT(!aStamp.IsNull());
// The last channel's AsyncOpen time. This may occur before the FetchStart // in some cases.
DOMHighResTimeStamp AsyncOpenHighRes(Performance* aPerformance);
// If this is false the values of redirectStart/End will be 0 This is false if // no redirects occured, or if any of the responses failed the // timing-allow-origin check in HttpBaseChannel::TimingAllowCheck // // If aEnsureSameOriginAndIgnoreTAO is false, it checks if all redirects pass // TAO. When it is true, it checks if all redirects are same-origin and // ignores the result of TAO. bool ShouldReportCrossOriginRedirect( bool aEnsureSameOriginAndIgnoreTAO) const;
// This is an offset that will be added to each timing ([ms] resolution). // There are only 2 possible values: (1) logicaly equal to navigationStart // TimeStamp (results are absolute timstamps - wallclock); (2) "0" (results // are relative to the navigation start).
DOMHighResTimeStamp mZeroTime = 0;
// Script "performance.timing" object class PerformanceTiming final : public nsWrapperCache { public: /** * @param aPerformance * The performance object (the JS parent). * This will allow access to "window.performance.timing" attribute * for the navigation timing (can't be null). * @param aChannel * An nsITimedChannel used to gather all the networking timings by * both the navigation timing and the resource timing (can't be null). * @param aHttpChannel * An nsIHttpChannel (the resource's http channel). * This will be used by the resource timing cross-domain check * algorithm. * Argument is null for the navigation timing (navigation timing uses * another algorithm for the cross-domain redirects). * @param aZeroTime * The offset that will be added to the timestamp of each event. This * argument should be equal to performance.navigationStart for * navigation timing and "0" for the resource timing.
*/
PerformanceTiming(Performance* aPerformance, nsITimedChannel* aChannel,
nsIHttpChannel* aHttpChannel,
DOMHighResTimeStamp aZeroTime);
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(PerformanceTiming)
NS_DECL_CYCLE_COLLECTION_NATIVE_WRAPPERCACHE_CLASS(PerformanceTiming)
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.4Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.