Closed
Bug 903403
Opened 11 years ago
Closed 11 years ago
[sms][mms] Make getSegmentInfoForText() Asynchronous to Improve Typing Performance
Categories
(Core :: DOM: Device Interfaces, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox26 | --- | fixed |
People
(Reporter: airpingu, Assigned: airpingu)
References
Details
(Keywords: dev-doc-needed, perf, Whiteboard: [u=commsapps-user c=messaging p=3 s=v1.2-features-sprint-3])
Attachments
(1 file, 2 obsolete files)
(deleted),
patch
|
vicamo
:
review+
|
Details | Diff | Splinter Review |
+++ This bug was initially created as a clone of Bug #902497 +++
We're planing to make mozMobileMessage.getSegmentInfoForText(text) to be an asynchronous call. The synchronous IPC would heavily block the content process when users are typing an SMS message very fast.
To do so, we need to change the original API:
nsIDOMMozSmsSegmentInfo getSegmentInfoForText(in DOMString text);
to be:
nsIDOMDOMRequest getSegmentInfoForText(in DOMString text);
which also needs the Gaia changes at bug 902497. This bug is fired for Gecko only.
Assignee | ||
Comment 1•11 years ago
|
||
Not yet finished the Android bridging and fixed the test cases.
Attachment #788116 -
Flags: feedback?(vyang)
Assignee | ||
Comment 2•11 years ago
|
||
Comment on attachment 788116 [details] [diff] [review]
Patch (WIP)
Hi Mounir,
Could you please take the super-review for the IDL change? Vicamo will review the implementation details. Thanks!
Attachment #788116 -
Flags: superreview?(mounir)
Assignee | ||
Comment 3•11 years ago
|
||
Hi Mounir, it seems you're too busy to take super-reviews recently. Shall I pass this to Jonas or someone else?
Comment 4•11 years ago
|
||
(In reply to Gene Lian [:gene] from comment #0)
> We're planing to make mozMobileMessage.getSegmentInfoForText(text) to be an
> asynchronous call. The synchronous IPC would heavily block the content
> process when users are typing an SMS message very fast.
Even reasonably fast ;)
Updated•11 years ago
|
Attachment #788116 -
Flags: superreview?(mounir) → superreview+
Comment 5•11 years ago
|
||
Comment on attachment 788116 [details] [diff] [review]
Patch (WIP)
Review of attachment 788116 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/mobilemessage/src/MobileMessageManager.cpp
@@ +106,5 @@
> nsCOMPtr<nsISmsService> smsService = do_GetService(SMS_SERVICE_CONTRACTID);
> NS_ENSURE_TRUE(smsService, NS_ERROR_FAILURE);
>
> + nsRefPtr<DOMRequest> request = new DOMRequest(GetOwner());
> + nsCOMPtr<nsIMobileMessageCallback> msgCallback = new MobileMessageCallback(request);
nit: 80 chars
::: widget/android/AndroidBridge.cpp
@@ +162,5 @@
> jMarkUriVisited = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "markUriVisited", "(Ljava/lang/String;)V");
> jSetUriTitle = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "setUriTitle", "(Ljava/lang/String;Ljava/lang/String;)V");
>
> jSendMessage = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "sendMessage", "(Ljava/lang/String;Ljava/lang/String;I)V");
> + jGetSegmentInfoForText = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getSegmentInfoForText", "(II)V");
Never called and you don't really need it. We have a |jCalculateLength| static method defined at line 106 which calls Android SMS API for segment info. In the implementation of |AndroidBridge::GetSegmentInfoForText|, we can create an nsIDOMMozSmsSegmentInfo object and pass it to |nsIMobileMessageCallback->notifySegmentInfoForTextGot()|.
However, the problem in Android SMS backend now is it can't even be built successfully because of bug 862718, so you might not be able to test it at all. Maybe you can just create an follow-up and make that new bug block bug 862715.
Attachment #788116 -
Flags: feedback?(vyang) → feedback+
Updated•11 years ago
|
Whiteboard: [u=commsapps-user c=messaging p=3]
Updated•11 years ago
|
Whiteboard: [u=commsapps-user c=messaging p=3] → [u=commsapps-user c=messaging p=3 s=v1.2-features-sprint-3]
Assignee | ||
Comment 7•11 years ago
|
||
Attachment #788116 -
Attachment is obsolete: true
Attachment #794574 -
Flags: review?(vyang)
Assignee | ||
Comment 8•11 years ago
|
||
The try server failed: https://tbpl.mozilla.org/?tree=Try&rev=ab20ada2ef78
After looking into this issue, I found out the OOP works well but the marionette (non-OOP) fails because: when calling |smsService->GetSegmentInfoForText(aText, msgCallback)| the |request.notifySegmentInfoForTextGot(...)| in RIL immediately returns *before* |MobileMessageManager::GetSegmentInfoForText(...)| returns the DOMRequest object to the content. At the moment, the DOMRequest would drop this event because the content doesn't yet set its onsuccess/onerror.
MobileMessageManager::GetSegmentInfoForText(const nsAString& aText,
nsIDOMDOMRequest** aRequest)
{
nsCOMPtr<nsISmsService> smsService = do_GetService(SMS_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(smsService, NS_ERROR_FAILURE);
nsRefPtr<DOMRequest> request = new DOMRequest(GetOwner());
nsCOMPtr<nsIMobileMessageCallback> msgCallback =
new MobileMessageCallback(request);
nsresult rv = smsService->GetSegmentInfoForText(aText, msgCallback);
NS_ENSURE_SUCCESS(rv, rv);
request.forget(aRequest);
return NS_OK;
}
Hi Vicamo, do you have any better idea to tackle this tricky issue?
Flags: needinfo?(vyang)
Flags: in-testsuite+
Assignee | ||
Comment 9•11 years ago
|
||
Well, using DOMRequestService::FireSuccessAsync sounds a feasible solution.
Comment 10•11 years ago
|
||
(In reply to Gene Lian [:gene] from comment #8)
> Hi Vicamo, do you have any better idea to tackle this tricky issue?
No, and that should also have happened on other requests like sendSMS but it doesn't. Hmmm...
Flags: needinfo?(vyang)
Comment 11•11 years ago
|
||
Comment on attachment 794574 [details] [diff] [review]
Patch, V2
Review of attachment 794574 [details] [diff] [review]:
-----------------------------------------------------------------
Let's go DOMRequestService::Fire{Error,Success}Async.
Attachment #794574 -
Flags: review?(vyang) → review+
Assignee | ||
Comment 12•11 years ago
|
||
(In reply to Vicamo Yang [:vicamo][:vyang] from comment #10)
> (In reply to Gene Lian [:gene] from comment #8)
> > Hi Vicamo, do you have any better idea to tackle this tricky issue?
>
> No, and that should also have happened on other requests like sendSMS but it
> doesn't. Hmmm...
Thanks for the advice. Eventually, I think I know why... Because all the SMS/MMS need to be saved into DB before sending and that makes an asychronous call, so...
I'll work out a new patch and ask for another review.
Comment 13•11 years ago
|
||
Don't forget we need to wait for the gaia patch in bug 902497 before landing this, unless you change the method name and keep the old one temporary, or add an optional "async" argument.
I'd prefer that we wait for bug 902497 :) I have a WIP patch already.
Assignee | ||
Comment 14•11 years ago
|
||
This patch is working but I'm not sure if you like what I did for NotifySegmentInfoForTextGot/NotifyGetSegmentInfoForTextFailed specific.
Try: https://tbpl.mozilla.org/?tree=Try&rev=6b6005cff667
Attachment #794574 -
Attachment is obsolete: true
Attachment #796790 -
Flags: review?(vyang)
Comment 15•11 years ago
|
||
Comment on attachment 796790 [details] [diff] [review]
Patch, V3
Review of attachment 796790 [details] [diff] [review]:
-----------------------------------------------------------------
Please file a follow-up bug and let's find out why other requests are immune from this problem.
Attachment #796790 -
Flags: review?(vyang) → review+
Updated•11 years ago
|
Keywords: dev-doc-needed
Comment 16•11 years ago
|
||
bug 902497 is ready, let's check in both together !
Keywords: checkin-needed
Comment 17•11 years ago
|
||
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
Assignee | ||
Comment 19•11 years ago
|
||
It shocks me we've already landed this after I was back from vacation. Because I was told to wait for Gaia's codes, I didn't give the new patch a full test on the device but just on the try server. Anyway, I'll test it again with the Gaia codes. It should be working, though. :)
Comment 20•11 years ago
|
||
Gene> oops, sorry, it's my fault as I really thought it was ready. I tested it a lot on the device though !
Assignee | ||
Comment 21•11 years ago
|
||
No problem! Since you already did the test then I won't do it again. Thanks for you action. You make my day. :)
Updated•11 years ago
|
status-firefox26:
--- → fixed
Comment 22•11 years ago
|
||
Please, update documentation in https://developer.mozilla.org/en-US/docs/Web/API/MozMobileMessageManager.getSegmentInfoForText
Comment 24•11 years ago
|
||
Julien, feel free to update it, it is a wiki.
Comment 25•11 years ago
|
||
Which(In reply to Julien Wajsberg [:julienw] from comment #23)
> Jérémie, we need an updated doc here.
Which Firefox OS version is targeted? 1.2 or 1.3?
Comment 26•11 years ago
|
||
Hey Jérémie, this is a 1.2 bug.
Thanks!
Comment 27•11 years ago
|
||
The documentation is now up to date: https://developer.mozilla.org/en-US/docs/Web/API/MozMobileMessageManager.getSegmentInfoForText
And it still expect a tech review ;) (Just let me know if it's okay or if something need to be changed)
Flags: needinfo?(jeremie.patonnier)
You need to log in
before you can comment on or make changes to this bug.
Description
•