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
#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"
#ifdef MOZ_WEBRTC
#include "mtransport/nricestunaddr.h"
#endif
namespace IPC {
@ -15,17 +23,20 @@ struct ParamTraits<mozilla::NrIceStunAddr>
{
static void Write(Message* aMsg, const mozilla::NrIceStunAddr &aParam)
{
#ifdef MOZ_WEBRTC
const size_t bufSize = aParam.SerializationBufferSize();
char* buffer = new char[bufSize];
aParam.Serialize(buffer, bufSize);
aMsg->WriteBytes((void*)buffer, bufSize);
delete[] buffer;
#endif
}
static bool Read(const Message* aMsg,
PickleIterator* aIter,
mozilla::NrIceStunAddr* aResult)
{
#ifdef MOZ_WEBRTC
const size_t bufSize = aResult->SerializationBufferSize();
char* buffer = new char[bufSize];
bool result =
@ -38,6 +49,9 @@ struct ParamTraits<mozilla::NrIceStunAddr>
delete[] buffer;
return result;
#else
return false;
#endif
}
};

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

@ -5,14 +5,24 @@
#ifndef PStunAddrsParams_h
#define PStunAddrsParams_h
#include "mtransport/nricestunaddr.h"
#include "nsTArray.h"
#ifdef MOZ_WEBRTC
#include "mtransport/nricestunaddr.h"
#endif
namespace mozilla {
namespace net {
// Need to define typedef in .h file--can't seem to in ipdl.h file?
#ifdef MOZ_WEBRTC
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 mozilla

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

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

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

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

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

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

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

@ -28,6 +28,16 @@ IPDL_SOURCES = [
'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')
FINAL_LIBRARY = 'xul'