1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/network/src/TCPSocketParent.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,70 @@ 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_TCPSocketParent_h 1.9 +#define mozilla_dom_TCPSocketParent_h 1.10 + 1.11 +#include "mozilla/net/PTCPSocketParent.h" 1.12 +#include "nsITCPSocketParent.h" 1.13 +#include "nsCycleCollectionParticipant.h" 1.14 +#include "nsCOMPtr.h" 1.15 +#include "nsIDOMTCPSocket.h" 1.16 +#include "js/TypeDecls.h" 1.17 + 1.18 +#define TCPSOCKETPARENT_CID \ 1.19 + { 0x4e7246c6, 0xa8b3, 0x426d, { 0x9c, 0x17, 0x76, 0xda, 0xb1, 0xe1, 0xe1, 0x4a } } 1.20 + 1.21 +namespace mozilla { 1.22 +namespace dom { 1.23 + 1.24 +class PBrowserParent; 1.25 + 1.26 +class TCPSocketParentBase : public nsITCPSocketParent 1.27 +{ 1.28 +public: 1.29 + NS_DECL_CYCLE_COLLECTION_CLASS(TCPSocketParentBase) 1.30 + NS_DECL_CYCLE_COLLECTING_ISUPPORTS 1.31 + 1.32 + void AddIPDLReference(); 1.33 + void ReleaseIPDLReference(); 1.34 + 1.35 +protected: 1.36 + TCPSocketParentBase(); 1.37 + virtual ~TCPSocketParentBase(); 1.38 + 1.39 + nsCOMPtr<nsITCPSocketIntermediary> mIntermediary; 1.40 + nsCOMPtr<nsIDOMTCPSocket> mSocket; 1.41 + bool mIPCOpen; 1.42 +}; 1.43 + 1.44 +class TCPSocketParent : public mozilla::net::PTCPSocketParent 1.45 + , public TCPSocketParentBase 1.46 +{ 1.47 +public: 1.48 + NS_DECL_NSITCPSOCKETPARENT 1.49 + NS_IMETHOD_(MozExternalRefCountType) Release() MOZ_OVERRIDE; 1.50 + 1.51 + TCPSocketParent() : mIntermediaryObj(nullptr) {} 1.52 + 1.53 + virtual bool RecvOpen(const nsString& aHost, const uint16_t& aPort, 1.54 + const bool& useSSL, const nsString& aBinaryType); 1.55 + 1.56 + virtual bool RecvStartTLS() MOZ_OVERRIDE; 1.57 + virtual bool RecvSuspend() MOZ_OVERRIDE; 1.58 + virtual bool RecvResume() MOZ_OVERRIDE; 1.59 + virtual bool RecvClose() MOZ_OVERRIDE; 1.60 + virtual bool RecvData(const SendableData& aData, 1.61 + const uint32_t& aTrackingNumber) MOZ_OVERRIDE; 1.62 + virtual bool RecvRequestDelete() MOZ_OVERRIDE; 1.63 + 1.64 +private: 1.65 + virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE; 1.66 + 1.67 + JSObject* mIntermediaryObj; 1.68 +}; 1.69 + 1.70 +} // namespace dom 1.71 +} // namespace mozilla 1.72 + 1.73 +#endif