Bug 870676: Part 2 - Implement IPDL for mozFMRadio. r=khuey

This commit is contained in:
Kyle Huey 2013-08-28 09:45:50 -07:00
parent 2488a88c0b
commit 7de080c3b6
6 changed files with 102 additions and 0 deletions

View File

@ -98,6 +98,7 @@
#include "mozilla/dom/mobilemessage/SmsChild.h"
#include "mozilla/dom/devicestorage/DeviceStorageRequestChild.h"
#include "mozilla/dom/bluetooth/PBluetoothChild.h"
#include "mozilla/dom/PFMRadioChild.h"
#include "mozilla/ipc/InputStreamUtils.h"
#ifdef MOZ_WEBSPEECH
@ -925,6 +926,30 @@ ContentChild::DeallocPBluetoothChild(PBluetoothChild* aActor)
#endif
}
PFMRadioChild*
ContentChild::AllocPFMRadioChild()
{
#ifdef MOZ_B2G_FM
NS_RUNTIMEABORT("No one should be allocating PFMRadioChild actors");
return nullptr;
#else
NS_RUNTIMEABORT("No support for FMRadio on this platform!");
return nullptr;
#endif
}
bool
ContentChild::DeallocPFMRadioChild(PFMRadioChild* aActor)
{
#ifdef MOZ_B2G_FM
delete aActor;
return true;
#else
NS_RUNTIMEABORT("No support for FMRadio on this platform!");
return false;
#endif
}
PSpeechSynthesisChild*
ContentChild::AllocPSpeechSynthesisChild()
{

View File

@ -158,6 +158,9 @@ public:
virtual PBluetoothChild* AllocPBluetoothChild();
virtual bool DeallocPBluetoothChild(PBluetoothChild* aActor);
virtual PFMRadioChild* AllocPFMRadioChild();
virtual bool DeallocPFMRadioChild(PFMRadioChild* aActor);
virtual PSpeechSynthesisChild* AllocPSpeechSynthesisChild();
virtual bool DeallocPSpeechSynthesisChild(PSpeechSynthesisChild* aActor);

View File

@ -32,6 +32,7 @@
#include "mozilla/dom/power/PowerManagerService.h"
#include "mozilla/dom/DOMStorageIPC.h"
#include "mozilla/dom/bluetooth/PBluetoothParent.h"
#include "mozilla/dom/PFMRadioParent.h"
#include "mozilla/dom/devicestorage/DeviceStorageRequestParent.h"
#include "SmsParent.h"
#include "mozilla/Hal.h"
@ -125,6 +126,11 @@ using namespace mozilla::system;
#endif
#include "JavaScriptParent.h"
#ifdef MOZ_B2G_FM
#include "mozilla/dom/FMRadioParent.h"
#endif
#include "Crypto.h"
#ifdef MOZ_WEBSPEECH
@ -2259,6 +2265,32 @@ ContentParent::RecvPBluetoothConstructor(PBluetoothParent* aActor)
#endif
}
PFMRadioParent*
ContentParent::AllocPFMRadioParent()
{
#ifdef MOZ_B2G_FM
if (!AssertAppProcessPermission(this, "fmradio")) {
return nullptr;
}
return new FMRadioParent();
#else
NS_WARNING("No support for FMRadio on this platform!");
return nullptr;
#endif
}
bool
ContentParent::DeallocPFMRadioParent(PFMRadioParent* aActor)
{
#ifdef MOZ_B2G_FM
delete aActor;
return true;
#else
NS_WARNING("No support for FMRadio on this platform!");
return false;
#endif
}
PSpeechSynthesisParent*
ContentParent::AllocPSpeechSynthesisParent()
{

View File

@ -328,6 +328,9 @@ private:
virtual bool DeallocPBluetoothParent(PBluetoothParent* aActor);
virtual bool RecvPBluetoothConstructor(PBluetoothParent* aActor);
virtual PFMRadioParent* AllocPFMRadioParent();
virtual bool DeallocPFMRadioParent(PFMRadioParent* aActor);
virtual PSpeechSynthesisParent* AllocPSpeechSynthesisParent();
virtual bool DeallocPSpeechSynthesisParent(PSpeechSynthesisParent* aActor);
virtual bool RecvPSpeechSynthesisConstructor(PSpeechSynthesisParent* aActor);

View File

@ -33,6 +33,7 @@ LOCAL_INCLUDES += \
-I$(topsrcdir)/hal/sandbox \
-I$(topsrcdir)/dom/mobilemessage/src/ipc \
-I$(topsrcdir)/dom/devicestorage \
-I$(topsrcdir)/dom/fmradio/ipc \
-I$(topsrcdir)/widget/xpwidgets \
-I$(topsrcdir)/dom/bluetooth \
-I$(topsrcdir)/layout/base \

View File

@ -11,6 +11,7 @@ include protocol PCompositor;
include protocol PCrashReporter;
include protocol PExternalHelperApp;
include protocol PDeviceStorageRequest;
include protocol PFMRadio;
include protocol PHal;
include protocol PImageBridge;
include protocol PIndexedDB;
@ -126,6 +127,40 @@ union DeviceStorageParams
DeviceStorageAvailableParams;
};
struct FMRadioRequestEnableParams
{
double frequency;
};
struct FMRadioRequestDisableParams
{
};
struct FMRadioRequestSetFrequencyParams
{
double frequency;
};
struct FMRadioRequestSeekParams
{
bool upward;
};
struct FMRadioRequestCancelSeekParams
{
};
union FMRadioRequestParams
{
FMRadioRequestEnableParams;
FMRadioRequestDisableParams;
FMRadioRequestSetFrequencyParams;
FMRadioRequestSeekParams;
FMRadioRequestCancelSeekParams;
};
union PrefValue {
nsCString;
int32_t;
@ -154,6 +189,7 @@ rpc protocol PContent
manages PCrashReporter;
manages PDeviceStorageRequest;
manages PExternalHelperApp;
manages PFMRadio;
manages PHal;
manages PIndexedDB;
manages PMemoryReportRequest;
@ -319,6 +355,8 @@ parent:
PBluetooth();
PFMRadio();
// Services remoting
async StartVisitedQuery(URIParams uri);