Bug 1809408 - Part 3: Move TransformStream internal algorithms to internal namespace r=mgaudet

Differential Revision: https://phabricator.services.mozilla.com/D167929
This commit is contained in:
Kagami Sascha Rosylight
2023-02-07 11:56:06 +00:00
parent f6c1f0d990
commit 5692422e0f
4 changed files with 18 additions and 0 deletions

View File

@@ -30,6 +30,8 @@
namespace mozilla::dom {
using namespace streams_abstract;
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(TransformStream, mGlobal,
mBackpressureChangePromise, mController,
mReadable, mWritable)
@@ -115,6 +117,8 @@ JSObject* TransformStream::WrapObject(JSContext* aCx,
return TransformStream_Binding::Wrap(aCx, this, aGivenProto);
}
namespace streams_abstract {
// https://streams.spec.whatwg.org/#transform-stream-error-writable-and-unblock-write
void TransformStreamErrorWritableAndUnblockWrite(JSContext* aCx,
TransformStream* aStream,
@@ -157,6 +161,8 @@ void TransformStreamError(JSContext* aCx, TransformStream* aStream,
TransformStreamErrorWritableAndUnblockWrite(aCx, aStream, aError, aRv);
}
} // namespace streams_abstract
// https://streams.spec.whatwg.org/#transform-stream-default-controller-perform-transform
MOZ_CAN_RUN_SCRIPT static already_AddRefed<Promise>
TransformStreamDefaultControllerPerformTransform(

View File

@@ -97,6 +97,8 @@ class TransformStream final : public nsISupports, public nsWrapperCache {
RefPtr<WritableStream> mWritable;
};
namespace streams_abstract {
MOZ_CAN_RUN_SCRIPT void TransformStreamErrorWritableAndUnblockWrite(
JSContext* aCx, TransformStream* aStream, JS::Handle<JS::Value> aError,
ErrorResult& aRv);
@@ -106,6 +108,8 @@ MOZ_CAN_RUN_SCRIPT void TransformStreamError(JSContext* aCx,
JS::Handle<JS::Value> aError,
ErrorResult& aRv);
} // namespace streams_abstract
} // namespace mozilla::dom
#endif // DOM_STREAMS_TRANSFORMSTREAM_H_

View File

@@ -17,6 +17,8 @@
namespace mozilla::dom {
using namespace streams_abstract;
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(TransformStreamDefaultController, mGlobal,
mStream, mTransformerAlgorithms)
NS_IMPL_CYCLE_COLLECTING_ADDREF(TransformStreamDefaultController)
@@ -192,6 +194,8 @@ void TransformStreamDefaultController::Terminate(JSContext* aCx,
TransformStreamErrorWritableAndUnblockWrite(aCx, stream, error, aRv);
}
namespace streams_abstract {
// https://streams.spec.whatwg.org/#set-up-transform-stream-default-controller
void SetUpTransformStreamDefaultController(
JSContext* aCx, TransformStream& aStream,
@@ -229,4 +233,6 @@ void SetUpTransformStreamDefaultControllerFromTransformer(
SetUpTransformStreamDefaultController(aCx, aStream, *controller, *algorithms);
}
} // namespace streams_abstract
} // namespace mozilla::dom

View File

@@ -58,6 +58,7 @@ class TransformStreamDefaultController final : public nsISupports,
RefPtr<TransformerAlgorithmsBase> mTransformerAlgorithms;
};
namespace streams_abstract {
void SetUpTransformStreamDefaultController(
JSContext* aCx, TransformStream& aStream,
TransformStreamDefaultController& aController,
@@ -66,6 +67,7 @@ void SetUpTransformStreamDefaultController(
void SetUpTransformStreamDefaultControllerFromTransformer(
JSContext* aCx, TransformStream& aStream,
JS::Handle<JSObject*> aTransformer, Transformer& aTransformerDict);
} // namespace streams_abstract
} // namespace mozilla::dom