2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-09-24 22:53:49 +04: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 20:38:52 +04:00
|
|
|
#ifndef mozilla_dom_TCPSocketChild_h
|
|
|
|
#define mozilla_dom_TCPSocketChild_h
|
|
|
|
|
2012-09-24 22:53:49 +04:00
|
|
|
#include "mozilla/net/PTCPSocketChild.h"
|
|
|
|
#include "nsITCPSocketChild.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2013-08-28 06:59:14 +04:00
|
|
|
#include "js/TypeDecls.h"
|
2012-09-24 22:53:49 +04: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
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD_(MozExternalRefCountType) Release() override;
|
2012-09-24 22:53:49 +04:00
|
|
|
|
|
|
|
TCPSocketChild();
|
|
|
|
~TCPSocketChild();
|
|
|
|
|
2013-12-19 07:21:12 +04:00
|
|
|
void Init(const nsString& aHost, const uint16_t& aPort);
|
|
|
|
|
2012-09-24 22:53:49 +04:00
|
|
|
virtual bool RecvCallback(const nsString& aType,
|
|
|
|
const CallbackData& aData,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsString& aReadyState) override;
|
|
|
|
virtual bool RecvRequestDelete() override;
|
2013-11-14 12:00:28 +04:00
|
|
|
virtual bool RecvUpdateBufferedAmount(const uint32_t& aBufferred,
|
2015-03-21 19:28:04 +03:00
|
|
|
const uint32_t& aTrackingNumber) override;
|
2012-09-24 22:53:49 +04:00
|
|
|
private:
|
2013-07-29 21:36:43 +04:00
|
|
|
JSObject* mWindowObj;
|
2013-12-19 07:21:12 +04:00
|
|
|
nsString mHost;
|
|
|
|
uint16_t mPort;
|
2012-09-24 22:53:49 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2013-11-26 20:38:52 +04:00
|
|
|
|
|
|
|
#endif
|