Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/dom/webserial/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 2 kB image not shown  

Quelle  SerialPortStreamAlgorithms.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_SerialPortStreamAlgorithms_h
#define mozilla_dom_SerialPortStreamAlgorithms_h

#include "mozilla/dom/UnderlyingSinkCallbackHelpers.h"
#include "mozilla/dom/UnderlyingSourceCallbackHelpers.h"

namespace mozilla::dom {

class SerialPort;

// Subclass of WritableStreamToOutputAlgorithms that adds serial-specific
// close (drain) and abort (flush) behavior. The base class handles all
// data writing to the DataPipeSender via WriteCallbackImpl.
class SerialPortWriteAlgorithms final
    : public WritableStreamToOutputAlgorithms {
 public:
  NS_DECL_ISUPPORTS_INHERITED
  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SerialPortWriteAlgorithms,
                                           WritableStreamToOutputAlgorithms)

  SerialPortWriteAlgorithms(nsIGlobalObject* aParent,
                            nsIAsyncOutputStream* aOutput, SerialPort* aPort);

  // Drain transmit buffers when the writable stream is closed.
  already_AddRefed<Promise> CloseCallbackImpl(JSContext* aCx,
                                              ErrorResult& aRv) override;

  // Flush (discard) transmit buffers when the writable stream is aborted.
  already_AddRefed<Promise> AbortCallbackImpl(
      JSContext* aCx, const Optional<JS::Handle<JS::Value>>& aReason,
      ErrorResult& aRv) override;

  void ReleaseObjects() override;

 protected:
  ~SerialPortWriteAlgorithms() override;

 private:
  already_AddRefed<Promise> CloseOrAbortImpl(bool aDrain, ErrorResult& aRv);

  RefPtr<SerialPort> mPort;
};

// Subclass of InputToReadableStreamAlgorithms that adds serial-specific
// cancel behavior. The base class handles all BYOB read logic; this class
// adds receive-buffer flushing when readable.cancel() is called.
class SerialPortReadAlgorithms final : public InputToReadableStreamAlgorithms {
 public:
  NS_DECL_ISUPPORTS_INHERITED
  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SerialPortReadAlgorithms,
                                           InputToReadableStreamAlgorithms)

  SerialPortReadAlgorithms(JSContext* aCx, nsIAsyncInputStream* aInput,
                           ReadableStream* aStream, SerialPort* aPort);

  already_AddRefed<Promise> CancelCallbackImpl(
      JSContext* aCx, const Optional<JS::Handle<JS::Value>>& aReason,
      ErrorResult& aRv) override;

  void ReleaseObjects() override;

 protected:
  ~SerialPortReadAlgorithms() override;

 private:
  RefPtr<SerialPort> mPort;
  nsCOMPtr<nsIAsyncInputStream> mInputStream;
};

}  // namespace mozilla::dom

#endif  // mozilla_dom_SerialPortStreamAlgorithms_h

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

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