Autogenerated with:
cp dom/.clang-format netwerk/ && mach format netwerk/**.{cpp,h,mm}
Manual fixes:
* mozurl/cbindgen.toml (including headers earlier)
* NetlinkService.h (forward-declaring a necessary struct)
* nsIWebSocketChannel.idl (forward-declaring OriginAttributes).
* nsAsyncRedirectVerifyHelper.h (forward-declaring nsIEventTarget)
* CapsuleEncoder.h gets a missing Capsule forward-decl.
* WebSocketConnectionBase.h gets some missing includes.
* HappyEyeballsConnectionAttempt gets some missing includes.
* nsUDPSocket missed nsSocketTransportService2.h for OnSocketThread().
* HttpInfo missed a forward declaration.
* MockHttpAuth missed an nsCOMPtr include.
* nsHttpAuthManager missed a forward declaration for nsIHttpAuthCache.
* WebTransportSessionProxy was using mozilla::Mutex in a member without
including it.
* win32 fixes to keep include order because windows headers suck.
* nsInputStreamPump needs an Atomics.h include.
Differential Revision: https://phabricator.services.mozilla.com/D311696
67 lines
2.5 KiB
C++
67 lines
2.5 KiB
C++
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef mozilla_net_WebSocketConnectionParent_h
|
|
#define mozilla_net_WebSocketConnectionParent_h
|
|
|
|
#include "WebSocketConnectionBase.h"
|
|
#include "mozilla/net/PWebSocketConnectionParent.h"
|
|
#include "mozilla/net/WebSocketConnectionBase.h"
|
|
#include "nsISupportsImpl.h"
|
|
|
|
class nsIHttpUpgradeListener;
|
|
|
|
namespace mozilla {
|
|
namespace net {
|
|
|
|
class WebSocketConnectionListener;
|
|
|
|
// WebSocketConnectionParent implements WebSocketConnectionBase and provides
|
|
// interface for WebSocketChannel to send/receive data. The ownership model for
|
|
// WebSocketConnectionParent is that IPDL and WebSocketChannel hold strong
|
|
// reference of this object. When Close() is called, a __delete__ message will
|
|
// be sent and the IPC actor will be deallocated as well.
|
|
|
|
class WebSocketConnectionParent final : public PWebSocketConnectionParent,
|
|
public WebSocketConnectionBase {
|
|
public:
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
|
|
|
explicit WebSocketConnectionParent(nsIHttpUpgradeListener* aListener);
|
|
|
|
mozilla::ipc::IPCResult RecvOnTransportAvailable(
|
|
nsITransportSecurityInfo* aSecurityInfo);
|
|
mozilla::ipc::IPCResult RecvOnError(const nsresult& aStatus);
|
|
mozilla::ipc::IPCResult RecvOnTCPClosed();
|
|
mozilla::ipc::IPCResult RecvOnDataReceived(nsTArray<uint8_t>&& aData);
|
|
mozilla::ipc::IPCResult RecvOnUpgradeFailed(const nsresult& aReason);
|
|
|
|
void ActorDestroy(ActorDestroyReason aWhy) override;
|
|
|
|
nsresult Init(WebSocketConnectionListener* aListener) override;
|
|
void GetIoTarget(nsIEventTarget** aTarget) override;
|
|
void Close() override;
|
|
nsresult WriteOutputData(const uint8_t* aHdrBuf, uint32_t aHdrBufLength,
|
|
const uint8_t* aPayloadBuf,
|
|
uint32_t aPayloadBufLength) override;
|
|
nsresult StartReading() override;
|
|
void DrainSocketData() override;
|
|
nsresult GetSecurityInfo(nsITransportSecurityInfo** aSecurityInfo) override;
|
|
|
|
private:
|
|
virtual ~WebSocketConnectionParent();
|
|
|
|
nsCOMPtr<nsIHttpUpgradeListener> mUpgradeListener;
|
|
RefPtr<WebSocketConnectionListener> mListener;
|
|
nsCOMPtr<nsISerialEventTarget> mBackgroundThread;
|
|
nsCOMPtr<nsITransportSecurityInfo> mSecurityInfo MOZ_GUARDED_BY(mMutex);
|
|
Atomic<bool> mClosed{false};
|
|
Mutex mMutex{"WebSocketConnectionParent::mMutex"};
|
|
};
|
|
|
|
} // namespace net
|
|
} // namespace mozilla
|
|
|
|
#endif // mozilla_net_WebSocketConnectionParent_h
|