2012-09-24 11:53:49 -07:00
|
|
|
/* 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/. */
|
|
|
|
|
2013-11-26 08:38:52 -08:00
|
|
|
#ifndef mozilla_dom_TCPSocketChild_h
|
|
|
|
#define mozilla_dom_TCPSocketChild_h
|
|
|
|
|
2012-09-24 11:53:49 -07:00
|
|
|
#include "mozilla/net/PTCPSocketChild.h"
|
|
|
|
#include "nsITCPSocketChild.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2013-08-27 19:59:14 -07:00
|
|
|
#include "js/TypeDecls.h"
|
2012-09-24 11:53:49 -07:00
|
|
|
|
|
|
|
#define TCPSOCKETCHILD_CID \
|
|
|
|
{ 0xa589d96f, 0x7e09, 0x4edf, { 0xa0, 0x1a, 0xeb, 0x49, 0x51, 0xf4, 0x2f, 0x37 } }
|
|
|
|
|
|
|
|
class nsITCPSocketInternal;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class TCPSocketChildBase : public nsITCPSocketChild {
|
|
|
|
public:
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS(TCPSocketChildBase)
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
|
|
|
|
void AddIPDLReference();
|
|
|
|
void ReleaseIPDLReference();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
TCPSocketChildBase();
|
|
|
|
virtual ~TCPSocketChildBase();
|
|
|
|
|
|
|
|
nsCOMPtr<nsITCPSocketInternal> mSocket;
|
|
|
|
bool mIPCOpen;
|
|
|
|
};
|
|
|
|
|
|
|
|
class TCPSocketChild : public mozilla::net::PTCPSocketChild
|
|
|
|
, public TCPSocketChildBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_NSITCPSOCKETCHILD
|
2014-03-27 13:38:33 -07:00
|
|
|
NS_IMETHOD_(MozExternalRefCountType) Release() MOZ_OVERRIDE;
|
2012-09-24 11:53:49 -07:00
|
|
|
|
|
|
|
TCPSocketChild();
|
|
|
|
~TCPSocketChild();
|
|
|
|
|
2013-12-18 19:21:12 -08:00
|
|
|
void Init(const nsString& aHost, const uint16_t& aPort);
|
|
|
|
|
2012-09-24 11:53:49 -07:00
|
|
|
virtual bool RecvCallback(const nsString& aType,
|
|
|
|
const CallbackData& aData,
|
2013-11-14 00:00:28 -08:00
|
|
|
const nsString& aReadyState) MOZ_OVERRIDE;
|
2013-07-29 10:36:43 -07:00
|
|
|
virtual bool RecvRequestDelete() MOZ_OVERRIDE;
|
2013-11-14 00:00:28 -08:00
|
|
|
virtual bool RecvUpdateBufferedAmount(const uint32_t& aBufferred,
|
|
|
|
const uint32_t& aTrackingNumber) MOZ_OVERRIDE;
|
2012-09-24 11:53:49 -07:00
|
|
|
private:
|
2013-07-29 10:36:43 -07:00
|
|
|
JSObject* mWindowObj;
|
2013-12-18 19:21:12 -08:00
|
|
|
nsString mHost;
|
|
|
|
uint16_t mPort;
|
2012-09-24 11:53:49 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2013-11-26 08:38:52 -08:00
|
|
|
|
|
|
|
#endif
|