diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
commit | def92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch) | |
tree | 2ef34b9ad8bb9a9220e05d60352558b15f513894 /netwerk/base/nsStreamTransportService.cpp | |
parent | Adding debian version 125.0.3-1. (diff) | |
download | firefox-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.cpp | 56 |
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 |