summaryrefslogtreecommitdiffstats
path: root/netwerk/base/nsStreamTransportService.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
commitdef92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch)
tree2ef34b9ad8bb9a9220e05d60352558b15f513894 /netwerk/base/nsStreamTransportService.cpp
parentAdding debian version 125.0.3-1. (diff)
downloadfirefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz
firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'netwerk/base/nsStreamTransportService.cpp')
-rw-r--r--netwerk/base/nsStreamTransportService.cpp56
1 files changed, 0 insertions, 56 deletions
diff --git a/netwerk/base/nsStreamTransportService.cpp b/netwerk/base/nsStreamTransportService.cpp
index e1369bbcb5..19776b2ac2 100644
--- a/netwerk/base/nsStreamTransportService.cpp
+++ b/netwerk/base/nsStreamTransportService.cpp
@@ -369,61 +369,5 @@ nsStreamTransportService::Observe(nsISupports* subject, const char* topic,
return NS_OK;
}
-class AvailableEvent final : public Runnable {
- public:
- AvailableEvent(nsIInputStream* stream, nsIInputAvailableCallback* callback)
- : Runnable("net::AvailableEvent"),
- mStream(stream),
- mCallback(callback),
- mDoingCallback(false),
- mSize(0),
- mResultForCallback(NS_OK) {
- mCallbackTarget = GetCurrentSerialEventTarget();
- }
-
- NS_IMETHOD Run() override {
- if (mDoingCallback) {
- // pong
- mCallback->OnInputAvailableComplete(mSize, mResultForCallback);
- mCallback = nullptr;
- } else {
- // ping
- mResultForCallback = mStream->Available(&mSize);
- mStream = nullptr;
- mDoingCallback = true;
-
- nsCOMPtr<nsIRunnable> event(this); // overly cute
- mCallbackTarget->Dispatch(event.forget(), NS_DISPATCH_NORMAL);
- mCallbackTarget = nullptr;
- }
- return NS_OK;
- }
-
- private:
- virtual ~AvailableEvent() = default;
-
- nsCOMPtr<nsIInputStream> mStream;
- nsCOMPtr<nsIInputAvailableCallback> mCallback;
- nsCOMPtr<nsIEventTarget> mCallbackTarget;
- bool mDoingCallback;
- uint64_t mSize;
- nsresult mResultForCallback;
-};
-
-NS_IMETHODIMP
-nsStreamTransportService::InputAvailable(nsIInputStream* stream,
- nsIInputAvailableCallback* callback) {
- nsCOMPtr<nsIThreadPool> pool;
- {
- mozilla::MutexAutoLock lock(mShutdownLock);
- if (mIsShutdown) {
- return NS_ERROR_NOT_INITIALIZED;
- }
- pool = mPool;
- }
- nsCOMPtr<nsIRunnable> event = new AvailableEvent(stream, callback);
- return pool->Dispatch(event.forget(), NS_DISPATCH_NORMAL);
-}
-
} // namespace net
} // namespace mozilla