Eine aufbereitete Darstellung der Quelle

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

Benutzer

Quelle  AbortFollower.h

  Sprache: C
 

/* 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_AbortFollower_h
#define mozilla_dom_AbortFollower_h

#include "jsapi.h"
#include "mozilla/WeakPtr.h"
#include "nsISupportsImpl.h"
#include "nsTObserverArray.h"

namespace mozilla::dom {

enum class SignalAborted { No, Yes };

class AbortSignal;
class AbortSignalImpl;

// This class must be implemented by objects who want to follow an
// AbortSignalImpl.
class AbortFollower : public nsISupports {
 public:
  virtual void RunAbortAlgorithm() = 0;

  // This adds strong reference to this follower on the signal, which means
  // you'll need to call Unfollow() to prevent your object from living
  // needlessly longer.
  void Follow(AbortSignalImpl* aSignal);

  // Explicitly call this to let garbage collection happen sooner when the
  // follower finished its work and cannot be aborted anymore.
  void Unfollow();

  bool IsFollowing() const;

  AbortSignalImpl* Signal() const { return mFollowingSignal; }

 protected:
  virtual ~AbortFollower();

  friend class AbortSignalImpl;

  WeakPtr<AbortSignalImpl> mFollowingSignal;
};

/*
 * TODO(krosylight): The only consumer of this is Fetch. It would be nice to
 * merge this back to AbortSignal as it's quite a duplication right now.
 *
 * AbortSignalImpl is a minimal implementation without an associated global
 * and without event dispatching, those are added in AbortSignal.
 * See Bug 1478101
 */

class AbortSignalImpl : public nsISupports, public SupportsWeakPtr {
 public:
  explicit AbortSignalImpl(SignalAborted aAborted,
                           JS::Handle<JS::Value> aReason);

  bool Aborted() const;

  // Web IDL Layer
  void GetReason(JSContext* aCx, JS::MutableHandle<JS::Value> aReason);
  // Helper for other DOM code
  JS::Value RawReason() const;

  void SignalAbort(JS::Handle<JS::Value> aReason);

 protected:
  // Subclasses of this class must call these Traverse and Unlink functions
  // during corresponding cycle collection operations.
  static void Traverse(AbortSignalImpl* aSignal,
                       nsCycleCollectionTraversalCallback& cb);

  static void Unlink(AbortSignalImpl* aSignal);

  virtual ~AbortSignalImpl() { UnlinkFollowers(); }

  virtual void SignalAbortWithDependents();

  virtual void RunAbortSteps();

  void SetAborted(JS::Handle<JS::Value> aReason);

  JS::Heap<JS::Value> mReason;

 private:
  friend class AbortFollower;

  void MaybeAssignAbortError(JSContext* aCx);

  void UnlinkFollowers();

  // TODO(krosylight): We should rename all names around the term "Follow". See
  // bug 1873648.
  //
  // |AbortFollower::Follow| adds to this array, and
  // |AbortFollower::Unfollow| (also called by the destructor) will remove
  // from this array.  Finally, calling |SignalAbort()| will (after running all
  // abort algorithms) empty this and make all contained followers |Unfollow()|.
  nsTObserverArray<RefPtr<AbortFollower>> mFollowers;

  SignalAborted mAborted;
};

}  // namespace mozilla::dom

#endif  // mozilla_dom_AbortFollower_h

Messung V0.5 in Prozent
C=83 H=100 G=91

¤ Dauer der Verarbeitung: 0.14 Sekunden  (vorverarbeitet am  2026-08-25) ¤

*© 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

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002