Eine aufbereitete Darstellung der Quelle

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

Benutzer

Quelle  Connection.cpp

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


#include "Connection.h"
#include "ConnectionMainThread.h"
#include "ConnectionWorker.h"
#include "Constants.h"
#include "mozilla/dom/WorkerPrivate.h"

/**
 * We have to use macros here because our leak analysis tool things we are
 * leaking strings when we have |static const nsString|. Sad :(
 */

#define CHANGE_EVENT_NAME u"typechange"_ns

namespace mozilla::dom::network {

// Don't use |Connection| alone, since that confuses nsTraceRefcnt since
// we're not the only class with that name.
NS_IMPL_ISUPPORTS_INHERITED0(dom::network::Connection, DOMEventTargetHelper)

Connection::Connection(nsPIDOMWindowInner* aWindow,
                       bool aShouldResistFingerprinting)
    : DOMEventTargetHelper(aWindow),
      mShouldResistFingerprinting(aShouldResistFingerprinting),
      mType(static_cast<ConnectionType>(kDefaultType)),
      mIsWifi(kDefaultIsWifi),
      mDHCPGateway(kDefaultDHCPGateway),
      mBeenShutDown(false) {}

Connection::~Connection() {
  NS_ASSERT_OWNINGTHREAD(Connection);
  MOZ_ASSERT(mBeenShutDown);
}

void Connection::Shutdown() {
  NS_ASSERT_OWNINGTHREAD(Connection);

  if (mBeenShutDown) {
    return;
  }

  mBeenShutDown = true;
  ShutdownInternal();
}

JSObject* Connection::WrapObject(JSContext* aCx,
                                 JS::Handle<JSObject*> aGivenProto) {
  return NetworkInformation_Binding::Wrap(aCx, this, aGivenProto);
}

void Connection::Update(ConnectionType aType, bool aIsWifi,
                        uint32_t aDHCPGateway, bool aNotify) {
  NS_ASSERT_OWNINGTHREAD(Connection);

  ConnectionType previousType = mType;

  mType = aType;
  mIsWifi = aIsWifi;
  mDHCPGateway = aDHCPGateway;

  if (aNotify && previousType != aType && !mShouldResistFingerprinting) {
    DispatchTrustedEvent(CHANGE_EVENT_NAME);
  }
}

/* static */
Connection* Connection::CreateForWindow(nsPIDOMWindowInner* aWindow,
                                        bool aShouldResistFingerprinting) {
  MOZ_ASSERT(aWindow);
  return new ConnectionMainThread(aWindow, aShouldResistFingerprinting);
}

/* static */
already_AddRefed<Connection> Connection::CreateForWorker(
    WorkerPrivate* aWorkerPrivate, ErrorResult& aRv) {
  MOZ_ASSERT(aWorkerPrivate);
  aWorkerPrivate->AssertIsOnWorkerThread();
  return ConnectionWorker::Create(aWorkerPrivate, aRv);
}

}  // namespace mozilla::dom::network

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

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

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