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:
Sebastian Hengst 2016-04-11 13:12:34 +02:00
Родитель ae9f706ab7
Коммит f17e7a91b7
11 изменённых файлов: 167 добавлений и 321 удалений

Просмотреть файл

@ -121,21 +121,21 @@ PresentationNetworkHelper::OnGetWifiIPAddress(const nsACString& aIPAddress)
#endif // MOZ_WIDGET_ANDROID #endif // MOZ_WIDGET_ANDROID
class TCPPresentationChannelDescription final : public nsIPresentationChannelDescription class PresentationChannelDescription final : public nsIPresentationChannelDescription
{ {
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_DECL_NSIPRESENTATIONCHANNELDESCRIPTION NS_DECL_NSIPRESENTATIONCHANNELDESCRIPTION
TCPPresentationChannelDescription(const nsACString& aAddress, PresentationChannelDescription(const nsACString& aAddress,
uint16_t aPort) uint16_t aPort)
: mAddress(aAddress) : mAddress(aAddress)
, mPort(aPort) , mPort(aPort)
{ {
} }
private: private:
~TCPPresentationChannelDescription() {} ~PresentationChannelDescription() {}
nsCString mAddress; nsCString mAddress;
uint16_t mPort; uint16_t mPort;
@ -144,10 +144,10 @@ private:
} // namespace dom } // namespace dom
} // namespace mozilla } // namespace mozilla
NS_IMPL_ISUPPORTS(TCPPresentationChannelDescription, nsIPresentationChannelDescription) NS_IMPL_ISUPPORTS(PresentationChannelDescription, nsIPresentationChannelDescription)
NS_IMETHODIMP NS_IMETHODIMP
TCPPresentationChannelDescription::GetType(uint8_t* aRetVal) PresentationChannelDescription::GetType(uint8_t* aRetVal)
{ {
if (NS_WARN_IF(!aRetVal)) { if (NS_WARN_IF(!aRetVal)) {
return NS_ERROR_INVALID_POINTER; return NS_ERROR_INVALID_POINTER;
@ -160,7 +160,7 @@ TCPPresentationChannelDescription::GetType(uint8_t* aRetVal)
} }
NS_IMETHODIMP NS_IMETHODIMP
TCPPresentationChannelDescription::GetTcpAddress(nsIArray** aRetVal) PresentationChannelDescription::GetTcpAddress(nsIArray** aRetVal)
{ {
if (NS_WARN_IF(!aRetVal)) { if (NS_WARN_IF(!aRetVal)) {
return NS_ERROR_INVALID_POINTER; return NS_ERROR_INVALID_POINTER;
@ -189,7 +189,7 @@ TCPPresentationChannelDescription::GetTcpAddress(nsIArray** aRetVal)
} }
NS_IMETHODIMP NS_IMETHODIMP
TCPPresentationChannelDescription::GetTcpPort(uint16_t* aRetVal) PresentationChannelDescription::GetTcpPort(uint16_t* aRetVal)
{ {
if (NS_WARN_IF(!aRetVal)) { if (NS_WARN_IF(!aRetVal)) {
return NS_ERROR_INVALID_POINTER; return NS_ERROR_INVALID_POINTER;
@ -200,7 +200,7 @@ TCPPresentationChannelDescription::GetTcpPort(uint16_t* aRetVal)
} }
NS_IMETHODIMP NS_IMETHODIMP
TCPPresentationChannelDescription::GetDataChannelSDP(nsAString& aDataChannelSDP) PresentationChannelDescription::GetDataChannelSDP(nsAString& aDataChannelSDP)
{ {
// TODO bug 1148307 Implement PresentationSessionTransport with DataChannel. // TODO bug 1148307 Implement PresentationSessionTransport with DataChannel.
// Only support TCP socket for now. // Only support TCP socket for now.
@ -214,8 +214,7 @@ TCPPresentationChannelDescription::GetDataChannelSDP(nsAString& aDataChannelSDP)
NS_IMPL_ISUPPORTS(PresentationSessionInfo, NS_IMPL_ISUPPORTS(PresentationSessionInfo,
nsIPresentationSessionTransportCallback, nsIPresentationSessionTransportCallback,
nsIPresentationControlChannelListener, nsIPresentationControlChannelListener);
nsIPresentationSessionTransportBuilderListener);
/* virtual */ nsresult /* virtual */ nsresult
PresentationSessionInfo::Init(nsIPresentationControlChannel* aControlChannel) PresentationSessionInfo::Init(nsIPresentationControlChannel* aControlChannel)
@ -407,31 +406,6 @@ PresentationSessionInfo::NotifyData(const nsACString& aData)
return mListener->NotifyMessage(mSessionId, 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 * Implementation of PresentationControllingInfo
* *
@ -596,8 +570,8 @@ PresentationControllingInfo::OnGetAddress(const nsACString& aAddress)
return rv; return rv;
} }
RefPtr<TCPPresentationChannelDescription> description = RefPtr<PresentationChannelDescription> description =
new TCPPresentationChannelDescription(aAddress, static_cast<uint16_t>(port)); new PresentationChannelDescription(aAddress, static_cast<uint16_t>(port));
return mControlChannel->SendOffer(description); return mControlChannel->SendOffer(description);
} }
@ -670,14 +644,23 @@ PresentationControllingInfo::OnSocketAccepted(nsIServerSocket* aServerSocket,
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
// Initialize session transport builder and use |this| as the callback. // Initialize |mTransport| and use |this| as the callback.
nsCOMPtr<nsIPresentationTCPSessionTransportBuilder> builder = mTransport = do_CreateInstance(PRESENTATION_SESSION_TRANSPORT_CONTRACTID);
do_CreateInstance(PRESENTATION_TCP_SESSION_TRANSPORT_CONTRACTID); if (NS_WARN_IF(!mTransport)) {
if (NS_WARN_IF(!builder)) {
return ReplyError(NS_ERROR_DOM_OPERATION_ERR); 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 NS_IMETHODIMP
@ -762,11 +745,28 @@ PresentationPresentingInfo::Shutdown(nsresult aReason)
mPromise = nullptr; mPromise = nullptr;
} }
// nsIPresentationSessionTransportBuilderListener nsresult
NS_IMETHODIMP PresentationPresentingInfo::InitTransportAndSendAnswer()
PresentationPresentingInfo::OnSessionTransport(nsIPresentationSessionTransport* transport)
{ {
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. // Prepare and send the answer.
// TODO bug 1148307 Implement PresentationSessionTransport with DataChannel. // TODO bug 1148307 Implement PresentationSessionTransport with DataChannel.
@ -775,7 +775,7 @@ PresentationPresentingInfo::OnSessionTransport(nsIPresentationSessionTransport*
// |InitWithChannelDescription|. Yet this deficiency only affects the channel // |InitWithChannelDescription|. Yet this deficiency only affects the channel
// description for the answer, which is not actually checked at requester side. // description for the answer, which is not actually checked at requester side.
nsCOMPtr<nsINetAddr> selfAddr; nsCOMPtr<nsINetAddr> selfAddr;
nsresult rv = mTransport->GetSelfAddress(getter_AddRefs(selfAddr)); rv = mTransport->GetSelfAddress(getter_AddRefs(selfAddr));
NS_WARN_IF(NS_FAILED(rv)); NS_WARN_IF(NS_FAILED(rv));
nsCString address; nsCString address;
@ -785,31 +785,11 @@ PresentationPresentingInfo::OnSessionTransport(nsIPresentationSessionTransport*
selfAddr->GetPort(&port); selfAddr->GetPort(&port);
} }
nsCOMPtr<nsIPresentationChannelDescription> description = nsCOMPtr<nsIPresentationChannelDescription> description =
new TCPPresentationChannelDescription(address, port); new PresentationChannelDescription(address, port);
return mControlChannel->SendAnswer(description); 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 nsresult
PresentationPresentingInfo::UntrackFromService() PresentationPresentingInfo::UntrackFromService()
{ {

Просмотреть файл

@ -18,7 +18,6 @@
#include "nsIPresentationListener.h" #include "nsIPresentationListener.h"
#include "nsIPresentationService.h" #include "nsIPresentationService.h"
#include "nsIPresentationSessionTransport.h" #include "nsIPresentationSessionTransport.h"
#include "nsIPresentationSessionTransportBuilder.h"
#include "nsIServerSocket.h" #include "nsIServerSocket.h"
#include "nsITimer.h" #include "nsITimer.h"
#include "nsString.h" #include "nsString.h"
@ -29,12 +28,10 @@ namespace dom {
class PresentationSessionInfo : public nsIPresentationSessionTransportCallback class PresentationSessionInfo : public nsIPresentationSessionTransportCallback
, public nsIPresentationControlChannelListener , public nsIPresentationControlChannelListener
, public nsIPresentationSessionTransportBuilderListener
{ {
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_DECL_NSIPRESENTATIONSESSIONTRANSPORTCALLBACK NS_DECL_NSIPRESENTATIONSESSIONTRANSPORTCALLBACK
NS_DECL_NSIPRESENTATIONSESSIONTRANSPORTBUILDERLISTENER
PresentationSessionInfo(const nsAString& aUrl, PresentationSessionInfo(const nsAString& aUrl,
const nsAString& aSessionId, const nsAString& aSessionId,
@ -187,7 +184,6 @@ class PresentationPresentingInfo final : public PresentationSessionInfo
public: public:
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIPRESENTATIONCONTROLCHANNELLISTENER NS_DECL_NSIPRESENTATIONCONTROLCHANNELLISTENER
NS_DECL_NSIPRESENTATIONSESSIONTRANSPORTBUILDERLISTENER
NS_DECL_NSITIMERCALLBACK NS_DECL_NSITIMERCALLBACK
PresentationPresentingInfo(const nsAString& aUrl, PresentationPresentingInfo(const nsAString& aUrl,

Просмотреть файл

@ -16,12 +16,11 @@
#include "nsISocketTransportService.h" #include "nsISocketTransportService.h"
#include "nsISupportsPrimitives.h" #include "nsISupportsPrimitives.h"
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "nsQueryObject.h"
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
#include "nsStreamUtils.h" #include "nsStreamUtils.h"
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "PresentationLog.h" #include "PresentationLog.h"
#include "PresentationTCPSessionTransport.h" #include "PresentationSessionTransport.h"
#define BUFFER_SIZE 65536 #define BUFFER_SIZE 65536
@ -31,7 +30,7 @@ using namespace mozilla::dom;
class CopierCallbacks final : public nsIRequestObserver class CopierCallbacks final : public nsIRequestObserver
{ {
public: public:
explicit CopierCallbacks(PresentationTCPSessionTransport* aTransport) explicit CopierCallbacks(PresentationSessionTransport* aTransport)
: mOwner(aTransport) : mOwner(aTransport)
{} {}
@ -40,7 +39,7 @@ public:
private: private:
~CopierCallbacks() {} ~CopierCallbacks() {}
RefPtr<PresentationTCPSessionTransport> mOwner; RefPtr<PresentationSessionTransport> mOwner;
}; };
NS_IMPL_ISUPPORTS(CopierCallbacks, nsIRequestObserver) NS_IMPL_ISUPPORTS(CopierCallbacks, nsIRequestObserver)
@ -58,85 +57,76 @@ CopierCallbacks::OnStopRequest(nsIRequest* aRequest, nsISupports* aContext, nsre
return NS_OK; return NS_OK;
} }
NS_IMPL_CYCLE_COLLECTION(PresentationTCPSessionTransport, mTransport, NS_IMPL_CYCLE_COLLECTION(PresentationSessionTransport, mTransport,
mSocketInputStream, mSocketOutputStream, mSocketInputStream, mSocketOutputStream,
mInputStreamPump, mInputStreamScriptable, mInputStreamPump, mInputStreamScriptable,
mMultiplexStream, mMultiplexStreamCopier, mCallback) mMultiplexStream, mMultiplexStreamCopier, mCallback)
NS_IMPL_CYCLE_COLLECTING_ADDREF(PresentationTCPSessionTransport) NS_IMPL_CYCLE_COLLECTING_ADDREF(PresentationSessionTransport)
NS_IMPL_CYCLE_COLLECTING_RELEASE(PresentationTCPSessionTransport) 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_AMBIGUOUS(nsISupports, nsIPresentationSessionTransport)
NS_INTERFACE_MAP_ENTRY(nsIPresentationSessionTransport) NS_INTERFACE_MAP_ENTRY(nsIPresentationSessionTransport)
NS_INTERFACE_MAP_ENTRY(nsITransportEventSink) NS_INTERFACE_MAP_ENTRY(nsITransportEventSink)
NS_INTERFACE_MAP_ENTRY(nsIPresentationTCPSessionTransportBuilder)
NS_INTERFACE_MAP_ENTRY(nsIInputStreamCallback) NS_INTERFACE_MAP_ENTRY(nsIInputStreamCallback)
NS_INTERFACE_MAP_ENTRY(nsIStreamListener) NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
NS_INTERFACE_MAP_ENTRY(nsIRequestObserver) NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
NS_INTERFACE_MAP_END NS_INTERFACE_MAP_END
PresentationTCPSessionTransport::PresentationTCPSessionTransport() PresentationSessionTransport::PresentationSessionTransport()
: mReadyState(ReadyState::CLOSED) : mReadyState(CLOSED)
, mAsyncCopierActive(false) , mAsyncCopierActive(false)
, mCloseStatus(NS_OK) , mCloseStatus(NS_OK)
, mDataNotificationEnabled(false) , mDataNotificationEnabled(false)
{ {
} }
PresentationTCPSessionTransport::~PresentationTCPSessionTransport() PresentationSessionTransport::~PresentationSessionTransport()
{ {
} }
NS_IMETHODIMP NS_IMETHODIMP
PresentationTCPSessionTransport::BuildTCPSenderTransport(nsISocketTransport* aTransport, PresentationSessionTransport::InitWithSocketTransport(nsISocketTransport* aTransport,
nsIPresentationSessionTransportBuilderListener* aListener) nsIPresentationSessionTransportCallback* aCallback)
{ {
if (NS_WARN_IF(!aCallback)) {
return NS_ERROR_INVALID_ARG;
}
mCallback = aCallback;
if (NS_WARN_IF(!aTransport)) { if (NS_WARN_IF(!aTransport)) {
return NS_ERROR_INVALID_ARG; return NS_ERROR_INVALID_ARG;
} }
mTransport = aTransport; mTransport = aTransport;
if (NS_WARN_IF(!aListener)) {
return NS_ERROR_INVALID_ARG;
}
mListener = aListener;
nsresult rv = CreateStream(); nsresult rv = CreateStream();
if (NS_WARN_IF(NS_FAILED(rv))) { if (NS_WARN_IF(NS_FAILED(rv))) {
return rv; return rv;
} }
SetReadyState(ReadyState::OPEN); SetReadyState(OPEN);
if (IsReadyToNotifyData()) { if (IsReadyToNotifyData()) {
return CreateInputStreamPump(); return CreateInputStreamPump();
} }
mType = nsIPresentationSessionTransportBuilder::TYPE_SENDER; return NS_OK;
nsCOMPtr<nsIPresentationSessionTransport> sessionTransport = do_QueryObject(this);
nsCOMPtr<nsIRunnable> runnable =
NS_NewRunnableMethodWithArgs
<nsIPresentationSessionTransport*>(mListener,
&nsIPresentationSessionTransportBuilderListener::OnSessionTransport,
sessionTransport);
return NS_DispatchToCurrentThread(runnable);
} }
NS_IMETHODIMP NS_IMETHODIMP
PresentationTCPSessionTransport::BuildTCPReceiverTransport(nsIPresentationChannelDescription* aDescription, PresentationSessionTransport::InitWithChannelDescription(nsIPresentationChannelDescription* aDescription,
nsIPresentationSessionTransportBuilderListener* aListener) nsIPresentationSessionTransportCallback* aCallback)
{ {
if (NS_WARN_IF(!aCallback)) {
return NS_ERROR_INVALID_ARG;
}
mCallback = aCallback;
if (NS_WARN_IF(!aDescription)) { if (NS_WARN_IF(!aDescription)) {
return NS_ERROR_INVALID_ARG; return NS_ERROR_INVALID_ARG;
} }
if (NS_WARN_IF(!aListener)) {
return NS_ERROR_INVALID_ARG;
}
mListener = aListener;
uint16_t serverPort; uint16_t serverPort;
nsresult rv = aDescription->GetTcpPort(&serverPort); nsresult rv = aDescription->GetTcpPort(&serverPort);
if (NS_WARN_IF(NS_FAILED(rv))) { 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); PRES_DEBUG("%s:ServerHost[%s],ServerPort[%d]\n", __func__, serverHost.get(), serverPort);
SetReadyState(ReadyState::CONNECTING); SetReadyState(CONNECTING);
nsCOMPtr<nsISocketTransportService> sts = nsCOMPtr<nsISocketTransportService> sts =
do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID); do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID);
@ -190,19 +180,11 @@ PresentationTCPSessionTransport::BuildTCPReceiverTransport(nsIPresentationChanne
return rv; return rv;
} }
mType = nsIPresentationSessionTransportBuilder::TYPE_RECEIVER; return NS_OK;
nsCOMPtr<nsIPresentationSessionTransport> sessionTransport = do_QueryObject(this);
nsCOMPtr<nsIRunnable> runnable =
NS_NewRunnableMethodWithArgs
<nsIPresentationSessionTransport*>(mListener,
&nsIPresentationSessionTransportBuilderListener::OnSessionTransport,
sessionTransport);
return NS_DispatchToCurrentThread(runnable);
} }
nsresult nsresult
PresentationTCPSessionTransport::CreateStream() PresentationSessionTransport::CreateStream()
{ {
nsresult rv = mTransport->OpenInputStream(0, 0, 0, getter_AddRefs(mSocketInputStream)); nsresult rv = mTransport->OpenInputStream(0, 0, 0, getter_AddRefs(mSocketInputStream));
if (NS_WARN_IF(NS_FAILED(rv))) { if (NS_WARN_IF(NS_FAILED(rv))) {
@ -270,7 +252,7 @@ PresentationTCPSessionTransport::CreateStream()
} }
nsresult nsresult
PresentationTCPSessionTransport::CreateInputStreamPump() PresentationSessionTransport::CreateInputStreamPump()
{ {
nsresult rv; nsresult rv;
mInputStreamPump = do_CreateInstance(NS_INPUTSTREAMPUMP_CONTRACTID, &rv); mInputStreamPump = do_CreateInstance(NS_INPUTSTREAMPUMP_CONTRACTID, &rv);
@ -292,7 +274,7 @@ PresentationTCPSessionTransport::CreateInputStreamPump()
} }
NS_IMETHODIMP NS_IMETHODIMP
PresentationTCPSessionTransport::EnableDataNotification() PresentationSessionTransport::EnableDataNotification()
{ {
if (NS_WARN_IF(!mCallback)) { if (NS_WARN_IF(!mCallback)) {
return NS_ERROR_DOM_INVALID_STATE_ERR; return NS_ERROR_DOM_INVALID_STATE_ERR;
@ -311,24 +293,8 @@ PresentationTCPSessionTransport::EnableDataNotification()
return NS_OK; return NS_OK;
} }
// nsIPresentationSessionTransportBuilderListener
NS_IMETHODIMP NS_IMETHODIMP
PresentationTCPSessionTransport::GetCallback(nsIPresentationSessionTransportCallback** aCallback) PresentationSessionTransport::GetSelfAddress(nsINetAddr** aSelfAddress)
{
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)
{ {
if (NS_WARN_IF(!mTransport)) { if (NS_WARN_IF(!mTransport)) {
return NS_ERROR_DOM_INVALID_STATE_ERR; return NS_ERROR_DOM_INVALID_STATE_ERR;
@ -338,7 +304,7 @@ PresentationTCPSessionTransport::GetSelfAddress(nsINetAddr** aSelfAddress)
} }
void void
PresentationTCPSessionTransport::EnsureCopying() PresentationSessionTransport::EnsureCopying()
{ {
if (mAsyncCopierActive) { if (mAsyncCopierActive) {
return; return;
@ -350,14 +316,14 @@ PresentationTCPSessionTransport::EnsureCopying()
} }
void void
PresentationTCPSessionTransport::NotifyCopyComplete(nsresult aStatus) PresentationSessionTransport::NotifyCopyComplete(nsresult aStatus)
{ {
mAsyncCopierActive = false; mAsyncCopierActive = false;
mMultiplexStream->RemoveStream(0); mMultiplexStream->RemoveStream(0);
if (NS_WARN_IF(NS_FAILED(aStatus))) { if (NS_WARN_IF(NS_FAILED(aStatus))) {
if (mReadyState != ReadyState::CLOSED) { if (mReadyState != CLOSED) {
mCloseStatus = aStatus; mCloseStatus = aStatus;
SetReadyState(ReadyState::CLOSED); SetReadyState(CLOSED);
} }
return; return;
} }
@ -373,17 +339,17 @@ PresentationTCPSessionTransport::NotifyCopyComplete(nsresult aStatus)
return; return;
} }
if (mReadyState == ReadyState::CLOSING) { if (mReadyState == CLOSING) {
mSocketOutputStream->Close(); mSocketOutputStream->Close();
mCloseStatus = NS_OK; mCloseStatus = NS_OK;
SetReadyState(ReadyState::CLOSED); SetReadyState(CLOSED);
} }
} }
NS_IMETHODIMP 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; return NS_ERROR_DOM_INVALID_STATE_ERR;
} }
@ -395,16 +361,16 @@ PresentationTCPSessionTransport::Send(nsIInputStream* aData)
} }
NS_IMETHODIMP NS_IMETHODIMP
PresentationTCPSessionTransport::Close(nsresult aReason) PresentationSessionTransport::Close(nsresult aReason)
{ {
PRES_DEBUG("%s:reason[%x]\n", __func__, aReason); PRES_DEBUG("%s:reason[%x]\n", __func__, aReason);
if (mReadyState == ReadyState::CLOSED || mReadyState == ReadyState::CLOSING) { if (mReadyState == CLOSED || mReadyState == CLOSING) {
return NS_OK; return NS_OK;
} }
mCloseStatus = aReason; mCloseStatus = aReason;
SetReadyState(ReadyState::CLOSING); SetReadyState(CLOSING);
uint32_t count = 0; uint32_t count = 0;
mMultiplexStream->GetCount(&count); mMultiplexStream->GetCount(&count);
@ -415,20 +381,18 @@ PresentationTCPSessionTransport::Close(nsresult aReason)
mSocketInputStream->Close(); mSocketInputStream->Close();
mDataNotificationEnabled = false; mDataNotificationEnabled = false;
mListener = nullptr;
return NS_OK; return NS_OK;
} }
void void
PresentationTCPSessionTransport::SetReadyState(ReadyState aReadyState) PresentationSessionTransport::SetReadyState(ReadyState aReadyState)
{ {
mReadyState = aReadyState; mReadyState = aReadyState;
if (mReadyState == ReadyState::OPEN && mCallback) { if (mReadyState == OPEN && mCallback) {
// Notify the transport channel is ready. // Notify the transport channel is ready.
NS_WARN_IF(NS_FAILED(mCallback->NotifyTransportReady())); 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. // Notify the transport channel has been shut down.
NS_WARN_IF(NS_FAILED(mCallback->NotifyTransportClosed(mCloseStatus))); NS_WARN_IF(NS_FAILED(mCallback->NotifyTransportClosed(mCloseStatus)));
mCallback = nullptr; mCallback = nullptr;
@ -437,10 +401,10 @@ PresentationTCPSessionTransport::SetReadyState(ReadyState aReadyState)
// nsITransportEventSink // nsITransportEventSink
NS_IMETHODIMP NS_IMETHODIMP
PresentationTCPSessionTransport::OnTransportStatus(nsITransport* aTransport, PresentationSessionTransport::OnTransportStatus(nsITransport* aTransport,
nsresult aStatus, nsresult aStatus,
int64_t aProgress, int64_t aProgress,
int64_t aProgressMax) int64_t aProgressMax)
{ {
PRES_DEBUG("%s:aStatus[%x]\n", __func__, aStatus); PRES_DEBUG("%s:aStatus[%x]\n", __func__, aStatus);
@ -450,7 +414,7 @@ PresentationTCPSessionTransport::OnTransportStatus(nsITransport* aTransport,
return NS_OK; return NS_OK;
} }
SetReadyState(ReadyState::OPEN); SetReadyState(OPEN);
if (IsReadyToNotifyData()) { if (IsReadyToNotifyData()) {
return CreateInputStreamPump(); return CreateInputStreamPump();
@ -461,7 +425,7 @@ PresentationTCPSessionTransport::OnTransportStatus(nsITransport* aTransport,
// nsIInputStreamCallback // nsIInputStreamCallback
NS_IMETHODIMP NS_IMETHODIMP
PresentationTCPSessionTransport::OnInputStreamReady(nsIAsyncInputStream* aStream) PresentationSessionTransport::OnInputStreamReady(nsIAsyncInputStream* aStream)
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
@ -469,9 +433,9 @@ PresentationTCPSessionTransport::OnInputStreamReady(nsIAsyncInputStream* aStream
uint64_t dummy; uint64_t dummy;
nsresult rv = aStream->Available(&dummy); nsresult rv = aStream->Available(&dummy);
if (NS_WARN_IF(NS_FAILED(rv))) { if (NS_WARN_IF(NS_FAILED(rv))) {
if (mReadyState != ReadyState::CLOSED) { if (mReadyState != CLOSED) {
mCloseStatus = NS_ERROR_CONNECTION_REFUSED; mCloseStatus = NS_ERROR_CONNECTION_REFUSED;
SetReadyState(ReadyState::CLOSED); SetReadyState(CLOSED);
} }
} }
@ -480,17 +444,17 @@ PresentationTCPSessionTransport::OnInputStreamReady(nsIAsyncInputStream* aStream
// nsIRequestObserver // nsIRequestObserver
NS_IMETHODIMP NS_IMETHODIMP
PresentationTCPSessionTransport::OnStartRequest(nsIRequest* aRequest, PresentationSessionTransport::OnStartRequest(nsIRequest* aRequest,
nsISupports* aContext) nsISupports* aContext)
{ {
// Do nothing. // Do nothing.
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
PresentationTCPSessionTransport::OnStopRequest(nsIRequest* aRequest, PresentationSessionTransport::OnStopRequest(nsIRequest* aRequest,
nsISupports* aContext, nsISupports* aContext,
nsresult aStatusCode) nsresult aStatusCode)
{ {
PRES_DEBUG("%s:aStatusCode[%x]\n", __func__, 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. // We call this even if there is no error.
if (mReadyState != ReadyState::CLOSED) { if (mReadyState != CLOSED) {
mCloseStatus = aStatusCode; mCloseStatus = aStatusCode;
SetReadyState(ReadyState::CLOSED); SetReadyState(CLOSED);
} }
return NS_OK; return NS_OK;
} }
// nsIStreamListener // nsIStreamListener
NS_IMETHODIMP NS_IMETHODIMP
PresentationTCPSessionTransport::OnDataAvailable(nsIRequest* aRequest, PresentationSessionTransport::OnDataAvailable(nsIRequest* aRequest,
nsISupports* aContext, nsISupports* aContext,
nsIInputStream* aStream, nsIInputStream* aStream,
uint64_t aOffset, uint64_t aOffset,
uint32_t aCount) uint32_t aCount)
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());

Просмотреть файл

@ -11,7 +11,6 @@
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsIAsyncInputStream.h" #include "nsIAsyncInputStream.h"
#include "nsIPresentationSessionTransport.h" #include "nsIPresentationSessionTransport.h"
#include "nsIPresentationSessionTransportBuilder.h"
#include "nsIStreamListener.h" #include "nsIStreamListener.h"
#include "nsISupportsImpl.h" #include "nsISupportsImpl.h"
#include "nsITransport.h" #include "nsITransport.h"
@ -39,31 +38,28 @@ namespace dom {
* of Presentation API (without SSL) and should be migrated to DataChannel with * of Presentation API (without SSL) and should be migrated to DataChannel with
* full support soon. * full support soon.
*/ */
class PresentationTCPSessionTransport final : public nsIPresentationSessionTransport class PresentationSessionTransport final : public nsIPresentationSessionTransport
, public nsIPresentationTCPSessionTransportBuilder , public nsITransportEventSink
, public nsITransportEventSink , public nsIInputStreamCallback
, public nsIInputStreamCallback , public nsIStreamListener
, public nsIStreamListener
{ {
public: public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(PresentationTCPSessionTransport, NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(PresentationSessionTransport,
nsIPresentationSessionTransport) nsIPresentationSessionTransport)
NS_DECL_NSIPRESENTATIONSESSIONTRANSPORT NS_DECL_NSIPRESENTATIONSESSIONTRANSPORT
NS_DECL_NSIPRESENTATIONSESSIONTRANSPORTBUILDER
NS_DECL_NSIPRESENTATIONTCPSESSIONTRANSPORTBUILDER
NS_DECL_NSITRANSPORTEVENTSINK NS_DECL_NSITRANSPORTEVENTSINK
NS_DECL_NSIINPUTSTREAMCALLBACK NS_DECL_NSIINPUTSTREAMCALLBACK
NS_DECL_NSIREQUESTOBSERVER NS_DECL_NSIREQUESTOBSERVER
NS_DECL_NSISTREAMLISTENER NS_DECL_NSISTREAMLISTENER
PresentationTCPSessionTransport(); PresentationSessionTransport();
void NotifyCopyComplete(nsresult aStatus); void NotifyCopyComplete(nsresult aStatus);
private: private:
~PresentationTCPSessionTransport(); ~PresentationSessionTransport();
nsresult CreateStream(); nsresult CreateStream();
@ -71,7 +67,7 @@ private:
void EnsureCopying(); void EnsureCopying();
enum class ReadyState { enum ReadyState {
CONNECTING, CONNECTING,
OPEN, OPEN,
CLOSING, CLOSING,
@ -82,7 +78,7 @@ private:
bool IsReadyToNotifyData() bool IsReadyToNotifyData()
{ {
return mDataNotificationEnabled && mReadyState == ReadyState::OPEN; return mDataNotificationEnabled && mReadyState == OPEN;
} }
ReadyState mReadyState; ReadyState mReadyState;
@ -90,8 +86,6 @@ private:
nsresult mCloseStatus; nsresult mCloseStatus;
bool mDataNotificationEnabled; bool mDataNotificationEnabled;
uint8_t mType = 0;
// Raw socket streams // Raw socket streams
nsCOMPtr<nsISocketTransport> mTransport; nsCOMPtr<nsISocketTransport> mTransport;
nsCOMPtr<nsIInputStream> mSocketInputStream; nsCOMPtr<nsIInputStream> mSocketInputStream;
@ -106,7 +100,6 @@ private:
nsCOMPtr<nsIAsyncStreamCopier> mMultiplexStreamCopier; nsCOMPtr<nsIAsyncStreamCopier> mMultiplexStreamCopier;
nsCOMPtr<nsIPresentationSessionTransportCallback> mCallback; nsCOMPtr<nsIPresentationSessionTransportCallback> mCallback;
nsCOMPtr<nsIPresentationSessionTransportBuilderListener> mListener;
}; };
} // namespace dom } // namespace dom

Просмотреть файл

@ -15,7 +15,6 @@ XPIDL_SOURCES += [
'nsIPresentationService.idl', 'nsIPresentationService.idl',
'nsIPresentationSessionRequest.idl', 'nsIPresentationSessionRequest.idl',
'nsIPresentationSessionTransport.idl', 'nsIPresentationSessionTransport.idl',
'nsIPresentationSessionTransportBuilder.idl',
'nsITCPPresentationServer.idl', 'nsITCPPresentationServer.idl',
] ]

Просмотреть файл

@ -6,10 +6,12 @@
interface nsIInputStream; interface nsIInputStream;
interface nsINetAddr; interface nsINetAddr;
interface nsIPresentationChannelDescription;
interface nsISocketTransport;
%{C++ %{C++
#define PRESENTATION_TCP_SESSION_TRANSPORT_CONTRACTID \ #define PRESENTATION_SESSION_TRANSPORT_CONTRACTID \
"@mozilla.org/presentation/presentationtcpsessiontransport;1" "@mozilla.org/presentation/presentationsessiontransport;1"
%} %}
/* /*
@ -26,19 +28,32 @@ interface nsIPresentationSessionTransportCallback : nsISupports
/* /*
* App-to-App transport channel for the presentation session. * 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 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; 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 * Enable the notification for incoming data. |notifyData| of
* |nsIPresentationSessionTransportCallback| can start getting invoked. * |nsIPresentationSessionTransportCallback| can start getting invoked.
* Should set callback before |enableDataNotification| is called.
*/ */
void enableDataNotification(); 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', 'PresentationRequest.h',
'PresentationService.h', 'PresentationService.h',
'PresentationSessionInfo.h', 'PresentationSessionInfo.h',
'PresentationTCPSessionTransport.h', 'PresentationSessionTransport.h',
] ]
UNIFIED_SOURCES += [ UNIFIED_SOURCES += [
@ -39,7 +39,7 @@ UNIFIED_SOURCES += [
'PresentationService.cpp', 'PresentationService.cpp',
'PresentationSessionInfo.cpp', 'PresentationSessionInfo.cpp',
'PresentationSessionRequest.cpp', 'PresentationSessionRequest.cpp',
'PresentationTCPSessionTransport.cpp', 'PresentationSessionTransport.cpp',
] ]
EXTRA_COMPONENTS += [ EXTRA_COMPONENTS += [

Просмотреть файл

@ -198,7 +198,6 @@ const mockedDevicePrompt = {
const mockedSessionTransport = { const mockedSessionTransport = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationSessionTransport, QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationSessionTransport,
Ci.nsIPresentationTCPSessionTransportBuilder,
Ci.nsIFactory]), Ci.nsIFactory]),
createInstance: function(aOuter, aIID) { createInstance: function(aOuter, aIID) {
if (aOuter) { if (aOuter) {
@ -215,19 +214,13 @@ const mockedSessionTransport = {
get selfAddress() { get selfAddress() {
return this._selfAddress; return this._selfAddress;
}, },
buildTCPSenderTransport: function(transport, listener) { initWithSocketTransport: function(transport, callback) {
sendAsyncMessage('data-transport-initialized'); sendAsyncMessage('data-transport-initialized');
this._listener = listener; this._callback = callback;
this._type = Ci.nsIPresentationSessionTransportBuilder.TYPE_SENDER;
this._listener.onSessionTransport(this);
this._listener = null;
this.simulateTransportReady(); this.simulateTransportReady();
}, },
buildTCPReceiverTransport: function(description, listener) { initWithChannelDescription: function(description, callback) {
this._listener = listener; this._callback = callback;
this._type = Ci.nsIPresentationSessionTransportBuilder.TYPE_RECEIVER;
var addresses = description.QueryInterface(Ci.nsIPresentationChannelDescription).tcpAddress; var addresses = description.QueryInterface(Ci.nsIPresentationChannelDescription).tcpAddress;
this._selfAddress = { this._selfAddress = {
@ -236,9 +229,6 @@ const mockedSessionTransport = {
addresses.queryElementAt(0, Ci.nsISupportsCString).data : "", addresses.queryElementAt(0, Ci.nsISupportsCString).data : "",
port: description.QueryInterface(Ci.nsIPresentationChannelDescription).tcpPort, port: description.QueryInterface(Ci.nsIPresentationChannelDescription).tcpPort,
}; };
this._listener.onSessionTransport(this);
this._listener = null;
}, },
enableDataNotification: function() { enableDataNotification: function() {
sendAsyncMessage('data-transport-notification-enabled'); 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", originalFactoryData.push(registerMockedFactory("@mozilla.org/network/server-socket;1",
uuidGenerator.generateUUID(), uuidGenerator.generateUUID(),
mockedServerSocket)); mockedServerSocket));
originalFactoryData.push(registerMockedFactory("@mozilla.org/presentation/presentationtcpsessiontransport;1", originalFactoryData.push(registerMockedFactory("@mozilla.org/presentation/presentationsessiontransport;1",
uuidGenerator.generateUUID(), uuidGenerator.generateUUID(),
mockedSessionTransport)); mockedSessionTransport));
originalFactoryData.push(registerMockedFactory("@mozilla.org/network/manager;1", originalFactoryData.push(registerMockedFactory("@mozilla.org/network/manager;1",

Просмотреть файл

@ -16,9 +16,6 @@ var testServer = null;
var clientTransport = null; var clientTransport = null;
var serverTransport = null; var serverTransport = null;
var clientBuilder = null;
var serverBuilder = null;
const clientMessage = "Client Message"; const clientMessage = "Client Message";
const serverMessage = "Server 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() { function TestServer() {
this.serverSocket = ServerSocket(-1, true, -1); this.serverSocket = ServerSocket(-1, true, -1);
this.serverSocket.asyncListen(this) this.serverSocket.asyncListen(this)
@ -122,9 +92,10 @@ function TestServer() {
TestServer.prototype = { TestServer.prototype = {
onSocketAccepted: function(aSocket, aTransport) { onSocketAccepted: function(aSocket, aTransport) {
print("Test server gets a client connection."); print("Test server gets a client connection.");
serverBuilder = Cc["@mozilla.org/presentation/presentationtcpsessiontransport;1"] serverTransport = Cc["@mozilla.org/presentation/presentationsessiontransport;1"]
.createInstance(Ci.nsIPresentationTCPSessionTransportBuilder); .createInstance(Ci.nsIPresentationSessionTransport);
serverBuilder.buildTCPSenderTransport(aTransport, serverListener); serverTransport.initWithSocketTransport(aTransport, serverCallback);
serverTransport.enableDataNotification();
}, },
onStopListening: function(aSocket) { onStopListening: function(aSocket) {
print("Test server stops listening."); print("Test server stops listening.");
@ -140,9 +111,9 @@ TestServer.prototype = {
// Set up the transport connection and ensure |notifyTransportReady| triggered // Set up the transport connection and ensure |notifyTransportReady| triggered
// at both sides. // at both sides.
function setup() { function setup() {
clientBuilder = Cc["@mozilla.org/presentation/presentationtcpsessiontransport;1"] clientTransport = Cc["@mozilla.org/presentation/presentationsessiontransport;1"]
.createInstance(Ci.nsIPresentationTCPSessionTransportBuilder); .createInstance(Ci.nsIPresentationSessionTransport);
clientBuilder.buildTCPReceiverTransport(serverChannelDescription, clientListener); clientTransport.initWithChannelDescription(serverChannelDescription, clientCallback);
} }
// Test |selfAddress| attribute of |nsIPresentationSessionTransport|. // Test |selfAddress| attribute of |nsIPresentationSessionTransport|.

Просмотреть файл

@ -263,7 +263,7 @@ static void Shutdown();
#include "GMPService.h" #include "GMPService.h"
#include "mozilla/dom/PresentationDeviceManager.h" #include "mozilla/dom/PresentationDeviceManager.h"
#include "mozilla/dom/PresentationTCPSessionTransport.h" #include "mozilla/dom/PresentationSessionTransport.h"
#include "mozilla/TextInputProcessor.h" #include "mozilla/TextInputProcessor.h"
@ -298,7 +298,7 @@ using mozilla::dom::NotificationTelemetryService;
#define PRESENTATION_DEVICE_MANAGER_CID \ #define PRESENTATION_DEVICE_MANAGER_CID \
{ 0xe1e79dec, 0x4085, 0x4994, { 0xac, 0x5b, 0x74, 0x4b, 0x01, 0x66, 0x97, 0xe6 } } { 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 } } { 0xc9d023f4, 0x6228, 0x4c07, { 0x8b, 0x1d, 0x9c, 0x19, 0x57, 0x3f, 0xaa, 0x27 } }
already_AddRefed<nsIPresentationService> NS_CreatePresentationService(); already_AddRefed<nsIPresentationService> NS_CreatePresentationService();
@ -405,7 +405,7 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(FakeInputPortService,
NS_GENERIC_FACTORY_CONSTRUCTOR(InputPortData) NS_GENERIC_FACTORY_CONSTRUCTOR(InputPortData)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIPresentationService, NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIPresentationService,
NS_CreatePresentationService) NS_CreatePresentationService)
NS_GENERIC_FACTORY_CONSTRUCTOR(PresentationTCPSessionTransport) NS_GENERIC_FACTORY_CONSTRUCTOR(PresentationSessionTransport)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(NotificationTelemetryService, Init) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(NotificationTelemetryService, Init)
#ifndef MOZ_SIMPLEPUSH #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_SERVICE_CID);
NS_DEFINE_NAMED_CID(PRESENTATION_DEVICE_MANAGER_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); 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 }, { &kTV_PROGRAM_DATA_CID, false, nullptr, TVProgramDataConstructor },
{ &kPRESENTATION_SERVICE_CID, false, nullptr, nsIPresentationServiceConstructor }, { &kPRESENTATION_SERVICE_CID, false, nullptr, nsIPresentationServiceConstructor },
{ &kPRESENTATION_DEVICE_MANAGER_CID, false, nullptr, PresentationDeviceManagerConstructor }, { &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 }, { &kTEXT_INPUT_PROCESSOR_CID, false, nullptr, TextInputProcessorConstructor },
{ &kFAKE_INPUTPORT_SERVICE_CID, false, nullptr, FakeInputPortServiceConstructor }, { &kFAKE_INPUTPORT_SERVICE_CID, false, nullptr, FakeInputPortServiceConstructor },
{ &kINPUTPORT_DATA_CID, false, nullptr, InputPortDataConstructor }, { &kINPUTPORT_DATA_CID, false, nullptr, InputPortDataConstructor },
@ -1340,7 +1340,7 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
{ NS_VOICEMAIL_SERVICE_CONTRACTID, &kNS_VOICEMAIL_SERVICE_CID }, { NS_VOICEMAIL_SERVICE_CONTRACTID, &kNS_VOICEMAIL_SERVICE_CID },
{ PRESENTATION_SERVICE_CONTRACTID, &kPRESENTATION_SERVICE_CID }, { PRESENTATION_SERVICE_CONTRACTID, &kPRESENTATION_SERVICE_CID },
{ PRESENTATION_DEVICE_MANAGER_CONTRACTID, &kPRESENTATION_DEVICE_MANAGER_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 }, { "@mozilla.org/text-input-processor;1", &kTEXT_INPUT_PROCESSOR_CID },
{ FAKE_INPUTPORT_SERVICE_CONTRACTID, &kFAKE_INPUTPORT_SERVICE_CID }, { FAKE_INPUTPORT_SERVICE_CONTRACTID, &kFAKE_INPUTPORT_SERVICE_CID },
{ INPUTPORT_DATA_CONTRACTID, &kINPUTPORT_DATA_CID }, { INPUTPORT_DATA_CONTRACTID, &kINPUTPORT_DATA_CID },