netwerk/protocol/websocket/WebSocketChannelChild.h

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

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

mercurial