mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Bug 1502355 - Rename |JS::InitAbortSignalHandling| to |JS::InitPipeToHandling|, because this embedder interface is going to get a lot more pipeTo-specific shortly... r=arai
Differential Revision: https://phabricator.services.mozilla.com/D92351
This commit is contained in:
parent
b792b4dc70
commit
ecdf88a72e
@ -502,6 +502,8 @@ class JS_PUBLIC_API WritableStreamUnderlyingSink {
|
||||
virtual void finalize() = 0;
|
||||
};
|
||||
|
||||
// ReadableStream.prototype.pipeTo SUPPORT
|
||||
|
||||
/**
|
||||
* The signature of a function that, when passed an |AbortSignal| instance, will
|
||||
* return the value of its "aborted" flag.
|
||||
@ -511,17 +513,18 @@ class JS_PUBLIC_API WritableStreamUnderlyingSink {
|
||||
using AbortSignalIsAborted = bool (*)(JSObject* signal);
|
||||
|
||||
/**
|
||||
* Dictate all details of handling of |AbortSignal| objects for SpiderMonkey to
|
||||
* use. This should only be performed once, for a single context associated
|
||||
* with a |JSRuntime|.
|
||||
* Dictate embedder-specific details necessary to implement certain aspects of
|
||||
* the |ReadableStream.prototype.pipeTo| function. This should be performed
|
||||
* exactly once, for a single context associated with a |JSRuntime|.
|
||||
*
|
||||
* The |ReadableStream.prototype.pipeTo| function accepts a |signal| argument
|
||||
* that may be used to abort the piping operation. This argument must be either
|
||||
* |undefined| (in other words, the piping operation can't be aborted) or an
|
||||
* |AbortSignal| instance. |AbortSignal| is defined by WebIDL and the DOM in
|
||||
* the web embedding. Therefore, embedders must use this function to specify
|
||||
* how such objects can be recognized and how to perform various essential
|
||||
* actions upon them.
|
||||
* |AbortSignal| instance (that may be aborted using the signal's associated
|
||||
* |AbortController|). |AbortSignal| is defined by WebIDL and the DOM in the
|
||||
* web embedding. Therefore, embedders must use this function to specify how
|
||||
* such objects can be recognized and how to perform various essential actions
|
||||
* upon them.
|
||||
*
|
||||
* The provided |isAborted| function will be called with an unwrapped
|
||||
* |AbortSignal| instance, while that instance's realm has been entered.
|
||||
@ -530,8 +533,9 @@ using AbortSignalIsAborted = bool (*)(JSObject* signal);
|
||||
* |AbortSignal|?" question must be asked, that question will simply be answered
|
||||
* "no".
|
||||
*/
|
||||
extern JS_PUBLIC_API void InitAbortSignalHandling(
|
||||
const JSClass* clasp, AbortSignalIsAborted isAborted, JSContext* cx);
|
||||
extern JS_PUBLIC_API void InitPipeToHandling(const JSClass* abortSignalClass,
|
||||
AbortSignalIsAborted isAborted,
|
||||
JSContext* cx);
|
||||
|
||||
} // namespace JS
|
||||
|
||||
|
@ -606,8 +606,7 @@ JS_PUBLIC_API JSObject* JS::ReadableStreamDefaultReaderRead(
|
||||
return js::ReadableStreamDefaultReaderRead(cx, unwrappedReader);
|
||||
}
|
||||
|
||||
void JS::InitAbortSignalHandling(const JSClass* clasp,
|
||||
AbortSignalIsAborted isAborted,
|
||||
JSContext* cx) {
|
||||
cx->runtime()->initAbortSignalHandling(clasp, isAborted);
|
||||
void JS::InitPipeToHandling(const JSClass* abortSignalClass,
|
||||
AbortSignalIsAborted isAborted, JSContext* cx) {
|
||||
cx->runtime()->initPipeToHandling(abortSignalClass, isAborted);
|
||||
}
|
||||
|
@ -428,14 +428,14 @@ struct JSRuntime {
|
||||
js::WriteOnceData<JS::AbortSignalIsAborted> abortSignalIsAborted_;
|
||||
|
||||
public:
|
||||
void initAbortSignalHandling(const JSClass* clasp,
|
||||
JS::AbortSignalIsAborted isAborted) {
|
||||
MOZ_ASSERT(clasp != nullptr,
|
||||
void initPipeToHandling(const JSClass* abortSignalClass,
|
||||
JS::AbortSignalIsAborted isAborted) {
|
||||
MOZ_ASSERT(abortSignalClass != nullptr,
|
||||
"doesn't make sense for an embedder to provide a null class "
|
||||
"when specifying AbortSignal handling");
|
||||
"when specifying pipeTo handling");
|
||||
MOZ_ASSERT(isAborted != nullptr, "must pass a valid function pointer");
|
||||
|
||||
abortSignalClass_ = clasp;
|
||||
abortSignalClass_ = abortSignalClass;
|
||||
abortSignalIsAborted_ = isAborted;
|
||||
}
|
||||
|
||||
@ -443,7 +443,7 @@ struct JSRuntime {
|
||||
|
||||
bool abortSignalIsAborted(JSObject* obj) {
|
||||
MOZ_ASSERT(abortSignalIsAborted_ != nullptr,
|
||||
"must call initAbortSignalHandling first");
|
||||
"must call initPipeToHandling first");
|
||||
return abortSignalIsAborted_(obj);
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@
|
||||
#include "js/MemoryFunctions.h"
|
||||
#include "js/MemoryMetrics.h"
|
||||
#include "js/Object.h" // JS::GetClass
|
||||
#include "js/Stream.h" // JS::AbortSignalIsAborted, JS::InitAbortSignalHandling
|
||||
#include "js/Stream.h" // JS::AbortSignalIsAborted, JS::InitPipeToHandling
|
||||
#include "js/UbiNode.h"
|
||||
#include "js/UbiNodeUtils.h"
|
||||
#include "js/friend/UsageStatistics.h" // JS_TELEMETRY_*, JS_SetAccumulateTelemetryCallback
|
||||
@ -3005,8 +3005,8 @@ void XPCJSRuntime::Initialize(JSContext* cx) {
|
||||
return domObj->Aborted();
|
||||
};
|
||||
|
||||
JS::InitAbortSignalHandling(dom::AbortSignal_Binding::GetJSClass(),
|
||||
isAborted, cx);
|
||||
JS::InitPipeToHandling(dom::AbortSignal_Binding::GetJSClass(), isAborted,
|
||||
cx);
|
||||
}
|
||||
|
||||
JS::SetXrayJitInfo(&gXrayJitInfo);
|
||||
|
Loading…
Reference in New Issue
Block a user