Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim: set sw=2 ts=8 et tw=80 : */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef mozilla_net_WebSocketChannelChild_h |
michael@0 | 8 | #define mozilla_net_WebSocketChannelChild_h |
michael@0 | 9 | |
michael@0 | 10 | #include "mozilla/net/PWebSocketChild.h" |
michael@0 | 11 | #include "mozilla/net/BaseWebSocketChannel.h" |
michael@0 | 12 | #include "nsString.h" |
michael@0 | 13 | |
michael@0 | 14 | namespace mozilla { |
michael@0 | 15 | namespace net { |
michael@0 | 16 | |
michael@0 | 17 | class ChannelEvent; |
michael@0 | 18 | class ChannelEventQueue; |
michael@0 | 19 | |
michael@0 | 20 | class WebSocketChannelChild : public BaseWebSocketChannel, |
michael@0 | 21 | public PWebSocketChild |
michael@0 | 22 | { |
michael@0 | 23 | public: |
michael@0 | 24 | WebSocketChannelChild(bool aSecure); |
michael@0 | 25 | ~WebSocketChannelChild(); |
michael@0 | 26 | |
michael@0 | 27 | NS_DECL_ISUPPORTS |
michael@0 | 28 | NS_DECL_NSITHREADRETARGETABLEREQUEST |
michael@0 | 29 | |
michael@0 | 30 | // nsIWebSocketChannel methods BaseWebSocketChannel didn't implement for us |
michael@0 | 31 | // |
michael@0 | 32 | NS_IMETHOD AsyncOpen(nsIURI *aURI, const nsACString &aOrigin, |
michael@0 | 33 | nsIWebSocketListener *aListener, nsISupports *aContext); |
michael@0 | 34 | NS_IMETHOD Close(uint16_t code, const nsACString & reason); |
michael@0 | 35 | NS_IMETHOD SendMsg(const nsACString &aMsg); |
michael@0 | 36 | NS_IMETHOD SendBinaryMsg(const nsACString &aMsg); |
michael@0 | 37 | NS_IMETHOD SendBinaryStream(nsIInputStream *aStream, uint32_t aLength); |
michael@0 | 38 | nsresult SendBinaryStream(OptionalInputStreamParams *aStream, uint32_t aLength); |
michael@0 | 39 | NS_IMETHOD GetSecurityInfo(nsISupports **aSecurityInfo); |
michael@0 | 40 | |
michael@0 | 41 | void AddIPDLReference(); |
michael@0 | 42 | void ReleaseIPDLReference(); |
michael@0 | 43 | |
michael@0 | 44 | private: |
michael@0 | 45 | bool RecvOnStart(const nsCString& aProtocol, const nsCString& aExtensions) MOZ_OVERRIDE; |
michael@0 | 46 | bool RecvOnStop(const nsresult& aStatusCode) MOZ_OVERRIDE; |
michael@0 | 47 | bool RecvOnMessageAvailable(const nsCString& aMsg) MOZ_OVERRIDE; |
michael@0 | 48 | bool RecvOnBinaryMessageAvailable(const nsCString& aMsg) MOZ_OVERRIDE; |
michael@0 | 49 | bool RecvOnAcknowledge(const uint32_t& aSize) MOZ_OVERRIDE; |
michael@0 | 50 | bool RecvOnServerClose(const uint16_t& aCode, const nsCString &aReason) MOZ_OVERRIDE; |
michael@0 | 51 | |
michael@0 | 52 | void OnStart(const nsCString& aProtocol, const nsCString& aExtensions); |
michael@0 | 53 | void OnStop(const nsresult& aStatusCode); |
michael@0 | 54 | void OnMessageAvailable(const nsCString& aMsg); |
michael@0 | 55 | void OnBinaryMessageAvailable(const nsCString& aMsg); |
michael@0 | 56 | void OnAcknowledge(const uint32_t& aSize); |
michael@0 | 57 | void OnServerClose(const uint16_t& aCode, const nsCString& aReason); |
michael@0 | 58 | void AsyncOpenFailed(); |
michael@0 | 59 | |
michael@0 | 60 | void DispatchToTargetThread(ChannelEvent *aChannelEvent); |
michael@0 | 61 | |
michael@0 | 62 | nsRefPtr<ChannelEventQueue> mEventQ; |
michael@0 | 63 | bool mIPCOpen; |
michael@0 | 64 | |
michael@0 | 65 | friend class StartEvent; |
michael@0 | 66 | friend class StopEvent; |
michael@0 | 67 | friend class MessageEvent; |
michael@0 | 68 | friend class AcknowledgeEvent; |
michael@0 | 69 | friend class ServerCloseEvent; |
michael@0 | 70 | friend class AsyncOpenFailedEvent; |
michael@0 | 71 | }; |
michael@0 | 72 | |
michael@0 | 73 | } // namespace net |
michael@0 | 74 | } // namespace mozilla |
michael@0 | 75 | |
michael@0 | 76 | #endif // mozilla_net_WebSocketChannelChild_h |