Bug 1155063 - Part 4: CallStateChanged accepts an array (ipc). r=hsinyi

This commit is contained in:
Szu-Yu Chen [:aknow] 2015-04-24 18:10:37 +08:00
parent 2df4e432d8
commit 11d305c274
5 changed files with 22 additions and 12 deletions

View File

@ -127,7 +127,7 @@ sync protocol PTelephony {
child:
NotifyCallError(uint32_t aClientId, int32_t aCallIndex, nsString aError);
NotifyCallStateChanged(nsTelephonyCallInfo aInfo);
NotifyCallStateChanged(nsTelephonyCallInfo[] aAllInfo);
NotifyCdmaCallWaiting(uint32_t aClientId, IPCCdmaWaitingCallData aData);

View File

@ -58,15 +58,20 @@ TelephonyChild::RecvNotifyCallError(const uint32_t& aClientId,
}
bool
TelephonyChild::RecvNotifyCallStateChanged(nsITelephonyCallInfo* const& aInfo)
TelephonyChild::RecvNotifyCallStateChanged(nsTArray<nsITelephonyCallInfo*>&& aAllInfo)
{
// Use dont_AddRef here because this instances has already been AddRef-ed in
// TelephonyIPCSerializer.h
nsCOMPtr<nsITelephonyCallInfo> info = dont_AddRef(aInfo);
uint32_t length = aAllInfo.Length();
nsTArray<nsCOMPtr<nsITelephonyCallInfo>> results;
for (uint32_t i = 0; i < length; ++i) {
// Use dont_AddRef here because this instance has already been AddRef-ed in
// TelephonyIPCSerializer.h
nsCOMPtr<nsITelephonyCallInfo> info = dont_AddRef(aAllInfo[i]);
results.AppendElement(info);
}
MOZ_ASSERT(mService);
mService->CallStateChanged(aInfo);
mService->CallStateChanged(length, const_cast<nsITelephonyCallInfo**>(aAllInfo.Elements()));
return true;
}

View File

@ -38,7 +38,7 @@ protected:
const nsString& aError) override;
virtual bool
RecvNotifyCallStateChanged(nsITelephonyCallInfo* const& aInfo) override;
RecvNotifyCallStateChanged(nsTArray<nsITelephonyCallInfo*>&& aAllInfo) override;
virtual bool
RecvNotifyCdmaCallWaiting(const uint32_t& aClientId,

View File

@ -367,10 +367,10 @@ TelephonyIPCService::SetSpeakerEnabled(bool aEnabled)
// nsITelephonyListener
NS_IMETHODIMP
TelephonyIPCService::CallStateChanged(nsITelephonyCallInfo* aInfo)
TelephonyIPCService::CallStateChanged(uint32_t aLength, nsITelephonyCallInfo** aAllInfo)
{
for (uint32_t i = 0; i < mListeners.Length(); i++) {
mListeners[i]->CallStateChanged(aInfo);
mListeners[i]->CallStateChanged(aLength, aAllInfo);
}
return NS_OK;
}

View File

@ -273,11 +273,16 @@ TelephonyParent::RecvSetSpeakerEnabled(const bool& aEnabled)
// nsITelephonyListener
NS_IMETHODIMP
TelephonyParent::CallStateChanged(nsITelephonyCallInfo* aInfo)
TelephonyParent::CallStateChanged(uint32_t aLength, nsITelephonyCallInfo** aAllInfo)
{
NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
return SendNotifyCallStateChanged(aInfo) ? NS_OK : NS_ERROR_FAILURE;
nsTArray<nsITelephonyCallInfo*> allInfo;
for (uint32_t i = 0; i < aLength; i++) {
allInfo.AppendElement(aAllInfo[i]);
}
return SendNotifyCallStateChanged(allInfo) ? NS_OK : NS_ERROR_FAILURE;
}
NS_IMETHODIMP
@ -381,7 +386,7 @@ TelephonyRequestParent::SendResponse(const IPCTelephonyResponse& aResponse)
// nsITelephonyListener
NS_IMETHODIMP
TelephonyRequestParent::CallStateChanged(nsITelephonyCallInfo* aInfo)
TelephonyRequestParent::CallStateChanged(uint32_t aLength, nsITelephonyCallInfo** aAllInfo)
{
MOZ_CRASH("Not a TelephonyParent!");
}