Bug 1095362 - Part 6: Internal architecture changes (IPC). r=aknow

This commit is contained in:
Ben Hsu 2015-01-09 01:42:00 -05:00
parent b6f1deffa5
commit 75182d3ea1
4 changed files with 64 additions and 99 deletions

View File

@ -37,11 +37,32 @@ struct CancelUSSDRequest
uint32_t clientId;
};
struct ConferenceCallRequest
{
uint32_t clientId;
};
struct SeparateCallRequest
{
uint32_t clientId;
uint32_t callIndex;
};
struct HangUpConferenceRequest
{
uint32_t clientId;
};
struct HoldConferenceRequest
{
uint32_t clientId;
};
struct ResumeConferenceRequest
{
uint32_t clientId;
};
struct AnswerCallRequest
{
uint32_t clientId;
@ -86,7 +107,11 @@ union IPCTelephonyRequest
DialRequest;
SendUSSDRequest;
CancelUSSDRequest;
ConferenceCallRequest;
SeparateCallRequest;
HangUpConferenceRequest;
HoldConferenceRequest;
ResumeConferenceRequest;
AnswerCallRequest;
HangUpCallRequest;
RejectCallRequest;
@ -128,14 +153,6 @@ parent:
UnregisterListener();
ConferenceCall(uint32_t aClientId);
SeparateCall(uint32_t aClientId, uint32_t aCallIndex);
HoldConference(uint32_t aClientId);
ResumeConference(uint32_t aClientId);
StartTone(uint32_t aClientId, nsString aTone);
StopTone(uint32_t aClientId);

View File

@ -141,8 +141,8 @@ TelephonyIPCService::UnregisterListener(nsITelephonyListener *aListener)
nsresult
TelephonyIPCService::SendRequest(nsITelephonyListener *aListener,
nsITelephonyCallback *aCallback,
const IPCTelephonyRequest& aRequest)
nsITelephonyCallback *aCallback,
const IPCTelephonyRequest& aRequest)
{
if (!mPTelephonyChild) {
NS_WARNING("TelephonyService used after shutdown has begun!");
@ -233,27 +233,18 @@ TelephonyIPCService::ResumeCall(uint32_t aClientId, uint32_t aCallIndex,
}
NS_IMETHODIMP
TelephonyIPCService::ConferenceCall(uint32_t aClientId)
TelephonyIPCService::ConferenceCall(uint32_t aClientId,
nsITelephonyCallback *aCallback)
{
if (!mPTelephonyChild) {
NS_WARNING("TelephonyService used after shutdown has begun!");
return NS_ERROR_FAILURE;
}
mPTelephonyChild->SendConferenceCall(aClientId);
return NS_OK;
return SendRequest(nullptr, aCallback, ConferenceCallRequest(aClientId));
}
NS_IMETHODIMP
TelephonyIPCService::SeparateCall(uint32_t aClientId, uint32_t aCallIndex)
TelephonyIPCService::SeparateCall(uint32_t aClientId, uint32_t aCallIndex,
nsITelephonyCallback *aCallback)
{
if (!mPTelephonyChild) {
NS_WARNING("TelephonyService used after shutdown has begun!");
return NS_ERROR_FAILURE;
}
mPTelephonyChild->SendSeparateCall(aClientId, aCallIndex);
return NS_OK;
return SendRequest(nullptr, aCallback, SeparateCallRequest(aClientId,
aCallIndex));
}
NS_IMETHODIMP
@ -264,27 +255,17 @@ TelephonyIPCService::HangUpConference(uint32_t aClientId,
}
NS_IMETHODIMP
TelephonyIPCService::HoldConference(uint32_t aClientId)
TelephonyIPCService::HoldConference(uint32_t aClientId,
nsITelephonyCallback *aCallback)
{
if (!mPTelephonyChild) {
NS_WARNING("TelephonyService used after shutdown has begun!");
return NS_ERROR_FAILURE;
}
mPTelephonyChild->SendHoldConference(aClientId);
return NS_OK;
return SendRequest(nullptr, aCallback, HoldConferenceRequest(aClientId));
}
NS_IMETHODIMP
TelephonyIPCService::ResumeConference(uint32_t aClientId)
TelephonyIPCService::ResumeConference(uint32_t aClientId,
nsITelephonyCallback *aCallback)
{
if (!mPTelephonyChild) {
NS_WARNING("TelephonyService used after shutdown has begun!");
return NS_ERROR_FAILURE;
}
mPTelephonyChild->SendResumeConference(aClientId);
return NS_OK;
return SendRequest(nullptr, aCallback, ResumeConferenceRequest(aClientId));
}
NS_IMETHODIMP

View File

@ -72,12 +72,36 @@ TelephonyParent::RecvPTelephonyRequestConstructor(PTelephonyRequestParent* aActo
return true;
}
case IPCTelephonyRequest::TConferenceCallRequest: {
const ConferenceCallRequest& request = aRequest.get_ConferenceCallRequest();
service->ConferenceCall(request.clientId(), actor);
return true;
}
case IPCTelephonyRequest::TSeparateCallRequest: {
const SeparateCallRequest& request = aRequest.get_SeparateCallRequest();
service->SeparateCall(request.clientId(), request.callIndex(), actor);
return true;
}
case IPCTelephonyRequest::THangUpConferenceRequest: {
const HangUpConferenceRequest& request = aRequest.get_HangUpConferenceRequest();
service->HangUpConference(request.clientId(), actor);
return true;
}
case IPCTelephonyRequest::THoldConferenceRequest: {
const HoldConferenceRequest& request = aRequest.get_HoldConferenceRequest();
service->HoldConference(request.clientId(), actor);
return true;
}
case IPCTelephonyRequest::TResumeConferenceRequest: {
const ResumeConferenceRequest& request = aRequest.get_ResumeConferenceRequest();
service->ResumeConference(request.clientId(), actor);
return true;
}
case IPCTelephonyRequest::TAnswerCallRequest: {
const AnswerCallRequest& request = aRequest.get_AnswerCallRequest();
service->AnswerCall(request.clientId(), request.callIndex(), actor);
@ -176,51 +200,6 @@ TelephonyParent::RecvUnregisterListener()
return true;
}
bool
TelephonyParent::RecvConferenceCall(const uint32_t& aClientId)
{
nsCOMPtr<nsITelephonyService> service =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(service, true);
service->ConferenceCall(aClientId);
return true;
}
bool
TelephonyParent::RecvSeparateCall(const uint32_t& aClientId,
const uint32_t& aCallIndex)
{
nsCOMPtr<nsITelephonyService> service =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(service, true);
service->SeparateCall(aClientId, aCallIndex);
return true;
}
bool
TelephonyParent::RecvHoldConference(const uint32_t& aClientId)
{
nsCOMPtr<nsITelephonyService> service =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(service, true);
service->HoldConference(aClientId);
return true;
}
bool
TelephonyParent::RecvResumeConference(const uint32_t& aClientId)
{
nsCOMPtr<nsITelephonyService> service =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(service, true);
service->ResumeConference(aClientId);
return true;
}
bool
TelephonyParent::RecvStartTone(const uint32_t& aClientId, const nsString& aTone)
{

View File

@ -46,18 +46,6 @@ protected:
virtual bool
RecvUnregisterListener() MOZ_OVERRIDE;
virtual bool
RecvConferenceCall(const uint32_t& aClientId) MOZ_OVERRIDE;
virtual bool
RecvSeparateCall(const uint32_t& aClientId, const uint32_t& callIndex) MOZ_OVERRIDE;
virtual bool
RecvHoldConference(const uint32_t& aClientId) MOZ_OVERRIDE;
virtual bool
RecvResumeConference(const uint32_t& aClientId) MOZ_OVERRIDE;
virtual bool
RecvStartTone(const uint32_t& aClientId, const nsString& aTone) MOZ_OVERRIDE;