Bug 1741941 - Add fields required for ReadableByteStreamTee to TeeState r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D131547
This commit is contained in:
Matthew Gaudet 2022-01-04 22:33:23 +00:00
Родитель fd67c79e63
Коммит 09b2f010f5
1 изменённых файлов: 17 добавлений и 1 удалений

Просмотреть файл

@ -21,6 +21,7 @@ class ReadableStreamDefaultTeePullAlgorithm;
// A closure capturing the free variables in the ReadableStreamTee family of
// algorithms.
// https://streams.spec.whatwg.org/#abstract-opdef-readablestreamdefaulttee
// https://streams.spec.whatwg.org/#abstract-opdef-readablebytestreamtee
struct TeeState : public nsISupports {
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TeeState)
@ -43,6 +44,17 @@ struct TeeState : public nsISupports {
bool ReadAgain() const { return mReadAgain; }
void SetReadAgain(bool aReadAgain) { mReadAgain = aReadAgain; }
// ReadableByteStreamTee uses ReadAgainForBranch{1,2};
bool ReadAgainForBranch1() const { return ReadAgain(); }
void SetReadAgainForBranch1(bool aReadAgainForBranch1) {
SetReadAgain(aReadAgainForBranch1);
}
bool ReadAgainForBranch2() const { return mReadAgainForBranch2; }
void SetReadAgainForBranch2(bool aReadAgainForBranch2) {
mReadAgainForBranch2 = aReadAgainForBranch2;
}
bool Reading() const { return mReading; }
void SetReading(bool aReading) { mReading = aReading; }
@ -89,15 +101,19 @@ struct TeeState : public nsISupports {
// Implicit:
RefPtr<ReadableStream> mStream;
// Step 3.
// Step 3. (Step Numbering is based on ReadableStreamDefaultTee)
RefPtr<ReadableStreamGenericReader> mReader;
// Step 4.
bool mReading = false;
// Step 5.
// (Aliased to readAgainForBranch1, for the purpose of ReadableByteStreamTee)
bool mReadAgain = false;
// ReadableByteStreamTee
bool mReadAgainForBranch2 = false;
// Step 6.
bool mCanceled1 = false;