Closed Bug 1155063 Opened 9 years ago Closed 9 years ago

[Telephony] Let nsITelephonyListener.callStateChanged accepts an array

Categories

(Firefox OS Graveyard :: RIL, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(tracking-b2g:backlog, firefox40 fixed)

RESOLVED FIXED
2.2 S11 (1may)
tracking-b2g backlog
Tracking Status
firefox40 --- fixed

People

(Reporter: aknow, Assigned: aknow)

References

Details

Attachments

(5 files, 1 obsolete file)

To reduce the number of message passing between DOM and telephonyService, we could let nsITelephonyListener.callStateChanged accepts an array instead of a single call.

Taking switch active and holding call as an example, both the states of two calls are changed. By the interface, only one callStateChanged is needed.
Attachment #8593201 - Flags: review?(htsai)
Blocks: 1155072
[Tracking Requested - why for this release]:
Attachment #8593197 - Flags: review?(htsai) → review+
Attachment #8593198 - Flags: review?(htsai) → review+
Attachment #8593199 - Flags: review?(btian)
Ben,

Please help review the patch. We want nsITelephonyListener.callStateChanged to accept an array of information to reduce the number of function call and message passing.
Comment on attachment 8593199 [details] [diff] [review]
Part 3: CallStateChanged accepts an array (bluetooth dom)

Review of attachment 8593199 [details] [diff] [review]:
-----------------------------------------------------------------

Please see my question below.

::: dom/bluetooth/bluetooth1/BluetoothRilListener.cpp
@@ +217,5 @@
>  }
>  
>  NS_IMETHODIMP
> +TelephonyListener::CallStateChanged(uint32_t aLength,
> +                                    nsITelephonyCallInfo** aAllInfo)

Can we wrap them into an nsTArray instead of two arguments?
Attachment #8593199 - Flags: review?(btian)
(In reply to Ben Tian [:btian] from comment #8)
> Comment on attachment 8593199 [details] [diff] [review]
> Part 3: CallStateChanged accepts an array (bluetooth dom)
> 
> Review of attachment 8593199 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Please see my question below.
> 
> ::: dom/bluetooth/bluetooth1/BluetoothRilListener.cpp
> @@ +217,5 @@
> >  }
> >  
> >  NS_IMETHODIMP
> > +TelephonyListener::CallStateChanged(uint32_t aLength,
> > +                                    nsITelephonyCallInfo** aAllInfo)
> 
> Can we wrap them into an nsTArray instead of two arguments?

I don't know how to do it. If it is possible, please tell me and I can fix it.

https://developer.mozilla.org/en-US/docs/Mozilla/XPIDL

"""
The array property turns the parameter into an array; the parameter must also have a corresponding size_is property whose argument is the parameter that has the size of the array. In native code, the type gains another pointer indirection, and JavaScript arrays are used in script code. 
"""

Since it is the IDL, the underlying implementation might be a javascript array.
Flags: needinfo?(btian)
Comment on attachment 8593200 [details] [diff] [review]
Part 4: CallStateChanged accepts an array (ipc)

Review of attachment 8593200 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/telephony/ipc/TelephonyChild.cpp
@@ +62,5 @@
>  {
> +  uint32_t length = aAllInfo.Length();
> +  nsTArray<nsCOMPtr<nsITelephonyCallInfo>> results;
> +  for (uint32_t i = 0; i < length; ++i) {
> +    // Use dont_AddRef here because this instances has already been AddRef-ed in

nit: s/instances/instance/
Attachment #8593200 - Flags: review?(htsai) → review+
Comment on attachment 8593201 [details] [diff] [review]
Part 5: CallStateChanged accepts an array (ril)

Review of attachment 8593201 [details] [diff] [review]:
-----------------------------------------------------------------

I'd rather expect a larger scope covered by this part. For instance, with this patch, we will still call .callStateChanged twice if one of conference participants is released that one event is for the disconnected call, while the other is for the remaining call whose .isConference flag changes. 

Can we instead have only one .callStateChanged in this case? Any problems or issues we will encounter like conference event sequence?
Attachment #8593201 - Flags: review?(htsai)
(In reply to Hsin-Yi Tsai [:hsinyi] from comment #11)
> Comment on attachment 8593201 [details] [diff] [review]
> Part 5: CallStateChanged accepts an array (ril)
> 
> Review of attachment 8593201 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> I'd rather expect a larger scope covered by this part. For instance, with
> this patch, we will still call .callStateChanged twice if one of conference
> participants is released that one event is for the disconnected call, while
> the other is for the remaining call whose .isConference flag changes. 
> 
> Can we instead have only one .callStateChanged in this case? Any problems or
> issues we will encounter like conference event sequence?

I have to wait for Bug 1147736.  Currently, It may fire notifyError instead of callStateChanged for the first call.
(In reply to Szu-Yu Chen [:aknow] from comment #9)
> > Can we wrap them into an nsTArray instead of two arguments?
> 
> I don't know how to do it. If it is possible, please tell me and I can fix
> it.
> 
> https://developer.mozilla.org/en-US/docs/Mozilla/XPIDL
> 
> """
> The array property turns the parameter into an array; the parameter must
> also have a corresponding size_is property whose argument is the parameter
> that has the size of the array. In native code, the type gains another
> pointer indirection, and JavaScript arrays are used in script code. 
> """
> 
> Since it is the IDL, the underlying implementation might be a javascript
> array.

Got it. Didn't notice it's and IDL method. The size argument seems required.
Flags: needinfo?(btian)
Attachment #8593199 - Flags: review+
Comment on attachment 8593201 [details] [diff] [review]
Part 5: CallStateChanged accepts an array (ril)

Review of attachment 8593201 [details] [diff] [review]:
-----------------------------------------------------------------

Replying to comment 12, I see. It's okay to let this bug in, and we know we will eventually have to address comment 11 in (or prior to) bug 1155072. Let me know if I misunderstand your plans. Thank you!
Attachment #8593201 - Flags: review+
(In reply to Hsin-Yi Tsai [:hsinyi] from comment #14)
> Comment on attachment 8593201 [details] [diff] [review]
> Part 5: CallStateChanged accepts an array (ril)
> 
> Review of attachment 8593201 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Replying to comment 12, I see. It's okay to let this bug in, and we know we
> will eventually have to address comment 11 in (or prior to) bug 1155072. Let
> me know if I misunderstand your plans. Thank you!

I am working on a version that doesn't have to depend on Bug 1147736.
- send the message immediately if it is 'notifyError'
- accumulate it with others if it is 'callStateChanged'
Attachment #8593201 - Attachment is obsolete: true
Attachment #8595767 - Flags: review?(htsai)
Comment on attachment 8595767 [details] [diff] [review]
Part 5#2: CallStateChanged accepts an array (ril)

Review of attachment 8595767 [details] [diff] [review]:
-----------------------------------------------------------------

It looks good to me, thank you!

::: dom/telephony/gonk/TelephonyService.js
@@ +1464,4 @@
>        }
>      }
>  
> +    // Unique the list.

grammar nit: Store unique values in the list
Attachment #8595767 - Flags: review?(htsai) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: