Closed
Bug 775359
Opened 13 years ago
Closed 13 years ago
B2G 3G: Keep track of data call state
Categories
(Core :: DOM: Device Interfaces, defect)
Tracking
()
RESOLVED
FIXED
mozilla17
People
(Reporter: philikon, Assigned: philikon)
References
Details
Attachments
(1 file, 1 obsolete file)
10.37 KB,
patch
|
marshall
:
review+
|
Details | Diff | Splinter Review |
While going through the data call code in the RIL worker I noticed some bugs (as in code that could never have worked) as well as some oddities and inefficiencies.
![]() |
Assignee | |
Comment 2•13 years ago
|
||
* readDataCall_v5 was completely broken (did not actually save any of the state)
* RIL[REQUEST_DATA_CALL_LIST] was passing its own `options` along to readDataCall_v6 which is nonsensical. I think the idea was that when we do a REQUEST_SETUP_DATA_CALL request (which in RIL v6 has the same response as REQUEST_DATA_CALL_LIST), we remember the setup parameters and put them on the datacall object. The current code would attach it to *all* data calls, though. Fixed that by doing it properly in _processDataCallList().
* Made datacall message passing from RIL worker to main thread a bit more efficient (just passing the datacall object itself.)
* Fixed a few JS nits.
Attachment #643676 -
Flags: review?(marshall)
![]() |
||
Comment 3•13 years ago
|
||
Comment on attachment 643676 [details] [diff] [review]
v1
Review of attachment 643676 [details] [diff] [review]:
-----------------------------------------------------------------
Nice, this one looked tricky to solve :)
::: dom/system/gonk/ril_worker.js
@@ +1400,5 @@
> requestNetworkInfo: function requestNetworkInfo() {
> if (this._processingNetworkInfo) {
> if (DEBUG) {
> debug("Already requesting network info: " +
> + JSON.stringify(this._pendingNetworkInfo));
Pfffft. Semicolons :)
@@ +2358,5 @@
> this._setDataCallGeckoState(updatedDataCall);
> if (updatedDataCall.state != currentDataCall.state) {
> currentDataCall.status = updatedDataCall.status;
> currentDataCall.active = updatedDataCall.active;
> currentDataCall.state = updatedDataCall.state;
Probably for followup -- Should there be individual checks to see if any of these fields have changed, instead of just checking |state|?
@@ +2368,5 @@
> for each (let newDataCall in datacalls) {
> this.currentDataCalls[newDataCall.cid] = newDataCall;
> this._setDataCallGeckoState(newDataCall);
> + if (newDataCallOptions) {
> + newDataCall.radioTech = newDataCallOptions.radioTech;
Would it be more future-proof to loop through these options?
@@ +3144,4 @@
> this.readSetupDataCall_v5(options);
> this.currentDataCalls[options.cid] = options;
> + options.type = "datacallstatechange";
> + this.sendDOMMessage(options);
It seems that in some of these cases, the cost saved reusing objects would be negated by serializing all the extra properties. Thoughts?
@@ +3152,5 @@
> }
> + // Pass `options` along. That way we retain the APN and other info about
> + // how the data call was set up.
> + this[REQUEST_DATA_CALL_LIST](length, {rilRequestError: ERROR_SUCCESS},
> + options);
The first object here seems unnecessary, you could just set |rilRequestError| on |options|.. See more below.
@@ +3315,5 @@
> RIL[REQUEST_GET_MUTE] = null;
> RIL[REQUEST_QUERY_CLIP] = null;
> RIL[REQUEST_LAST_DATA_CALL_FAIL_CAUSE] = null;
>
> +RIL.readDataCall_v5 = function readDataCall_v5(options) {
More follow ups :) These readDataCall_v5 / v6 functions should be in the top level RIL declaration with the rest of the helpers.
@@ +3380,5 @@
> }
> datacalls[datacall.cid] = datacall;
> }
>
> + this._processDataCallList(datacalls, newDataCallOptions);
Hrm, this looks like the only reference to |newDataCallOptions|. Are you trying to avoid passing along |rilRequestError|?
It isn't clear that |newDataCallOptions| is even necessary, maybe you could pass |options| to |_processDataCallList| instead, and remove the unneeded argument / object allocation in |REQUEST_SETUP_DATA_CALL|?
Attachment #643676 -
Flags: review?(marshall) → review-
![]() |
Assignee | |
Comment 4•13 years ago
|
||
(In reply to Marshall Culpepper [:marshall_law] from comment #3)
> > this._setDataCallGeckoState(updatedDataCall);
> > if (updatedDataCall.state != currentDataCall.state) {
> > currentDataCall.status = updatedDataCall.status;
> > currentDataCall.active = updatedDataCall.active;
> > currentDataCall.state = updatedDataCall.state;
>
> Probably for followup -- Should there be individual checks to see if any of
> these fields have changed, instead of just checking |state|?
`state` is computed from `active` and `status` really only comes into play when you set up a datacall. I think.
> > for each (let newDataCall in datacalls) {
> > this.currentDataCalls[newDataCall.cid] = newDataCall;
> > this._setDataCallGeckoState(newDataCall);
> > + if (newDataCallOptions) {
> > + newDataCall.radioTech = newDataCallOptions.radioTech;
>
> Would it be more future-proof to loop through these options?
I don't want to blindly copy *all* attributes, just the ones that were set initially when the datacall was set up.
> > this.readSetupDataCall_v5(options);
> > this.currentDataCalls[options.cid] = options;
> > + options.type = "datacallstatechange";
> > + this.sendDOMMessage(options);
>
> It seems that in some of these cases, the cost saved reusing objects would
> be negated by serializing all the extra properties. Thoughts?
That's quite possible, though not in this case, I think.
I'll address the `newDataCallOptions` simplification as discussed on IRC.
![]() |
Assignee | |
Comment 5•13 years ago
|
||
I, uh, fixed the "glitch".
Attachment #643676 -
Attachment is obsolete: true
Attachment #644051 -
Flags: review?(marshall)
![]() |
||
Comment 6•13 years ago
|
||
Comment on attachment 644051 [details] [diff] [review]
v2
Review of attachment 644051 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good!
Attachment #644051 -
Flags: review?(marshall) → review+
![]() |
Assignee | |
Comment 7•13 years ago
|
||
Target Milestone: --- → mozilla17
![]() |
||
Comment 8•13 years ago
|
||
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•