Closed
Bug 1165134
Opened 10 years ago
Closed 9 years ago
Add new MozChromeEvent/MozContentEvent to allow System app to control its own audio channels
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla41
Tracking | Status | |
---|---|---|
firefox41 | --- | fixed |
People
(Reporter: evanxd, Assigned: evanxd)
References
Details
Attachments
(1 file, 4 obsolete files)
(deleted),
patch
|
Details | Diff | Splinter Review |
Add new MozChromeEvent/MozContentEvent in shell.js to allow System app to control its own audio channels.
Assignee | ||
Comment 1•10 years ago
|
||
Hi :baku,
Could you help to review the patch for shell.js?
Thanks.
Attachment #8606047 -
Flags: review?(amarchesini)
Assignee | ||
Comment 2•10 years ago
|
||
:baku, one more question about `shell.sendChromeEvent` method in shell.js.
We only can do `shell.sendChromeEvent` after the `MozAfterPaint` event is triggered, right?
In my experiment, if I do `shell.sendChromeEvent` too early(before `MozAfterPaint` event is triggered), System app just cannot receive the MozChromeEvent.
Is above correct? Or I misunderstood something?
Thank.
Flags: needinfo?(amarchesini)
Assignee | ||
Updated•10 years ago
|
Comment 3•10 years ago
|
||
Comment on attachment 8606047 [details] [diff] [review]
bug-1165134.patch
Review of attachment 8606047 [details] [diff] [review]:
-----------------------------------------------------------------
::: b2g/chrome/content/shell.js
@@ +843,5 @@
> };
>
> +let SystemAppMozBrowserHelper = {
> + handleEvent: function systemAppMozBrowser_handleEvent(detail) {
> + let request;
this is a nice C style approach, but can you initialize the variable when you need it?
Otherwise I don't understand why just 'request' and 'name': they are not fully shared between all the cases of the switch.
@@ +848,5 @@
> + let name;
> + switch (detail.type) {
> + case 'system-audiochannel-list':
> + let audioChannels = [];
> + shell.allowedAudioChannels.forEach(function(audioChannel) {
shell.allowedAudioChannels.forEach(function(value, name) {
audioChannels.push(name);
});
@@ +857,5 @@
> + audioChannels: audioChannels
> + });
> + break;
> + case 'system-audiochannel-mute':
> + name = detail.name;
let name
@@ +859,5 @@
> + break;
> + case 'system-audiochannel-mute':
> + name = detail.name;
> + let isMuted = detail.isMuted;
> + request = shell.allowedAudioChannels.get(name).setMuted(isMuted);
let request
@@ +876,5 @@
> + });
> + };
> + break;
> + case 'system-audiochannel-volume':
> + name = detail.name;
let name
@@ +878,5 @@
> + break;
> + case 'system-audiochannel-volume':
> + name = detail.name;
> + let volume = detail.volume;
> + request = shell.allowedAudioChannels.get(name).setVolume(volume);
let request
Attachment #8606047 -
Flags: review?(amarchesini) → review+
Assignee | ||
Updated•10 years ago
|
Assignee | ||
Comment 4•10 years ago
|
||
Assignee | ||
Comment 5•9 years ago
|
||
Attachment #8609104 -
Attachment is obsolete: true
Assignee | ||
Comment 6•9 years ago
|
||
For some reasons, I just could not push try even I had registered level 1 in Bug 988801. Ricky will help this, and thanks.
Assignee | ||
Comment 7•9 years ago
|
||
(In reply to Andrea Marchesini (:baku) from comment #3)
> Comment on attachment 8606047 [details] [diff] [review]
> bug-1165134.patch
>
> Review of attachment 8606047 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: b2g/chrome/content/shell.js
> @@ +843,5 @@
> > };
> >
> > +let SystemAppMozBrowserHelper = {
> > + handleEvent: function systemAppMozBrowser_handleEvent(detail) {
> > + let request;
>
> this is a nice C style approach, but can you initialize the variable when
> you need it?
> Otherwise I don't understand why just 'request' and 'name': they are not
> fully shared between all the cases of the switch.
>
> @@ +848,5 @@
> > + let name;
> > + switch (detail.type) {
> > + case 'system-audiochannel-list':
> > + let audioChannels = [];
> > + shell.allowedAudioChannels.forEach(function(audioChannel) {
>
> shell.allowedAudioChannels.forEach(function(value, name) {
> audioChannels.push(name);
> });
>
> @@ +857,5 @@
> > + audioChannels: audioChannels
> > + });
> > + break;
> > + case 'system-audiochannel-mute':
> > + name = detail.name;
>
> let name
>
> @@ +859,5 @@
> > + break;
> > + case 'system-audiochannel-mute':
> > + name = detail.name;
> > + let isMuted = detail.isMuted;
> > + request = shell.allowedAudioChannels.get(name).setMuted(isMuted);
>
> let request
>
> @@ +876,5 @@
> > + });
> > + };
> > + break;
> > + case 'system-audiochannel-volume':
> > + name = detail.name;
>
> let name
We cannot declare two same variables, see it in https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let.
>
> @@ +878,5 @@
> > + break;
> > + case 'system-audiochannel-volume':
> > + name = detail.name;
> > + let volume = detail.volume;
> > + request = shell.allowedAudioChannels.get(name).setVolume(volume);
>
> let request
Comment 8•9 years ago
|
||
Fabrice, you know more about this. Can you read comment 2?
Flags: needinfo?(amarchesini) → needinfo?(fabrice)
Comment 9•9 years ago
|
||
(In reply to (Vacation 5/22 - 6/1) Evan Tseng [:evanxd][:愛聞插低] from comment #2)
> :baku, one more question about `shell.sendChromeEvent` method in shell.js.
> We only can do `shell.sendChromeEvent` after the `MozAfterPaint` event is
> triggered, right?
>
> In my experiment, if I do `shell.sendChromeEvent` too early(before
> `MozAfterPaint` event is triggered), System app just cannot receive the
> MozChromeEvent.
>
> Is above correct? Or I misunderstood something?
>
> Thank.
We should buffer events if you send them from SystemAppProxy.jsm
Also, don't send mozChromeEvents with a `type`, that leads to performance issue. Rather, create a custom element with your own name, like for instance http://mxr.mozilla.org/mozilla-central/source/b2g/components/InterAppCommUIGlue.js#66
Flags: needinfo?(fabrice)
Assignee | ||
Comment 10•9 years ago
|
||
The try server result: https://treeherder.mozilla.org/#/jobs?repo=try&revision=2725e5d6e08b
Assignee | ||
Comment 11•9 years ago
|
||
Really thanks for Ricky's help.
Assignee | ||
Comment 12•9 years ago
|
||
For Comment 2, I created Bug 1167465.
Assignee | ||
Comment 13•9 years ago
|
||
Assignee | ||
Comment 14•9 years ago
|
||
Sorry, this is just the correct one: https://treeherder.mozilla.org/#/jobs?repo=try&revision=336280f45d38
Comment 15•9 years ago
|
||
Evan, please fix the event naming as I asked in comment 9.
Assignee | ||
Comment 16•9 years ago
|
||
Hi Fabrice,
Sorry, didn't see that before.
Sure, let me fix it.
Assignee | ||
Comment 17•9 years ago
|
||
Hi Fabrice,
Juse one thing to make sure.
if we do
```
// type => action
shell.sendChromeEvent({
action: 'system-audiochannel-list',
audioChannels: audioChannels
});
```
, there is no performance issue and it is good, right?
And currently, many statements([1], [2], [3], and more) about `sendChromeEvent` are just with `type` in shell.js, they also lead to performance issue, right?
Thanks.
[1]: https://dxr.mozilla.org/mozilla-central/source/b2g/chrome/content/shell.js#165-169
[2]: https://dxr.mozilla.org/mozilla-central/source/b2g/chrome/content/shell.js#467-470
[3]: https://dxr.mozilla.org/mozilla-central/source/b2g/chrome/content/shell.js#490-493
Flags: needinfo?(fabrice)
Assignee | ||
Comment 18•9 years ago
|
||
And one more thing.
Fabrice, do you know why the naming(type) cause the performance issue?
Comment 19•9 years ago
|
||
Evan,
No, switching from `type` to `action` is not good, and yes we have chromeEvent uses that I'd like to see disappear. You need to use your own event name, like in http://mxr.mozilla.org/mozilla-central/source/b2g/components/InterAppCommUIGlue.js#66
The reason is that if all we send is a `mozChromeEvent` event, we end up with lots of event listeners for this event in the system app, and we need to eventually run a large number of handler that just check if they can process the event's `type`. Unfortunately that can take time... we used to spend 30ms just to reach the right event handler to launch apps for instance!
Flags: needinfo?(fabrice)
Assignee | ||
Comment 20•9 years ago
|
||
Attachment #8617247 -
Attachment is obsolete: true
Assignee | ||
Comment 21•9 years ago
|
||
Hi Fabrice,
Got you.
I just updated the patch for your comments. See it in[1].
Thanks.
[1]: https://bug1165134.bugzilla.mozilla.org/attachment.cgi?id=8617247
Assignee | ||
Comment 22•9 years ago
|
||
Wait for Bug 1174121. Once it is fixed, then we can push try again.
Assignee | ||
Comment 23•9 years ago
|
||
The try for Comment 21: https://treeherder.mozilla.org/#/jobs?repo=try&revision=03cebadab1d8
Looks like there are some problems there, all Gij tasks were not passed. Start to debug.
Assignee | ||
Comment 24•9 years ago
|
||
Debug for the try service error[1].
[1]: https://treeherder.mozilla.org/#/jobs?repo=try&revision=03cebadab1d8
Assignee | ||
Comment 25•9 years ago
|
||
The try result for the debugging in Comment 24: https://treeherder.mozilla.org/#/jobs?repo=try&revision=1ef558136591
Assignee | ||
Comment 26•9 years ago
|
||
A new try push for all gecko and gaia tests: https://treeherder.mozilla.org/#/jobs?repo=try&revision=60c6673ead1f
Assignee | ||
Comment 27•9 years ago
|
||
Try for changing gaia code in bug-1166172 branch[1]: https://treeherder.mozilla.org/#/jobs?repo=try&revision=a45c42422882
If the Gij tasks are passed, I think we just need to apply the gaia change[1].
[1]: https://github.com/evanxd/gaia/tree/bug-1166172
Assignee | ||
Comment 28•9 years ago
|
||
If we change the timing of sending the content event[1][2], the try server tasks are good. So we can say Bug 1166172 just block this bug currently. Let's fix that.
[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1166172
[2]: https://github.com/mozilla-b2g/gaia/pull/30120/files
Assignee | ||
Comment 29•9 years ago
|
||
The try server tasks in Comment 28 are good[1].
[1]: https://treeherder.mozilla.org/#/jobs?repo=try&revision=a45c42422882.
Assignee | ||
Updated•9 years ago
|
Attachment #8606047 -
Attachment is obsolete: true
Assignee | ||
Comment 30•9 years ago
|
||
Comment on attachment 8621523 [details] [diff] [review]
bug-1165134.patch - Updated the patch for review comments
This patch is a duplicate of the r+ patch[1] with fixing some nits[2]. And the try push for it is also good[3]. Let's do `checkin-needed` and land the code.
[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1165134#c3
[2]: https://bugzilla.mozilla.org/show_bug.cgi?id=1165134#c9
[3]: https://treeherder.mozilla.org/#/jobs?repo=try&revision=60c6673ead1f
Attachment #8621523 -
Flags: review+
Assignee | ||
Updated•9 years ago
|
Keywords: checkin-needed
Comment 31•9 years ago
|
||
Keywords: checkin-needed
Updated•9 years ago
|
Attachment #8621523 -
Attachment is obsolete: true
Comment 32•9 years ago
|
||
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox41:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•