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: */
|
2013-07-29 21:36:43 +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/. */
|
|
|
|
|
|
|
|
#include "mozilla/net/PNeckoParent.h"
|
|
|
|
#include "mozilla/net/PTCPServerSocketParent.h"
|
|
|
|
#include "nsITCPSocketParent.h"
|
|
|
|
#include "nsITCPServerSocketParent.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2015-01-18 00:26:10 +03:00
|
|
|
#include "nsIDOMTCPSocket.h"
|
2013-07-29 21:36:43 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class TCPServerSocketParent : public mozilla::net::PTCPServerSocketParent
|
|
|
|
, public nsITCPServerSocketParent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS(TCPServerSocketParent)
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_NSITCPSERVERSOCKETPARENT
|
|
|
|
|
2015-01-18 00:26:10 +03:00
|
|
|
TCPServerSocketParent() : mNeckoParent(nullptr), mIPCOpen(false) {}
|
2013-07-29 21:36:43 +04:00
|
|
|
|
|
|
|
bool Init(PNeckoParent* neckoParent, const uint16_t& aLocalPort, const uint16_t& aBacklog,
|
|
|
|
const nsString& aBinaryType);
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool RecvClose() override;
|
|
|
|
virtual bool RecvRequestDelete() override;
|
2013-07-29 21:36:43 +04:00
|
|
|
|
2014-10-30 05:03:54 +03:00
|
|
|
uint32_t GetAppId();
|
2014-12-29 11:12:17 +03:00
|
|
|
bool GetInBrowser();
|
2014-10-30 05:03:54 +03:00
|
|
|
|
2013-07-29 21:36:43 +04:00
|
|
|
void AddIPDLReference();
|
|
|
|
void ReleaseIPDLReference();
|
|
|
|
|
|
|
|
private:
|
2015-01-18 00:26:10 +03:00
|
|
|
~TCPServerSocketParent() {}
|
2014-06-23 23:56:07 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason why) override;
|
2013-07-29 21:36:43 +04:00
|
|
|
|
|
|
|
PNeckoParent* mNeckoParent;
|
|
|
|
nsCOMPtr<nsITCPSocketIntermediary> mIntermediary;
|
2015-01-18 00:26:10 +03:00
|
|
|
nsCOMPtr<nsIDOMTCPServerSocket> mServerSocket;
|
2013-07-29 21:36:43 +04:00
|
|
|
bool mIPCOpen;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|