зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 17dfb6404d37 (bug 1148307) for OS X build bustage. r=backout on a CLOSED TREE
--HG-- rename : dom/presentation/PresentationTCPSessionTransport.cpp => dom/presentation/PresentationSessionTransport.cpp rename : dom/presentation/PresentationTCPSessionTransport.h => dom/presentation/PresentationSessionTransport.h
This commit is contained in:
Родитель
ae9f706ab7
Коммит
f17e7a91b7
|
@ -121,21 +121,21 @@ PresentationNetworkHelper::OnGetWifiIPAddress(const nsACString& aIPAddress)
|
|||
|
||||
#endif // MOZ_WIDGET_ANDROID
|
||||
|
||||
class TCPPresentationChannelDescription final : public nsIPresentationChannelDescription
|
||||
class PresentationChannelDescription final : public nsIPresentationChannelDescription
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPRESENTATIONCHANNELDESCRIPTION
|
||||
|
||||
TCPPresentationChannelDescription(const nsACString& aAddress,
|
||||
uint16_t aPort)
|
||||
PresentationChannelDescription(const nsACString& aAddress,
|
||||
uint16_t aPort)
|
||||
: mAddress(aAddress)
|
||||
, mPort(aPort)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
~TCPPresentationChannelDescription() {}
|
||||
~PresentationChannelDescription() {}
|
||||
|
||||
nsCString mAddress;
|
||||
uint16_t mPort;
|
||||
|
@ -144,10 +144,10 @@ private:
|
|||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
NS_IMPL_ISUPPORTS(TCPPresentationChannelDescription, nsIPresentationChannelDescription)
|
||||
NS_IMPL_ISUPPORTS(PresentationChannelDescription, nsIPresentationChannelDescription)
|
||||
|
||||
NS_IMETHODIMP
|
||||
TCPPresentationChannelDescription::GetType(uint8_t* aRetVal)
|
||||
PresentationChannelDescription::GetType(uint8_t* aRetVal)
|
||||
{
|
||||
if (NS_WARN_IF(!aRetVal)) {
|
||||
return NS_ERROR_INVALID_POINTER;
|
||||
|
@ -160,7 +160,7 @@ TCPPresentationChannelDescription::GetType(uint8_t* aRetVal)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TCPPresentationChannelDescription::GetTcpAddress(nsIArray** aRetVal)
|
||||
PresentationChannelDescription::GetTcpAddress(nsIArray** aRetVal)
|
||||
{
|
||||
if (NS_WARN_IF(!aRetVal)) {
|
||||
return NS_ERROR_INVALID_POINTER;
|
||||
|
@ -189,7 +189,7 @@ TCPPresentationChannelDescription::GetTcpAddress(nsIArray** aRetVal)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TCPPresentationChannelDescription::GetTcpPort(uint16_t* aRetVal)
|
||||
PresentationChannelDescription::GetTcpPort(uint16_t* aRetVal)
|
||||
{
|
||||
if (NS_WARN_IF(!aRetVal)) {
|
||||
return NS_ERROR_INVALID_POINTER;
|
||||
|
@ -200,7 +200,7 @@ TCPPresentationChannelDescription::GetTcpPort(uint16_t* aRetVal)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TCPPresentationChannelDescription::GetDataChannelSDP(nsAString& aDataChannelSDP)
|
||||
PresentationChannelDescription::GetDataChannelSDP(nsAString& aDataChannelSDP)
|
||||
{
|
||||
// TODO bug 1148307 Implement PresentationSessionTransport with DataChannel.
|
||||
// Only support TCP socket for now.
|
||||
|
@ -214,8 +214,7 @@ TCPPresentationChannelDescription::GetDataChannelSDP(nsAString& aDataChannelSDP)
|
|||
|
||||
NS_IMPL_ISUPPORTS(PresentationSessionInfo,
|
||||
nsIPresentationSessionTransportCallback,
|
||||
nsIPresentationControlChannelListener,
|
||||
nsIPresentationSessionTransportBuilderListener);
|
||||
nsIPresentationControlChannelListener);
|
||||
|
||||
/* virtual */ nsresult
|
||||
PresentationSessionInfo::Init(nsIPresentationControlChannel* aControlChannel)
|
||||
|
@ -407,31 +406,6 @@ PresentationSessionInfo::NotifyData(const nsACString& aData)
|
|||
return mListener->NotifyMessage(mSessionId, aData);
|
||||
}
|
||||
|
||||
// nsIPresentationSessionTransportBuilderListener
|
||||
NS_IMETHODIMP
|
||||
PresentationSessionInfo::OnSessionTransport(nsIPresentationSessionTransport* transport)
|
||||
{
|
||||
mTransport = transport;
|
||||
|
||||
nsresult rv = mTransport->SetCallback(this);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (mListener) {
|
||||
mTransport->EnableDataNotification();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresentationSessionInfo::OnError(nsresult reason)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Implementation of PresentationControllingInfo
|
||||
*
|
||||
|
@ -596,8 +570,8 @@ PresentationControllingInfo::OnGetAddress(const nsACString& aAddress)
|
|||
return rv;
|
||||
}
|
||||
|
||||
RefPtr<TCPPresentationChannelDescription> description =
|
||||
new TCPPresentationChannelDescription(aAddress, static_cast<uint16_t>(port));
|
||||
RefPtr<PresentationChannelDescription> description =
|
||||
new PresentationChannelDescription(aAddress, static_cast<uint16_t>(port));
|
||||
return mControlChannel->SendOffer(description);
|
||||
}
|
||||
|
||||
|
@ -670,14 +644,23 @@ PresentationControllingInfo::OnSocketAccepted(nsIServerSocket* aServerSocket,
|
|||
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// Initialize session transport builder and use |this| as the callback.
|
||||
nsCOMPtr<nsIPresentationTCPSessionTransportBuilder> builder =
|
||||
do_CreateInstance(PRESENTATION_TCP_SESSION_TRANSPORT_CONTRACTID);
|
||||
if (NS_WARN_IF(!builder)) {
|
||||
// Initialize |mTransport| and use |this| as the callback.
|
||||
mTransport = do_CreateInstance(PRESENTATION_SESSION_TRANSPORT_CONTRACTID);
|
||||
if (NS_WARN_IF(!mTransport)) {
|
||||
return ReplyError(NS_ERROR_DOM_OPERATION_ERR);
|
||||
}
|
||||
|
||||
return builder->BuildTCPSenderTransport(aTransport, this);
|
||||
rv = mTransport->InitWithSocketTransport(aTransport, this);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Enable data notification if the listener has been registered.
|
||||
if (mListener) {
|
||||
return mTransport->EnableDataNotification();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -762,11 +745,28 @@ PresentationPresentingInfo::Shutdown(nsresult aReason)
|
|||
mPromise = nullptr;
|
||||
}
|
||||
|
||||
// nsIPresentationSessionTransportBuilderListener
|
||||
NS_IMETHODIMP
|
||||
PresentationPresentingInfo::OnSessionTransport(nsIPresentationSessionTransport* transport)
|
||||
nsresult
|
||||
PresentationPresentingInfo::InitTransportAndSendAnswer()
|
||||
{
|
||||
PresentationSessionInfo::OnSessionTransport(transport);
|
||||
// Establish a data transport channel |mTransport| to the sender and use
|
||||
// |this| as the callback.
|
||||
mTransport = do_CreateInstance(PRESENTATION_SESSION_TRANSPORT_CONTRACTID);
|
||||
if (NS_WARN_IF(!mTransport)) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
nsresult rv = mTransport->InitWithChannelDescription(mRequesterDescription, this);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Enable data notification if the listener has been registered.
|
||||
if (mListener) {
|
||||
rv = mTransport->EnableDataNotification();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare and send the answer.
|
||||
// TODO bug 1148307 Implement PresentationSessionTransport with DataChannel.
|
||||
|
@ -775,7 +775,7 @@ PresentationPresentingInfo::OnSessionTransport(nsIPresentationSessionTransport*
|
|||
// |InitWithChannelDescription|. Yet this deficiency only affects the channel
|
||||
// description for the answer, which is not actually checked at requester side.
|
||||
nsCOMPtr<nsINetAddr> selfAddr;
|
||||
nsresult rv = mTransport->GetSelfAddress(getter_AddRefs(selfAddr));
|
||||
rv = mTransport->GetSelfAddress(getter_AddRefs(selfAddr));
|
||||
NS_WARN_IF(NS_FAILED(rv));
|
||||
|
||||
nsCString address;
|
||||
|
@ -785,31 +785,11 @@ PresentationPresentingInfo::OnSessionTransport(nsIPresentationSessionTransport*
|
|||
selfAddr->GetPort(&port);
|
||||
}
|
||||
nsCOMPtr<nsIPresentationChannelDescription> description =
|
||||
new TCPPresentationChannelDescription(address, port);
|
||||
new PresentationChannelDescription(address, port);
|
||||
|
||||
return mControlChannel->SendAnswer(description);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresentationPresentingInfo::OnError(nsresult reason)
|
||||
{
|
||||
return PresentationSessionInfo::OnError(reason);
|
||||
}
|
||||
|
||||
nsresult
|
||||
PresentationPresentingInfo::InitTransportAndSendAnswer()
|
||||
{
|
||||
// Establish a data transport channel |mTransport| to the sender and use
|
||||
// |this| as the callback.
|
||||
nsCOMPtr<nsIPresentationTCPSessionTransportBuilder> builder =
|
||||
do_CreateInstance(PRESENTATION_TCP_SESSION_TRANSPORT_CONTRACTID);
|
||||
if (NS_WARN_IF(!builder)) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
return builder->BuildTCPReceiverTransport(mRequesterDescription, this);
|
||||
}
|
||||
|
||||
nsresult
|
||||
PresentationPresentingInfo::UntrackFromService()
|
||||
{
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "nsIPresentationListener.h"
|
||||
#include "nsIPresentationService.h"
|
||||
#include "nsIPresentationSessionTransport.h"
|
||||
#include "nsIPresentationSessionTransportBuilder.h"
|
||||
#include "nsIServerSocket.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsString.h"
|
||||
|
@ -29,12 +28,10 @@ namespace dom {
|
|||
|
||||
class PresentationSessionInfo : public nsIPresentationSessionTransportCallback
|
||||
, public nsIPresentationControlChannelListener
|
||||
, public nsIPresentationSessionTransportBuilderListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPRESENTATIONSESSIONTRANSPORTCALLBACK
|
||||
NS_DECL_NSIPRESENTATIONSESSIONTRANSPORTBUILDERLISTENER
|
||||
|
||||
PresentationSessionInfo(const nsAString& aUrl,
|
||||
const nsAString& aSessionId,
|
||||
|
@ -187,7 +184,6 @@ class PresentationPresentingInfo final : public PresentationSessionInfo
|
|||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIPRESENTATIONCONTROLCHANNELLISTENER
|
||||
NS_DECL_NSIPRESENTATIONSESSIONTRANSPORTBUILDERLISTENER
|
||||
NS_DECL_NSITIMERCALLBACK
|
||||
|
||||
PresentationPresentingInfo(const nsAString& aUrl,
|
||||
|
|
|
@ -16,12 +16,11 @@
|
|||
#include "nsISocketTransportService.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsStreamUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "PresentationLog.h"
|
||||
#include "PresentationTCPSessionTransport.h"
|
||||
#include "PresentationSessionTransport.h"
|
||||
|
||||
#define BUFFER_SIZE 65536
|
||||
|
||||
|
@ -31,7 +30,7 @@ using namespace mozilla::dom;
|
|||
class CopierCallbacks final : public nsIRequestObserver
|
||||
{
|
||||
public:
|
||||
explicit CopierCallbacks(PresentationTCPSessionTransport* aTransport)
|
||||
explicit CopierCallbacks(PresentationSessionTransport* aTransport)
|
||||
: mOwner(aTransport)
|
||||
{}
|
||||
|
||||
|
@ -40,7 +39,7 @@ public:
|
|||
private:
|
||||
~CopierCallbacks() {}
|
||||
|
||||
RefPtr<PresentationTCPSessionTransport> mOwner;
|
||||
RefPtr<PresentationSessionTransport> mOwner;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(CopierCallbacks, nsIRequestObserver)
|
||||
|
@ -58,85 +57,76 @@ CopierCallbacks::OnStopRequest(nsIRequest* aRequest, nsISupports* aContext, nsre
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION(PresentationTCPSessionTransport, mTransport,
|
||||
NS_IMPL_CYCLE_COLLECTION(PresentationSessionTransport, mTransport,
|
||||
mSocketInputStream, mSocketOutputStream,
|
||||
mInputStreamPump, mInputStreamScriptable,
|
||||
mMultiplexStream, mMultiplexStreamCopier, mCallback)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(PresentationTCPSessionTransport)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(PresentationTCPSessionTransport)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(PresentationSessionTransport)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(PresentationSessionTransport)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PresentationTCPSessionTransport)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PresentationSessionTransport)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIPresentationSessionTransport)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIPresentationSessionTransport)
|
||||
NS_INTERFACE_MAP_ENTRY(nsITransportEventSink)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIPresentationTCPSessionTransportBuilder)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIInputStreamCallback)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
PresentationTCPSessionTransport::PresentationTCPSessionTransport()
|
||||
: mReadyState(ReadyState::CLOSED)
|
||||
PresentationSessionTransport::PresentationSessionTransport()
|
||||
: mReadyState(CLOSED)
|
||||
, mAsyncCopierActive(false)
|
||||
, mCloseStatus(NS_OK)
|
||||
, mDataNotificationEnabled(false)
|
||||
{
|
||||
}
|
||||
|
||||
PresentationTCPSessionTransport::~PresentationTCPSessionTransport()
|
||||
PresentationSessionTransport::~PresentationSessionTransport()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresentationTCPSessionTransport::BuildTCPSenderTransport(nsISocketTransport* aTransport,
|
||||
nsIPresentationSessionTransportBuilderListener* aListener)
|
||||
PresentationSessionTransport::InitWithSocketTransport(nsISocketTransport* aTransport,
|
||||
nsIPresentationSessionTransportCallback* aCallback)
|
||||
{
|
||||
if (NS_WARN_IF(!aCallback)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
mCallback = aCallback;
|
||||
|
||||
if (NS_WARN_IF(!aTransport)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
mTransport = aTransport;
|
||||
|
||||
if (NS_WARN_IF(!aListener)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
mListener = aListener;
|
||||
|
||||
nsresult rv = CreateStream();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
SetReadyState(ReadyState::OPEN);
|
||||
SetReadyState(OPEN);
|
||||
|
||||
if (IsReadyToNotifyData()) {
|
||||
return CreateInputStreamPump();
|
||||
}
|
||||
|
||||
mType = nsIPresentationSessionTransportBuilder::TYPE_SENDER;
|
||||
|
||||
nsCOMPtr<nsIPresentationSessionTransport> sessionTransport = do_QueryObject(this);
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethodWithArgs
|
||||
<nsIPresentationSessionTransport*>(mListener,
|
||||
&nsIPresentationSessionTransportBuilderListener::OnSessionTransport,
|
||||
sessionTransport);
|
||||
return NS_DispatchToCurrentThread(runnable);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresentationTCPSessionTransport::BuildTCPReceiverTransport(nsIPresentationChannelDescription* aDescription,
|
||||
nsIPresentationSessionTransportBuilderListener* aListener)
|
||||
PresentationSessionTransport::InitWithChannelDescription(nsIPresentationChannelDescription* aDescription,
|
||||
nsIPresentationSessionTransportCallback* aCallback)
|
||||
{
|
||||
if (NS_WARN_IF(!aCallback)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
mCallback = aCallback;
|
||||
|
||||
if (NS_WARN_IF(!aDescription)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(!aListener)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
mListener = aListener;
|
||||
|
||||
uint16_t serverPort;
|
||||
nsresult rv = aDescription->GetTcpPort(&serverPort);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
|
@ -167,7 +157,7 @@ PresentationTCPSessionTransport::BuildTCPReceiverTransport(nsIPresentationChanne
|
|||
|
||||
PRES_DEBUG("%s:ServerHost[%s],ServerPort[%d]\n", __func__, serverHost.get(), serverPort);
|
||||
|
||||
SetReadyState(ReadyState::CONNECTING);
|
||||
SetReadyState(CONNECTING);
|
||||
|
||||
nsCOMPtr<nsISocketTransportService> sts =
|
||||
do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID);
|
||||
|
@ -190,19 +180,11 @@ PresentationTCPSessionTransport::BuildTCPReceiverTransport(nsIPresentationChanne
|
|||
return rv;
|
||||
}
|
||||
|
||||
mType = nsIPresentationSessionTransportBuilder::TYPE_RECEIVER;
|
||||
|
||||
nsCOMPtr<nsIPresentationSessionTransport> sessionTransport = do_QueryObject(this);
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethodWithArgs
|
||||
<nsIPresentationSessionTransport*>(mListener,
|
||||
&nsIPresentationSessionTransportBuilderListener::OnSessionTransport,
|
||||
sessionTransport);
|
||||
return NS_DispatchToCurrentThread(runnable);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
PresentationTCPSessionTransport::CreateStream()
|
||||
PresentationSessionTransport::CreateStream()
|
||||
{
|
||||
nsresult rv = mTransport->OpenInputStream(0, 0, 0, getter_AddRefs(mSocketInputStream));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
|
@ -270,7 +252,7 @@ PresentationTCPSessionTransport::CreateStream()
|
|||
}
|
||||
|
||||
nsresult
|
||||
PresentationTCPSessionTransport::CreateInputStreamPump()
|
||||
PresentationSessionTransport::CreateInputStreamPump()
|
||||
{
|
||||
nsresult rv;
|
||||
mInputStreamPump = do_CreateInstance(NS_INPUTSTREAMPUMP_CONTRACTID, &rv);
|
||||
|
@ -292,7 +274,7 @@ PresentationTCPSessionTransport::CreateInputStreamPump()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresentationTCPSessionTransport::EnableDataNotification()
|
||||
PresentationSessionTransport::EnableDataNotification()
|
||||
{
|
||||
if (NS_WARN_IF(!mCallback)) {
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
|
@ -311,24 +293,8 @@ PresentationTCPSessionTransport::EnableDataNotification()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIPresentationSessionTransportBuilderListener
|
||||
NS_IMETHODIMP
|
||||
PresentationTCPSessionTransport::GetCallback(nsIPresentationSessionTransportCallback** aCallback)
|
||||
{
|
||||
nsCOMPtr<nsIPresentationSessionTransportCallback> callback = mCallback;
|
||||
callback.forget(aCallback);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresentationTCPSessionTransport::SetCallback(nsIPresentationSessionTransportCallback* aCallback)
|
||||
{
|
||||
mCallback = aCallback;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresentationTCPSessionTransport::GetSelfAddress(nsINetAddr** aSelfAddress)
|
||||
PresentationSessionTransport::GetSelfAddress(nsINetAddr** aSelfAddress)
|
||||
{
|
||||
if (NS_WARN_IF(!mTransport)) {
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
|
@ -338,7 +304,7 @@ PresentationTCPSessionTransport::GetSelfAddress(nsINetAddr** aSelfAddress)
|
|||
}
|
||||
|
||||
void
|
||||
PresentationTCPSessionTransport::EnsureCopying()
|
||||
PresentationSessionTransport::EnsureCopying()
|
||||
{
|
||||
if (mAsyncCopierActive) {
|
||||
return;
|
||||
|
@ -350,14 +316,14 @@ PresentationTCPSessionTransport::EnsureCopying()
|
|||
}
|
||||
|
||||
void
|
||||
PresentationTCPSessionTransport::NotifyCopyComplete(nsresult aStatus)
|
||||
PresentationSessionTransport::NotifyCopyComplete(nsresult aStatus)
|
||||
{
|
||||
mAsyncCopierActive = false;
|
||||
mMultiplexStream->RemoveStream(0);
|
||||
if (NS_WARN_IF(NS_FAILED(aStatus))) {
|
||||
if (mReadyState != ReadyState::CLOSED) {
|
||||
if (mReadyState != CLOSED) {
|
||||
mCloseStatus = aStatus;
|
||||
SetReadyState(ReadyState::CLOSED);
|
||||
SetReadyState(CLOSED);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -373,17 +339,17 @@ PresentationTCPSessionTransport::NotifyCopyComplete(nsresult aStatus)
|
|||
return;
|
||||
}
|
||||
|
||||
if (mReadyState == ReadyState::CLOSING) {
|
||||
if (mReadyState == CLOSING) {
|
||||
mSocketOutputStream->Close();
|
||||
mCloseStatus = NS_OK;
|
||||
SetReadyState(ReadyState::CLOSED);
|
||||
SetReadyState(CLOSED);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresentationTCPSessionTransport::Send(nsIInputStream* aData)
|
||||
PresentationSessionTransport::Send(nsIInputStream* aData)
|
||||
{
|
||||
if (NS_WARN_IF(mReadyState != ReadyState::OPEN)) {
|
||||
if (NS_WARN_IF(mReadyState != OPEN)) {
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
}
|
||||
|
||||
|
@ -395,16 +361,16 @@ PresentationTCPSessionTransport::Send(nsIInputStream* aData)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresentationTCPSessionTransport::Close(nsresult aReason)
|
||||
PresentationSessionTransport::Close(nsresult aReason)
|
||||
{
|
||||
PRES_DEBUG("%s:reason[%x]\n", __func__, aReason);
|
||||
|
||||
if (mReadyState == ReadyState::CLOSED || mReadyState == ReadyState::CLOSING) {
|
||||
if (mReadyState == CLOSED || mReadyState == CLOSING) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mCloseStatus = aReason;
|
||||
SetReadyState(ReadyState::CLOSING);
|
||||
SetReadyState(CLOSING);
|
||||
|
||||
uint32_t count = 0;
|
||||
mMultiplexStream->GetCount(&count);
|
||||
|
@ -415,20 +381,18 @@ PresentationTCPSessionTransport::Close(nsresult aReason)
|
|||
mSocketInputStream->Close();
|
||||
mDataNotificationEnabled = false;
|
||||
|
||||
mListener = nullptr;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
PresentationTCPSessionTransport::SetReadyState(ReadyState aReadyState)
|
||||
PresentationSessionTransport::SetReadyState(ReadyState aReadyState)
|
||||
{
|
||||
mReadyState = aReadyState;
|
||||
|
||||
if (mReadyState == ReadyState::OPEN && mCallback) {
|
||||
if (mReadyState == OPEN && mCallback) {
|
||||
// Notify the transport channel is ready.
|
||||
NS_WARN_IF(NS_FAILED(mCallback->NotifyTransportReady()));
|
||||
} else if (mReadyState == ReadyState::CLOSED && mCallback) {
|
||||
} else if (mReadyState == CLOSED && mCallback) {
|
||||
// Notify the transport channel has been shut down.
|
||||
NS_WARN_IF(NS_FAILED(mCallback->NotifyTransportClosed(mCloseStatus)));
|
||||
mCallback = nullptr;
|
||||
|
@ -437,10 +401,10 @@ PresentationTCPSessionTransport::SetReadyState(ReadyState aReadyState)
|
|||
|
||||
// nsITransportEventSink
|
||||
NS_IMETHODIMP
|
||||
PresentationTCPSessionTransport::OnTransportStatus(nsITransport* aTransport,
|
||||
nsresult aStatus,
|
||||
int64_t aProgress,
|
||||
int64_t aProgressMax)
|
||||
PresentationSessionTransport::OnTransportStatus(nsITransport* aTransport,
|
||||
nsresult aStatus,
|
||||
int64_t aProgress,
|
||||
int64_t aProgressMax)
|
||||
{
|
||||
PRES_DEBUG("%s:aStatus[%x]\n", __func__, aStatus);
|
||||
|
||||
|
@ -450,7 +414,7 @@ PresentationTCPSessionTransport::OnTransportStatus(nsITransport* aTransport,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
SetReadyState(ReadyState::OPEN);
|
||||
SetReadyState(OPEN);
|
||||
|
||||
if (IsReadyToNotifyData()) {
|
||||
return CreateInputStreamPump();
|
||||
|
@ -461,7 +425,7 @@ PresentationTCPSessionTransport::OnTransportStatus(nsITransport* aTransport,
|
|||
|
||||
// nsIInputStreamCallback
|
||||
NS_IMETHODIMP
|
||||
PresentationTCPSessionTransport::OnInputStreamReady(nsIAsyncInputStream* aStream)
|
||||
PresentationSessionTransport::OnInputStreamReady(nsIAsyncInputStream* aStream)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
|
@ -469,9 +433,9 @@ PresentationTCPSessionTransport::OnInputStreamReady(nsIAsyncInputStream* aStream
|
|||
uint64_t dummy;
|
||||
nsresult rv = aStream->Available(&dummy);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
if (mReadyState != ReadyState::CLOSED) {
|
||||
if (mReadyState != CLOSED) {
|
||||
mCloseStatus = NS_ERROR_CONNECTION_REFUSED;
|
||||
SetReadyState(ReadyState::CLOSED);
|
||||
SetReadyState(CLOSED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -480,17 +444,17 @@ PresentationTCPSessionTransport::OnInputStreamReady(nsIAsyncInputStream* aStream
|
|||
|
||||
// nsIRequestObserver
|
||||
NS_IMETHODIMP
|
||||
PresentationTCPSessionTransport::OnStartRequest(nsIRequest* aRequest,
|
||||
nsISupports* aContext)
|
||||
PresentationSessionTransport::OnStartRequest(nsIRequest* aRequest,
|
||||
nsISupports* aContext)
|
||||
{
|
||||
// Do nothing.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresentationTCPSessionTransport::OnStopRequest(nsIRequest* aRequest,
|
||||
nsISupports* aContext,
|
||||
nsresult aStatusCode)
|
||||
PresentationSessionTransport::OnStopRequest(nsIRequest* aRequest,
|
||||
nsISupports* aContext,
|
||||
nsresult aStatusCode)
|
||||
{
|
||||
PRES_DEBUG("%s:aStatusCode[%x]\n", __func__, aStatusCode);
|
||||
|
||||
|
@ -513,20 +477,20 @@ PresentationTCPSessionTransport::OnStopRequest(nsIRequest* aRequest,
|
|||
}
|
||||
|
||||
// We call this even if there is no error.
|
||||
if (mReadyState != ReadyState::CLOSED) {
|
||||
if (mReadyState != CLOSED) {
|
||||
mCloseStatus = aStatusCode;
|
||||
SetReadyState(ReadyState::CLOSED);
|
||||
SetReadyState(CLOSED);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIStreamListener
|
||||
NS_IMETHODIMP
|
||||
PresentationTCPSessionTransport::OnDataAvailable(nsIRequest* aRequest,
|
||||
nsISupports* aContext,
|
||||
nsIInputStream* aStream,
|
||||
uint64_t aOffset,
|
||||
uint32_t aCount)
|
||||
PresentationSessionTransport::OnDataAvailable(nsIRequest* aRequest,
|
||||
nsISupports* aContext,
|
||||
nsIInputStream* aStream,
|
||||
uint64_t aOffset,
|
||||
uint32_t aCount)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
|
@ -11,7 +11,6 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsIAsyncInputStream.h"
|
||||
#include "nsIPresentationSessionTransport.h"
|
||||
#include "nsIPresentationSessionTransportBuilder.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsITransport.h"
|
||||
|
@ -39,31 +38,28 @@ namespace dom {
|
|||
* of Presentation API (without SSL) and should be migrated to DataChannel with
|
||||
* full support soon.
|
||||
*/
|
||||
class PresentationTCPSessionTransport final : public nsIPresentationSessionTransport
|
||||
, public nsIPresentationTCPSessionTransportBuilder
|
||||
, public nsITransportEventSink
|
||||
, public nsIInputStreamCallback
|
||||
, public nsIStreamListener
|
||||
class PresentationSessionTransport final : public nsIPresentationSessionTransport
|
||||
, public nsITransportEventSink
|
||||
, public nsIInputStreamCallback
|
||||
, public nsIStreamListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(PresentationTCPSessionTransport,
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(PresentationSessionTransport,
|
||||
nsIPresentationSessionTransport)
|
||||
|
||||
NS_DECL_NSIPRESENTATIONSESSIONTRANSPORT
|
||||
NS_DECL_NSIPRESENTATIONSESSIONTRANSPORTBUILDER
|
||||
NS_DECL_NSIPRESENTATIONTCPSESSIONTRANSPORTBUILDER
|
||||
NS_DECL_NSITRANSPORTEVENTSINK
|
||||
NS_DECL_NSIINPUTSTREAMCALLBACK
|
||||
NS_DECL_NSIREQUESTOBSERVER
|
||||
NS_DECL_NSISTREAMLISTENER
|
||||
|
||||
PresentationTCPSessionTransport();
|
||||
PresentationSessionTransport();
|
||||
|
||||
void NotifyCopyComplete(nsresult aStatus);
|
||||
|
||||
private:
|
||||
~PresentationTCPSessionTransport();
|
||||
~PresentationSessionTransport();
|
||||
|
||||
nsresult CreateStream();
|
||||
|
||||
|
@ -71,7 +67,7 @@ private:
|
|||
|
||||
void EnsureCopying();
|
||||
|
||||
enum class ReadyState {
|
||||
enum ReadyState {
|
||||
CONNECTING,
|
||||
OPEN,
|
||||
CLOSING,
|
||||
|
@ -82,7 +78,7 @@ private:
|
|||
|
||||
bool IsReadyToNotifyData()
|
||||
{
|
||||
return mDataNotificationEnabled && mReadyState == ReadyState::OPEN;
|
||||
return mDataNotificationEnabled && mReadyState == OPEN;
|
||||
}
|
||||
|
||||
ReadyState mReadyState;
|
||||
|
@ -90,8 +86,6 @@ private:
|
|||
nsresult mCloseStatus;
|
||||
bool mDataNotificationEnabled;
|
||||
|
||||
uint8_t mType = 0;
|
||||
|
||||
// Raw socket streams
|
||||
nsCOMPtr<nsISocketTransport> mTransport;
|
||||
nsCOMPtr<nsIInputStream> mSocketInputStream;
|
||||
|
@ -106,7 +100,6 @@ private:
|
|||
nsCOMPtr<nsIAsyncStreamCopier> mMultiplexStreamCopier;
|
||||
|
||||
nsCOMPtr<nsIPresentationSessionTransportCallback> mCallback;
|
||||
nsCOMPtr<nsIPresentationSessionTransportBuilderListener> mListener;
|
||||
};
|
||||
|
||||
} // namespace dom
|
|
@ -15,7 +15,6 @@ XPIDL_SOURCES += [
|
|||
'nsIPresentationService.idl',
|
||||
'nsIPresentationSessionRequest.idl',
|
||||
'nsIPresentationSessionTransport.idl',
|
||||
'nsIPresentationSessionTransportBuilder.idl',
|
||||
'nsITCPPresentationServer.idl',
|
||||
]
|
||||
|
||||
|
|
|
@ -6,10 +6,12 @@
|
|||
|
||||
interface nsIInputStream;
|
||||
interface nsINetAddr;
|
||||
interface nsIPresentationChannelDescription;
|
||||
interface nsISocketTransport;
|
||||
|
||||
%{C++
|
||||
#define PRESENTATION_TCP_SESSION_TRANSPORT_CONTRACTID \
|
||||
"@mozilla.org/presentation/presentationtcpsessiontransport;1"
|
||||
#define PRESENTATION_SESSION_TRANSPORT_CONTRACTID \
|
||||
"@mozilla.org/presentation/presentationsessiontransport;1"
|
||||
%}
|
||||
|
||||
/*
|
||||
|
@ -26,19 +28,32 @@ interface nsIPresentationSessionTransportCallback : nsISupports
|
|||
/*
|
||||
* App-to-App transport channel for the presentation session.
|
||||
*/
|
||||
[scriptable, uuid(7af8556e-e37b-4ca1-a5dd-029567172863)]
|
||||
[scriptable, uuid(b6a416cf-03ae-4e74-9cda-88828e8ff418)]
|
||||
interface nsIPresentationSessionTransport : nsISupports
|
||||
{
|
||||
// Should be set once the underlying session transport is built
|
||||
attribute nsIPresentationSessionTransportCallback callback;
|
||||
|
||||
// valid for TCP session transport
|
||||
readonly attribute nsINetAddr selfAddress;
|
||||
|
||||
/*
|
||||
* Initialize the transport channel with an existent socket transport. (This
|
||||
* is primarily used at the sender side.)
|
||||
* @param transport The socket transport.
|
||||
* @param callback The callback for followup notifications.
|
||||
*/
|
||||
void initWithSocketTransport(in nsISocketTransport transport,
|
||||
in nsIPresentationSessionTransportCallback callback);
|
||||
|
||||
/*
|
||||
* Initialize the transport channel with the channel description. (This is
|
||||
* primarily used at the receiver side.)
|
||||
* @param description The channel description.
|
||||
* @param callback The callback for followup notifications.
|
||||
*/
|
||||
void initWithChannelDescription(in nsIPresentationChannelDescription description,
|
||||
in nsIPresentationSessionTransportCallback callback);
|
||||
|
||||
/*
|
||||
* Enable the notification for incoming data. |notifyData| of
|
||||
* |nsIPresentationSessionTransportCallback| can start getting invoked.
|
||||
* Should set callback before |enableDataNotification| is called.
|
||||
*/
|
||||
void enableDataNotification();
|
||||
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
/* 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 "nsISupports.idl"
|
||||
|
||||
interface nsIPresentationChannelDescription;
|
||||
interface nsISocketTransport;
|
||||
interface nsIDOMWindow;
|
||||
interface nsIPresentationControlChannel;
|
||||
interface nsIPresentationSessionTransport;
|
||||
|
||||
[scriptable, uuid(673f6de1-e253-41b8-9be8-b7ff161fa8dc)]
|
||||
interface nsIPresentationSessionTransportBuilderListener : nsISupports
|
||||
{
|
||||
// Should set |transport.callback| in |onSessionTransport|.
|
||||
void onSessionTransport(in nsIPresentationSessionTransport transport);
|
||||
|
||||
void onError(in nsresult reason);
|
||||
};
|
||||
|
||||
[scriptable, uuid(2fdbe67d-80f9-48dc-8237-5bef8fa19801)]
|
||||
interface nsIPresentationSessionTransportBuilder : nsISupports
|
||||
{
|
||||
const unsigned short TYPE_SENDER = 1;
|
||||
const unsigned short TYPE_RECEIVER = 2;
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for TCP session transport
|
||||
*/
|
||||
[scriptable, uuid(cde36d6e-f471-4262-a70d-f932a26b21d9)]
|
||||
interface nsIPresentationTCPSessionTransportBuilder : nsIPresentationSessionTransportBuilder
|
||||
{
|
||||
/**
|
||||
* The following creation functions will trigger |listener.onSessionTransport|
|
||||
* if the session transport is successfully built, |listener.onError| if some
|
||||
* error occurs during building session transport.
|
||||
*/
|
||||
void buildTCPSenderTransport(in nsISocketTransport aTransport,
|
||||
in nsIPresentationSessionTransportBuilderListener aListener);
|
||||
|
||||
void buildTCPReceiverTransport(in nsIPresentationChannelDescription aDescription,
|
||||
in nsIPresentationSessionTransportBuilderListener aListener);
|
||||
};
|
||||
|
||||
/**
|
||||
* Builder for WebRTC data channel session transport
|
||||
*/
|
||||
[scriptable, uuid(8131c4e0-3a8c-4bc1-a92a-8431473d2fe8)]
|
||||
interface nsIPresentationDataChannelSessionTransportBuilder : nsIPresentationSessionTransportBuilder
|
||||
{
|
||||
/**
|
||||
* The following creation function will trigger |listener.onSessionTransport|
|
||||
* if the session transport is successfully built, |listener.onError| if some
|
||||
* error occurs during creating session transport.
|
||||
*/
|
||||
void buildDataChannelTransport(in uint8_t aType,
|
||||
in nsIDOMWindow aWindow,
|
||||
in nsIPresentationControlChannel aControlChannel,
|
||||
in nsIPresentationSessionTransportBuilderListener aListener);
|
||||
};
|
|
@ -22,7 +22,7 @@ EXPORTS.mozilla.dom += [
|
|||
'PresentationRequest.h',
|
||||
'PresentationService.h',
|
||||
'PresentationSessionInfo.h',
|
||||
'PresentationTCPSessionTransport.h',
|
||||
'PresentationSessionTransport.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
|
@ -39,7 +39,7 @@ UNIFIED_SOURCES += [
|
|||
'PresentationService.cpp',
|
||||
'PresentationSessionInfo.cpp',
|
||||
'PresentationSessionRequest.cpp',
|
||||
'PresentationTCPSessionTransport.cpp',
|
||||
'PresentationSessionTransport.cpp',
|
||||
]
|
||||
|
||||
EXTRA_COMPONENTS += [
|
||||
|
|
|
@ -198,7 +198,6 @@ const mockedDevicePrompt = {
|
|||
|
||||
const mockedSessionTransport = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationSessionTransport,
|
||||
Ci.nsIPresentationTCPSessionTransportBuilder,
|
||||
Ci.nsIFactory]),
|
||||
createInstance: function(aOuter, aIID) {
|
||||
if (aOuter) {
|
||||
|
@ -215,19 +214,13 @@ const mockedSessionTransport = {
|
|||
get selfAddress() {
|
||||
return this._selfAddress;
|
||||
},
|
||||
buildTCPSenderTransport: function(transport, listener) {
|
||||
initWithSocketTransport: function(transport, callback) {
|
||||
sendAsyncMessage('data-transport-initialized');
|
||||
this._listener = listener;
|
||||
this._type = Ci.nsIPresentationSessionTransportBuilder.TYPE_SENDER;
|
||||
|
||||
this._listener.onSessionTransport(this);
|
||||
this._listener = null;
|
||||
|
||||
this._callback = callback;
|
||||
this.simulateTransportReady();
|
||||
},
|
||||
buildTCPReceiverTransport: function(description, listener) {
|
||||
this._listener = listener;
|
||||
this._type = Ci.nsIPresentationSessionTransportBuilder.TYPE_RECEIVER;
|
||||
initWithChannelDescription: function(description, callback) {
|
||||
this._callback = callback;
|
||||
|
||||
var addresses = description.QueryInterface(Ci.nsIPresentationChannelDescription).tcpAddress;
|
||||
this._selfAddress = {
|
||||
|
@ -236,9 +229,6 @@ const mockedSessionTransport = {
|
|||
addresses.queryElementAt(0, Ci.nsISupportsCString).data : "",
|
||||
port: description.QueryInterface(Ci.nsIPresentationChannelDescription).tcpPort,
|
||||
};
|
||||
|
||||
this._listener.onSessionTransport(this);
|
||||
this._listener = null;
|
||||
},
|
||||
enableDataNotification: function() {
|
||||
sendAsyncMessage('data-transport-notification-enabled');
|
||||
|
@ -312,7 +302,7 @@ originalFactoryData.push(registerMockedFactory("@mozilla.org/presentation-device
|
|||
originalFactoryData.push(registerMockedFactory("@mozilla.org/network/server-socket;1",
|
||||
uuidGenerator.generateUUID(),
|
||||
mockedServerSocket));
|
||||
originalFactoryData.push(registerMockedFactory("@mozilla.org/presentation/presentationtcpsessiontransport;1",
|
||||
originalFactoryData.push(registerMockedFactory("@mozilla.org/presentation/presentationsessiontransport;1",
|
||||
uuidGenerator.generateUUID(),
|
||||
mockedSessionTransport));
|
||||
originalFactoryData.push(registerMockedFactory("@mozilla.org/network/manager;1",
|
||||
|
|
|
@ -16,9 +16,6 @@ var testServer = null;
|
|||
var clientTransport = null;
|
||||
var serverTransport = null;
|
||||
|
||||
var clientBuilder = null;
|
||||
var serverBuilder = null;
|
||||
|
||||
const clientMessage = "Client Message";
|
||||
const serverMessage = "Server Message";
|
||||
|
||||
|
@ -87,33 +84,6 @@ const serverCallback = {
|
|||
},
|
||||
};
|
||||
|
||||
const clientListener = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationSessionTransportBuilderListener]),
|
||||
onSessionTransport(aTransport) {
|
||||
Assert.ok(true, "Client Transport is built.");
|
||||
clientTransport = aTransport;
|
||||
clientTransport.callback = clientCallback;
|
||||
|
||||
if (serverTransport) {
|
||||
run_next_test();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const serverListener = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationSessionTransportBuilderListener]),
|
||||
onSessionTransport(aTransport) {
|
||||
Assert.ok(true, "Server Transport is built.");
|
||||
serverTransport = aTransport;
|
||||
serverTransport.callback = serverCallback;
|
||||
serverTransport.enableDataNotification();
|
||||
|
||||
if (clientTransport) {
|
||||
run_next_test();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function TestServer() {
|
||||
this.serverSocket = ServerSocket(-1, true, -1);
|
||||
this.serverSocket.asyncListen(this)
|
||||
|
@ -122,9 +92,10 @@ function TestServer() {
|
|||
TestServer.prototype = {
|
||||
onSocketAccepted: function(aSocket, aTransport) {
|
||||
print("Test server gets a client connection.");
|
||||
serverBuilder = Cc["@mozilla.org/presentation/presentationtcpsessiontransport;1"]
|
||||
.createInstance(Ci.nsIPresentationTCPSessionTransportBuilder);
|
||||
serverBuilder.buildTCPSenderTransport(aTransport, serverListener);
|
||||
serverTransport = Cc["@mozilla.org/presentation/presentationsessiontransport;1"]
|
||||
.createInstance(Ci.nsIPresentationSessionTransport);
|
||||
serverTransport.initWithSocketTransport(aTransport, serverCallback);
|
||||
serverTransport.enableDataNotification();
|
||||
},
|
||||
onStopListening: function(aSocket) {
|
||||
print("Test server stops listening.");
|
||||
|
@ -140,9 +111,9 @@ TestServer.prototype = {
|
|||
// Set up the transport connection and ensure |notifyTransportReady| triggered
|
||||
// at both sides.
|
||||
function setup() {
|
||||
clientBuilder = Cc["@mozilla.org/presentation/presentationtcpsessiontransport;1"]
|
||||
.createInstance(Ci.nsIPresentationTCPSessionTransportBuilder);
|
||||
clientBuilder.buildTCPReceiverTransport(serverChannelDescription, clientListener);
|
||||
clientTransport = Cc["@mozilla.org/presentation/presentationsessiontransport;1"]
|
||||
.createInstance(Ci.nsIPresentationSessionTransport);
|
||||
clientTransport.initWithChannelDescription(serverChannelDescription, clientCallback);
|
||||
}
|
||||
|
||||
// Test |selfAddress| attribute of |nsIPresentationSessionTransport|.
|
||||
|
|
|
@ -263,7 +263,7 @@ static void Shutdown();
|
|||
#include "GMPService.h"
|
||||
|
||||
#include "mozilla/dom/PresentationDeviceManager.h"
|
||||
#include "mozilla/dom/PresentationTCPSessionTransport.h"
|
||||
#include "mozilla/dom/PresentationSessionTransport.h"
|
||||
|
||||
#include "mozilla/TextInputProcessor.h"
|
||||
|
||||
|
@ -298,7 +298,7 @@ using mozilla::dom::NotificationTelemetryService;
|
|||
#define PRESENTATION_DEVICE_MANAGER_CID \
|
||||
{ 0xe1e79dec, 0x4085, 0x4994, { 0xac, 0x5b, 0x74, 0x4b, 0x01, 0x66, 0x97, 0xe6 } }
|
||||
|
||||
#define PRESENTATION_TCP_SESSION_TRANSPORT_CID \
|
||||
#define PRESENTATION_SESSION_TRANSPORT_CID \
|
||||
{ 0xc9d023f4, 0x6228, 0x4c07, { 0x8b, 0x1d, 0x9c, 0x19, 0x57, 0x3f, 0xaa, 0x27 } }
|
||||
|
||||
already_AddRefed<nsIPresentationService> NS_CreatePresentationService();
|
||||
|
@ -405,7 +405,7 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(FakeInputPortService,
|
|||
NS_GENERIC_FACTORY_CONSTRUCTOR(InputPortData)
|
||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIPresentationService,
|
||||
NS_CreatePresentationService)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(PresentationTCPSessionTransport)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(PresentationSessionTransport)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(NotificationTelemetryService, Init)
|
||||
|
||||
#ifndef MOZ_SIMPLEPUSH
|
||||
|
@ -872,7 +872,7 @@ NS_DEFINE_NAMED_CID(GECKO_MEDIA_PLUGIN_SERVICE_CID);
|
|||
|
||||
NS_DEFINE_NAMED_CID(PRESENTATION_SERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(PRESENTATION_DEVICE_MANAGER_CID);
|
||||
NS_DEFINE_NAMED_CID(PRESENTATION_TCP_SESSION_TRANSPORT_CID);
|
||||
NS_DEFINE_NAMED_CID(PRESENTATION_SESSION_TRANSPORT_CID);
|
||||
|
||||
NS_DEFINE_NAMED_CID(TEXT_INPUT_PROCESSOR_CID);
|
||||
|
||||
|
@ -1171,7 +1171,7 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
|
|||
{ &kTV_PROGRAM_DATA_CID, false, nullptr, TVProgramDataConstructor },
|
||||
{ &kPRESENTATION_SERVICE_CID, false, nullptr, nsIPresentationServiceConstructor },
|
||||
{ &kPRESENTATION_DEVICE_MANAGER_CID, false, nullptr, PresentationDeviceManagerConstructor },
|
||||
{ &kPRESENTATION_TCP_SESSION_TRANSPORT_CID, false, nullptr, PresentationTCPSessionTransportConstructor },
|
||||
{ &kPRESENTATION_SESSION_TRANSPORT_CID, false, nullptr, PresentationSessionTransportConstructor },
|
||||
{ &kTEXT_INPUT_PROCESSOR_CID, false, nullptr, TextInputProcessorConstructor },
|
||||
{ &kFAKE_INPUTPORT_SERVICE_CID, false, nullptr, FakeInputPortServiceConstructor },
|
||||
{ &kINPUTPORT_DATA_CID, false, nullptr, InputPortDataConstructor },
|
||||
|
@ -1340,7 +1340,7 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
|
|||
{ NS_VOICEMAIL_SERVICE_CONTRACTID, &kNS_VOICEMAIL_SERVICE_CID },
|
||||
{ PRESENTATION_SERVICE_CONTRACTID, &kPRESENTATION_SERVICE_CID },
|
||||
{ PRESENTATION_DEVICE_MANAGER_CONTRACTID, &kPRESENTATION_DEVICE_MANAGER_CID },
|
||||
{ PRESENTATION_TCP_SESSION_TRANSPORT_CONTRACTID, &kPRESENTATION_TCP_SESSION_TRANSPORT_CID },
|
||||
{ PRESENTATION_SESSION_TRANSPORT_CONTRACTID, &kPRESENTATION_SESSION_TRANSPORT_CID },
|
||||
{ "@mozilla.org/text-input-processor;1", &kTEXT_INPUT_PROCESSOR_CID },
|
||||
{ FAKE_INPUTPORT_SERVICE_CONTRACTID, &kFAKE_INPUTPORT_SERVICE_CID },
|
||||
{ INPUTPORT_DATA_CONTRACTID, &kINPUTPORT_DATA_CID },
|
||||
|
|
Загрузка…
Ссылка в новой задаче