Bug 1350055 - fix --disable-webrtc build with new PStunAddrsRequest.ipdl r=jduell

MozReview-Commit-ID: 5oxJtUppHWC

--HG--
extra : rebase_source : 7cfbddb1168711439530b3ead47bd35bec70ab80
This commit is contained in:
Michael Froman 2017-03-23 20:04:41 -05:00
Родитель cbcf9903c7
Коммит 31e4ce10aa
6 изменённых файлов: 47 добавлений и 2 удалений

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

@ -5,8 +5,16 @@
#ifndef mozilla_net_NrIceStunAddrMessageUtils_h #ifndef mozilla_net_NrIceStunAddrMessageUtils_h
#define mozilla_net_NrIceStunAddrMessageUtils_h #define mozilla_net_NrIceStunAddrMessageUtils_h
// forward declare NrIceStunAddr for --disable-webrtc builds where
// the header will not be available.
namespace mozilla {
class NrIceStunAddr;
} // namespace mozilla
#include "ipc/IPCMessageUtils.h" #include "ipc/IPCMessageUtils.h"
#ifdef MOZ_WEBRTC
#include "mtransport/nricestunaddr.h" #include "mtransport/nricestunaddr.h"
#endif
namespace IPC { namespace IPC {
@ -15,17 +23,20 @@ struct ParamTraits<mozilla::NrIceStunAddr>
{ {
static void Write(Message* aMsg, const mozilla::NrIceStunAddr &aParam) static void Write(Message* aMsg, const mozilla::NrIceStunAddr &aParam)
{ {
#ifdef MOZ_WEBRTC
const size_t bufSize = aParam.SerializationBufferSize(); const size_t bufSize = aParam.SerializationBufferSize();
char* buffer = new char[bufSize]; char* buffer = new char[bufSize];
aParam.Serialize(buffer, bufSize); aParam.Serialize(buffer, bufSize);
aMsg->WriteBytes((void*)buffer, bufSize); aMsg->WriteBytes((void*)buffer, bufSize);
delete[] buffer; delete[] buffer;
#endif
} }
static bool Read(const Message* aMsg, static bool Read(const Message* aMsg,
PickleIterator* aIter, PickleIterator* aIter,
mozilla::NrIceStunAddr* aResult) mozilla::NrIceStunAddr* aResult)
{ {
#ifdef MOZ_WEBRTC
const size_t bufSize = aResult->SerializationBufferSize(); const size_t bufSize = aResult->SerializationBufferSize();
char* buffer = new char[bufSize]; char* buffer = new char[bufSize];
bool result = bool result =
@ -38,6 +49,9 @@ struct ParamTraits<mozilla::NrIceStunAddr>
delete[] buffer; delete[] buffer;
return result; return result;
#else
return false;
#endif
} }
}; };

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

@ -5,14 +5,24 @@
#ifndef PStunAddrsParams_h #ifndef PStunAddrsParams_h
#define PStunAddrsParams_h #define PStunAddrsParams_h
#include "mtransport/nricestunaddr.h"
#include "nsTArray.h" #include "nsTArray.h"
#ifdef MOZ_WEBRTC
#include "mtransport/nricestunaddr.h"
#endif
namespace mozilla { namespace mozilla {
namespace net { namespace net {
// Need to define typedef in .h file--can't seem to in ipdl.h file? // Need to define typedef in .h file--can't seem to in ipdl.h file?
#ifdef MOZ_WEBRTC
typedef nsTArray<NrIceStunAddr> NrIceStunAddrArray; typedef nsTArray<NrIceStunAddr> NrIceStunAddrArray;
#else
// a "dummy" typedef for --disabled-webrtc builds when the definition
// for NrIceStunAddr is not available (otherwise we get complaints
// about missing definitions for contructor and destructor)
typedef nsTArray<int> NrIceStunAddrArray;
#endif
} // namespace net } // namespace net
} // namespace mozilla } // namespace mozilla

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

@ -4,7 +4,6 @@
include protocol PNecko; include protocol PNecko;
using class mozilla::NrIceStunAddr from "mtransport/nricestunaddr.h";
using NrIceStunAddrArray from "mozilla/net/PStunAddrsParams.h"; using NrIceStunAddrArray from "mozilla/net/PStunAddrsParams.h";
include "mozilla/net/NrIceStunAddrMessageUtils.h"; include "mozilla/net/NrIceStunAddrMessageUtils.h";

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

@ -23,7 +23,9 @@
#include "mozilla/dom/network/TCPServerSocketChild.h" #include "mozilla/dom/network/TCPServerSocketChild.h"
#include "mozilla/dom/network/UDPSocketChild.h" #include "mozilla/dom/network/UDPSocketChild.h"
#include "mozilla/net/AltDataOutputStreamChild.h" #include "mozilla/net/AltDataOutputStreamChild.h"
#ifdef MOZ_WEBRTC
#include "mozilla/net/StunAddrsRequestChild.h" #include "mozilla/net/StunAddrsRequestChild.h"
#endif
#ifdef NECKO_PROTOCOL_rtsp #ifdef NECKO_PROTOCOL_rtsp
#include "mozilla/net/RtspControllerChild.h" #include "mozilla/net/RtspControllerChild.h"
@ -102,8 +104,10 @@ NeckoChild::AllocPStunAddrsRequestChild()
bool bool
NeckoChild::DeallocPStunAddrsRequestChild(PStunAddrsRequestChild* aActor) NeckoChild::DeallocPStunAddrsRequestChild(PStunAddrsRequestChild* aActor)
{ {
#ifdef MOZ_WEBRTC
StunAddrsRequestChild* p = static_cast<StunAddrsRequestChild*>(aActor); StunAddrsRequestChild* p = static_cast<StunAddrsRequestChild*>(aActor);
p->ReleaseIPDLReference(); p->ReleaseIPDLReference();
#endif
return true; return true;
} }

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

@ -25,7 +25,9 @@
#include "mozilla/net/DNSRequestParent.h" #include "mozilla/net/DNSRequestParent.h"
#include "mozilla/net/ChannelDiverterParent.h" #include "mozilla/net/ChannelDiverterParent.h"
#include "mozilla/net/IPCTransportProvider.h" #include "mozilla/net/IPCTransportProvider.h"
#ifdef MOZ_WEBRTC
#include "mozilla/net/StunAddrsRequestParent.h" #include "mozilla/net/StunAddrsRequestParent.h"
#endif
#include "mozilla/dom/ChromeUtils.h" #include "mozilla/dom/ChromeUtils.h"
#include "mozilla/dom/ContentParent.h" #include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/TabContext.h" #include "mozilla/dom/TabContext.h"
@ -330,16 +332,22 @@ NeckoParent::RecvPHttpChannelConstructor(
PStunAddrsRequestParent* PStunAddrsRequestParent*
NeckoParent::AllocPStunAddrsRequestParent() NeckoParent::AllocPStunAddrsRequestParent()
{ {
#ifdef MOZ_WEBRTC
StunAddrsRequestParent* p = new StunAddrsRequestParent(); StunAddrsRequestParent* p = new StunAddrsRequestParent();
p->AddRef(); p->AddRef();
return p; return p;
#else
return nullptr;
#endif
} }
bool bool
NeckoParent::DeallocPStunAddrsRequestParent(PStunAddrsRequestParent* aActor) NeckoParent::DeallocPStunAddrsRequestParent(PStunAddrsRequestParent* aActor)
{ {
#ifdef MOZ_WEBRTC
StunAddrsRequestParent* p = static_cast<StunAddrsRequestParent*>(aActor); StunAddrsRequestParent* p = static_cast<StunAddrsRequestParent*>(aActor);
p->Release(); p->Release();
#endif
return true; return true;
} }

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

@ -28,6 +28,16 @@ IPDL_SOURCES = [
'PRtspController.ipdl', 'PRtspController.ipdl',
] ]
# needed so --disable-webrtc builds work (yes, a bit messy)
if not CONFIG['MOZ_WEBRTC']:
IPDL_SOURCES += [
'../../media/mtransport/ipc/PStunAddrsRequest.ipdl',
]
EXPORTS.mozilla.net += [
'../../media/mtransport/ipc/NrIceStunAddrMessageUtils.h',
'../../media/mtransport/ipc/PStunAddrsParams.h',
]
include('/ipc/chromium/chromium-config.mozbuild') include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul' FINAL_LIBRARY = 'xul'