Eine aufbereitete Darstellung der Quelle

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

Benutzer

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


/* Smart pointer which leaks its owning refcounted object by default. */

#ifndef MaybeLeakRefPtr_h
#define MaybeLeakRefPtr_h

#include "mozilla/RefPtr.h"

namespace mozilla {

/**
 * Instances of this class are a RefPtr<T> which may not call Release() from its
 * destructor. This is done by leaking the stored reference on destruction.
 *
 * This behaviour is customizable for methods like nsIEventTarget::Dispatch
 * which have customizable leak-on-error semantics.
 */

template <class T>
class MaybeLeakRefPtr : public RefPtr<T> {
 public:
  explicit MaybeLeakRefPtr(already_AddRefed<T>&& aPtr, bool aAutoRelease)
      : RefPtr<T>(std::move(aPtr)), mAutoRelease(aAutoRelease) {}
  MaybeLeakRefPtr(const MaybeLeakRefPtr&) = delete;
  MaybeLeakRefPtr& operator=(const MaybeLeakRefPtr&) = delete;

  ~MaybeLeakRefPtr() {
    if (!mAutoRelease) {
      // If mAutoRelease is not set, take the value out of this and leak it
      // before the base class destructor would call Release().
      RefPtr<T>::forget().leak();
    }
  }

 private:
  bool mAutoRelease = false;
};

}  // namespace mozilla

#endif  // MaybeLeakRefPtr_h

Messung V0.5 in Prozent
C=93 H=97 G=94

¤ Dauer der Verarbeitung: 0.18 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