Eine aufbereitete Darstellung der Quelle

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

Benutzer

Quelle  BoundStorageKeyChild.cpp

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


#include "BoundStorageKeyChild.h"

#include "mozilla/dom/cache/CacheChild.h"
#include "mozilla/dom/cache/CacheOpChild.h"
#include "mozilla/dom/cache/CacheStorage.h"
#include "mozilla/dom/cache/CacheWorkerRef.h"
#include "mozilla/dom/cache/PCacheStorageChild.h"

namespace mozilla::dom::cache {

BoundStorageKeyChild::BoundStorageKeyChild(
    BoundStorageKeyChildListener* aListener)
    : mListener(aListener), mDelayedDestroy(false) {
  MOZ_COUNT_CTOR(BoundStorageKeyChild);
  MOZ_DIAGNOSTIC_ASSERT(mListener);
}

BoundStorageKeyChild::~BoundStorageKeyChild() {
  MOZ_COUNT_DTOR(BoundStorageKeyChild);
  NS_ASSERT_OWNINGTHREAD(BoundStorageKeyChild);
  MOZ_DIAGNOSTIC_ASSERT(!mListener);
}

void BoundStorageKeyChild::ClearListener() {
  NS_ASSERT_OWNINGTHREAD(BoundStorageKeyChild);
  MOZ_DIAGNOSTIC_ASSERT(mListener);
  mListener = nullptr;
}

void BoundStorageKeyChild::StartDestroyFromListener() {
  NS_ASSERT_OWNINGTHREAD(BoundStorageKeyChild);

  StartDestroy();
}

void BoundStorageKeyChild::DestroyInternal() {
  BoundStorageKeyChildListener* listener = mListener;

  // Theoretically we can get double called if the right race happens.  Handle
  // that by just ignoring the second StartDestroy() call.
  if (!listener) {
    return;
  }

  listener->OnActorDestroy(this);

  // listener should call ClearListener() in OnActorDestroy()
  MOZ_DIAGNOSTIC_ASSERT(!mListener);
}

void BoundStorageKeyChild::StartDestroy() {
  // StartDestroy() can get called from either child actor or the
  // CacheWorkerRef.
  NS_ASSERT_OWNINGTHREAD(BoundStorageKeyChild);

  if (NumChildActors() != 0) {
    mDelayedDestroy = true;
    return;
  }
  DestroyInternal();
}

void BoundStorageKeyChild::NoteDeletedActor() {
  // Check to see if DestroyInternal was delayed because of active CacheOpChilds
  // when StartDestroy was called from WorkerRef notification. If the last
  // CacheOpChild is getting destructed; it's the time for us to SendTearDown to
  // the other side.
  if (mDelayedDestroy && NumChildActors() == 0) {
    DestroyInternal();
  }
}

void BoundStorageKeyChild::ActorDestroy(ActorDestroyReason aReason) {
  NS_ASSERT_OWNINGTHREAD(BoundStorageKeyChild);
  BoundStorageKeyChildListener* listener = mListener;
  if (listener) {
    listener->OnActorDestroy(this);
    // listener should call ClearListener() in OnActorDestroy()
    MOZ_DIAGNOSTIC_ASSERT(!mListener);
  }
}

}  // namespace mozilla::dom::cache

Messung V0.5 in Prozent
C=93 H=95 G=93

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