dom/network/src/UDPSocketChild.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/network/src/UDPSocketChild.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#ifndef mozilla_dom_UDPSocketChild_h__
     1.9 +#define mozilla_dom_UDPSocketChild_h__
    1.10 +
    1.11 +#include "mozilla/net/PUDPSocketChild.h"
    1.12 +#include "nsIUDPSocketChild.h"
    1.13 +#include "nsCycleCollectionParticipant.h"
    1.14 +#include "nsCOMPtr.h"
    1.15 +
    1.16 +#define UDPSOCKETCHILD_CID \
    1.17 +  {0xb47e5a0f, 0xd384, 0x48ef, { 0x88, 0x85, 0x42, 0x59, 0x79, 0x3d, 0x9c, 0xf0 }}
    1.18 +
    1.19 +namespace mozilla {
    1.20 +namespace dom {
    1.21 +
    1.22 +class UDPSocketChildBase : public nsIUDPSocketChild {
    1.23 +public:
    1.24 +  NS_DECL_ISUPPORTS
    1.25 +
    1.26 +  void AddIPDLReference();
    1.27 +  void ReleaseIPDLReference();
    1.28 +
    1.29 +protected:
    1.30 +  UDPSocketChildBase();
    1.31 +  virtual ~UDPSocketChildBase();
    1.32 +  nsCOMPtr<nsIUDPSocketInternal> mSocket;
    1.33 +  bool mIPCOpen;
    1.34 +};
    1.35 +
    1.36 +class UDPSocketChild : public mozilla::net::PUDPSocketChild
    1.37 +                     , public UDPSocketChildBase
    1.38 +{
    1.39 +public:
    1.40 +  NS_DECL_NSIUDPSOCKETCHILD
    1.41 +  NS_IMETHOD_(MozExternalRefCountType) Release() MOZ_OVERRIDE;
    1.42 +
    1.43 +  UDPSocketChild();
    1.44 +  virtual ~UDPSocketChild();
    1.45 +
    1.46 +  virtual bool RecvCallback(const nsCString& aType,
    1.47 +                            const UDPCallbackData& aData,
    1.48 +                            const nsCString& aState) MOZ_OVERRIDE;
    1.49 +private:
    1.50 +  uint16_t mLocalPort;
    1.51 +  nsCString mLocalAddress;
    1.52 +  nsCString mFilterName;
    1.53 +};
    1.54 +
    1.55 +} // namespace dom
    1.56 +} // namespace mozilla
    1.57 +
    1.58 +#endif // !defined(mozilla_dom_UDPSocketChild_h__)

mercurial