Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  PerformanceEventTiming.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/. */


#ifndef mozilla_dom_PerformanceEventTiming_h___
#define mozilla_dom_PerformanceEventTiming_h___

#include "mozilla/dom/PerformanceEntry.h"
#include "mozilla/EventForwards.h"
#include "nsRFPService.h"
#include "Performance.h"
#include "nsIWeakReferenceUtils.h"
#include "nsINode.h"

namespace mozilla {
class WidgetEvent;
namespace dom {

class PerformanceEventTiming final
    : public PerformanceEntry,
      public LinkedListElement<RefPtr<PerformanceEventTiming>> {
 public:
  NS_DECL_ISUPPORTS_INHERITED

  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(PerformanceEventTiming,
                                           PerformanceEntry)

  static already_AddRefed<PerformanceEventTiming> TryGenerateEventTiming(
      const EventTarget* aTarget, const WidgetEvent* aEvent);

  already_AddRefed<PerformanceEventTiming> Clone() {
    RefPtr<PerformanceEventTiming> eventTiming =
        new PerformanceEventTiming(*this);
    return eventTiming.forget();
  }

  JSObject* WrapObject(JSContext* cx,
                       JS::Handle<JSObject*> aGivenProto) override;

  DOMHighResTimeStamp ProcessingStart() const {
    if (mCachedProcessingStart.isNothing()) {
      mCachedProcessingStart.emplace(nsRFPService::ReduceTimePrecisionAsMSecs(
          mProcessingStart, mPerformance->GetRandomTimelineSeed(),
          mPerformance->GetRTPCallerType()));
    }
    return mCachedProcessingStart.value();
  }

  DOMHighResTimeStamp ProcessingEnd() const {
    if (mCachedProcessingEnd.isNothing()) {
      mCachedProcessingEnd.emplace(nsRFPService::ReduceTimePrecisionAsMSecs(
          mProcessingEnd, mPerformance->GetRandomTimelineSeed(),
          mPerformance->GetRTPCallerType()));
    }
    return mCachedProcessingEnd.value();
  }

  bool Cancelable() const { return mCancelable; }

  nsINode* GetTarget() const;

  void SetDuration(const DOMHighResTimeStamp aDuration) {
    mDuration = aDuration;
  }

  // nsRFPService::ReduceTimePrecisionAsMSecs might causes
  // some memory overhead, using the raw timestamp internally
  // to avoid calling in unnecessarily.
  DOMHighResTimeStamp RawDuration() const { return mDuration; }

  DOMHighResTimeStamp Duration() const override {
    if (mCachedDuration.isNothing()) {
      mCachedDuration.emplace(nsRFPService::ReduceTimePrecisionAsMSecs(
          mDuration, mPerformance->GetRandomTimelineSeed(),
          mPerformance->GetRTPCallerType()));
    }
    return mCachedDuration.value();
  }

  // Similar as RawDuration; Used to avoid calling
  // nsRFPService::ReduceTimePrecisionAsMSecs unnecessarily.
  DOMHighResTimeStamp RawStartTime() const { return mStartTime; }

  DOMHighResTimeStamp StartTime() const override {
    if (mCachedStartTime.isNothing()) {
      mCachedStartTime.emplace(nsRFPService::ReduceTimePrecisionAsMSecs(
          mStartTime, mPerformance->GetRandomTimelineSeed(),
          mPerformance->GetRTPCallerType()));
    }
    return mCachedStartTime.value();
  }

  bool ShouldAddEntryToBuffer(double aDuration) const;
  bool ShouldAddEntryToObserverBuffer(PerformanceObserverInit&) const override;

  void BufferEntryIfNeeded() override;

  void FinalizeEventTiming(EventTarget* aTarget);

  EventMessage GetMessage() const { return mMessage; }

 private:
  PerformanceEventTiming(Performance* aPerformance, const nsAString& aName,
                         const TimeStamp& aStartTime, bool aIsCacelable,
                         EventMessage aMessage);

  PerformanceEventTiming(const PerformanceEventTiming& aEventTimingEntry);

  ~PerformanceEventTiming() = default;

  RefPtr<Performance> mPerformance;

  DOMHighResTimeStamp mProcessingStart;
  mutable Maybe<DOMHighResTimeStamp> mCachedProcessingStart;

  DOMHighResTimeStamp mProcessingEnd;
  mutable Maybe<DOMHighResTimeStamp> mCachedProcessingEnd;

  nsWeakPtr mTarget;

  DOMHighResTimeStamp mStartTime;
  mutable Maybe<DOMHighResTimeStamp> mCachedStartTime;

  DOMHighResTimeStamp mDuration;
  mutable Maybe<DOMHighResTimeStamp> mCachedDuration;

  bool mCancelable;

  EventMessage mMessage;
};
}  // namespace dom
}  // namespace mozilla

#endif

Messung V0.5 in Prozent
C=93 H=100 G=96

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet am  2026-06-05) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

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 und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik