Closed
Bug 1466182
Opened 6 years ago
Closed 6 years ago
Add AudioWorkletProcessor interface definitions
Categories
(Core :: Web Audio, enhancement, P2)
Core
Web Audio
Tracking
()
RESOLVED
FIXED
mozilla63
Tracking | Status | |
---|---|---|
firefox63 | --- | disabled |
People
(Reporter: arnaud.bienner, Assigned: arnaud.bienner)
References
()
Details
(Keywords: dev-doc-needed)
Attachments
(1 file)
No description provided.
Assignee | ||
Updated•6 years ago
|
Blocks: audioworklet
Assignee | ||
Updated•6 years ago
|
Assignee: nobody → arnaud.bienner
Updated•6 years ago
|
Rank: 15
Priority: -- → P2
Comment hidden (mozreview-request) |
Assignee | ||
Comment 2•6 years ago
|
||
About previous patch: I'm not sure how to test this interface. Adding it to test_interfaces doesn't seem to work. I suspect this is because AudioWorkletProcessor isn't exposed in Window. I suspect we should add a new test_worklet_interfaces.js (or test_audioworklet) in dom/worklet/tests, similarly to test_worker_interfaces.js for interfaces which are exposed only in Worker (e.g. WorkerLocation). Not sure if this should be done now or later.
Assignee | ||
Comment 3•6 years ago
|
||
Looking at how Worker tests are implemented, I see they are similar to regular test_intefaces tests, but sent to the worker using postMessage so they can be executed in the correct context. So unless we have implemented (message)port for AudioWorklet (on both node and processor side), we won't be able to add interface tests. As soon as those are implemented, we should add those tests.
Assignee | ||
Comment 4•6 years ago
|
||
One last thing about the current patch: I couldn't put a Pref in the webidl, because AudioWorkletProcessor is not exposed to Window, so Pref isn't available. I'm not sure this is really an issue, since AudioWorkletProcessor won't be acessible from Window, and all other interfaces using it indirectly are/will be guarded by a pref.
Updated•6 years ago
|
Keywords: dev-doc-needed
Assignee | ||
Comment 5•6 years ago
|
||
Karl: regarding our discussion yesterday, about whether or not it was correct to have window as parent object (for GetParentObject), I had a look to WorkerNavigator and WorkerLocation, both being interfaces exposed to Worker only, and they return nullptr for GetParentObject so this is probably what we should do here. (Audio)WorkletGlobalScope, exposed only to AudioWorklet, also returns nullptr for GetParentObject. What do you think?
Flags: needinfo?(karlt)
Comment 6•6 years ago
|
||
mozreview-review |
Comment on attachment 8987372 [details] Bug 1466182 - Add AudioWorkletProcessor definitions. https://reviewboard.mozilla.org/r/252606/#review259094 ::: dom/bindings/DOMJSClass.h:109 (Diff revision 1) > static const uint32_t DedicatedWorkerGlobalScope = 1u << 2; > static const uint32_t SharedWorkerGlobalScope = 1u << 3; > static const uint32_t ServiceWorkerGlobalScope = 1u << 4; > static const uint32_t WorkerDebuggerGlobalScope = 1u << 5; > static const uint32_t WorkletGlobalScope = 1u << 6; > +static const uint32_t AudioWorkletGlobalScope = 1u << 7; I guess we need something added to IsNonExposedGlobal() also https://searchfox.org/mozilla-central/rev/14cb8f1c238735ba1abe18ad44e39808983c2572/dom/bindings/BindingUtils.cpp#2958 ::: dom/media/webaudio/AudioWorkletProcessor.h:28 (Diff revision 1) > + static already_AddRefed<AudioWorkletProcessor> > + Constructor(const GlobalObject& aGlobal, Mozilla style is to align Constructor with static. ::: dom/media/webaudio/AudioWorkletProcessor.cpp:32 (Diff revision 1) > + nsCOMPtr<nsPIDOMWindowInner> window = > + do_QueryInterface(aGlobal.GetAsSupports()); AudioWorkletGlobalScope is not an nsPIDOMWindowInner. GetParentObject could return nsIGlobalObject like MessagePort via DOMEventTargetHelper https://searchfox.org/mozilla-central/rev/14cb8f1c238735ba1abe18ad44e39808983c2572/dom/workers/WorkerPrivate.cpp#5252 https://searchfox.org/mozilla-central/rev/14cb8f1c238735ba1abe18ad44e39808983c2572/dom/workers/WorkerPrivate.cpp#5252 and MessageChannel https://searchfox.org/mozilla-central/rev/14cb8f1c238735ba1abe18ad44e39808983c2572/dom/messagechannel/MessageChannel.cpp#48 But I'll pass review onto baku, to see whether this is necessary. ::: dom/media/webaudio/AudioWorkletProcessor.cpp:34 (Diff revision 1) > + if (!window) { > + aRv.Throw(NS_ERROR_FAILURE); > + return nullptr; > + } MessageChannel just asserts nsIGlobalObject* aGlobal, so I guess that would be sufficient. ::: dom/media/webaudio/AudioWorkletProcessor.cpp:52 (Diff revision 1) > + JS::Handle<JSObject*> aGivenProto) > +{ > + return AudioWorkletProcessorBinding::Wrap(aCx, this, aGivenProto); > +} > + > +MessagePort* AudioWorkletProcessor::GetPort(ErrorResult& aRv) const Start a new line at the start of "AudioWorkletProcessor".
Attachment #8987372 -
Flags: review?(karlt)
Comment 7•6 years ago
|
||
mozreview-review-reply |
Comment on attachment 8987372 [details] Bug 1466182 - Add AudioWorkletProcessor definitions. https://reviewboard.mozilla.org/r/252606/#review259094 > AudioWorkletGlobalScope is not an nsPIDOMWindowInner. > > GetParentObject could return nsIGlobalObject like MessagePort via DOMEventTargetHelper > https://searchfox.org/mozilla-central/rev/14cb8f1c238735ba1abe18ad44e39808983c2572/dom/workers/WorkerPrivate.cpp#5252 > https://searchfox.org/mozilla-central/rev/14cb8f1c238735ba1abe18ad44e39808983c2572/dom/workers/WorkerPrivate.cpp#5252 > and MessageChannel > https://searchfox.org/mozilla-central/rev/14cb8f1c238735ba1abe18ad44e39808983c2572/dom/messagechannel/MessageChannel.cpp#48 > > But I'll pass review onto baku, to see whether this is necessary. The second link was meant to be https://searchfox.org/mozilla-central/rev/14cb8f1c238735ba1abe18ad44e39808983c2572/dom/base/StructuredCloneHolder.cpp#1162
Comment 8•6 years ago
|
||
(In reply to Arnaud Bienner from comment #5) > Karl: regarding our discussion yesterday, about whether or not it was > correct to have window as parent object (for GetParentObject), I had a look > to WorkerNavigator and WorkerLocation, both being interfaces exposed to > Worker only, and they return nullptr for GetParentObject so this is probably > what we should do here. > > (Audio)WorkletGlobalScope, exposed only to AudioWorklet, also returns > nullptr for GetParentObject. AudioWorkletGlobalScope is at the top of the parent hierarchy, so that may be why it returns nullptr. I'm not familiar with the worker objects, and they seem a little different from MessageChannel/Port, so let's see what baku thinks.
Flags: needinfo?(karlt)
Updated•6 years ago
|
Flags: needinfo?(amarchesini)
Comment 9•6 years ago
|
||
Inside the worklet global scope, you don't have a window, but you have a nsIGlobalObject which is the WorkerGlobalScope. In your case, this is also a AudioWorkletGlobalScope. In the WebIDL world, GetParentObject() is used to follow the chain of 'parent objects' until we have a nsIGlobalObject.
Flags: needinfo?(amarchesini)
Comment 10•6 years ago
|
||
mozreview-review |
Comment on attachment 8987372 [details] Bug 1466182 - Add AudioWorkletProcessor definitions. https://reviewboard.mozilla.org/r/252606/#review259968 ::: dom/media/webaudio/AudioWorkletProcessor.h:33 (Diff revision 1) > + static already_AddRefed<AudioWorkletProcessor> > + Constructor(const GlobalObject& aGlobal, > + const AudioWorkletNodeOptions& aOptions, > + ErrorResult& aRv); > + > + nsPIDOMWindowInner* GetParentObject() const { return mParent; } nsIGlobalObject GetParentObject() const { return mParent; } ::: dom/media/webaudio/AudioWorkletProcessor.h:41 (Diff revision 1) > + JS::Handle<JSObject*> aGivenProto) override; > + > + MessagePort* GetPort(ErrorResult& aRv) const; > + > +private: > + explicit AudioWorkletProcessor(nsPIDOMWindowInner* aParent); In general, s/nsPIDOMWindowInner/nsIGlobalObject/g in this file. ::: dom/media/webaudio/AudioWorkletProcessor.h:43 (Diff revision 1) > + MessagePort* GetPort(ErrorResult& aRv) const; > + > +private: > + explicit AudioWorkletProcessor(nsPIDOMWindowInner* aParent); > + ~AudioWorkletProcessor() = default; > + nsCOMPtr<nsPIDOMWindowInner> mParent; nsCOMPtr<nsIGlobalObject> mParent; ::: dom/media/webaudio/AudioWorkletProcessor.cpp:34 (Diff revision 1) > + const AudioWorkletNodeOptions& aOptions, > + ErrorResult& aRv) > +{ > + nsCOMPtr<nsPIDOMWindowInner> window = > + do_QueryInterface(aGlobal.GetAsSupports()); > + if (!window) { Karlt is right here. What you want is: nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports()); and global cannot be null here: MOZ_ASSERT(global);
Comment hidden (mozreview-request) |
Comment 12•6 years ago
|
||
mozreview-review |
Comment on attachment 8987372 [details] Bug 1466182 - Add AudioWorkletProcessor definitions. https://reviewboard.mozilla.org/r/252606/#review260086 ::: dom/webidl/AudioWorkletProcessor.webidl:19 (Diff revision 2) > + Constructor (optional AudioWorkletNodeOptions options)] > +interface AudioWorkletProcessor { > + [Throws] > + readonly attribute MessagePort port; > +}; > + No extra line here.
Attachment #8987372 -
Flags: review?(amarchesini) → review+
Comment hidden (mozreview-request) |
Comment 14•6 years ago
|
||
mozreview-review |
Comment on attachment 8987372 [details] Bug 1466182 - Add AudioWorkletProcessor definitions. https://reviewboard.mozilla.org/r/252606/#review260228
Attachment #8987372 -
Flags: review?(karlt) → review+
Assignee | ||
Comment 15•6 years ago
|
||
Pushed to try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=66cbc5cefd92543f48f7cc01c9e946f51b8a7025
Comment hidden (mozreview-request) |
Assignee | ||
Comment 17•6 years ago
|
||
Try failed. Compiler spotted a bug (not sure why this warning/error wasn't activated on my machine). Fixed and push to try again: https://treeherder.mozilla.org/#/jobs?repo=try&revision=3f4bb796652a32e5dc96b8ef829e1953ce3a1c37
Comment 19•6 years ago
|
||
(In reply to Arnaud Bienner from comment #17) > (not sure why this warning/error wasn't activated on my machine). Warnings are only errors (by default) on the build infrastructure, due to different compiler versions issuing different warnings. I'll trigger autoland.
Keywords: checkin-needed
Comment 20•6 years ago
|
||
Actually, I can't until the outstanding issues are marked resolved, and I can't do that for Andrea's issues. Can you resolve them, Arnaud?
Flags: needinfo?(arnaud.bienner)
Assignee | ||
Comment 21•6 years ago
|
||
Sorry about that: issues marked as fixed.
Flags: needinfo?(arnaud.bienner)
Keywords: checkin-needed
Comment 22•6 years ago
|
||
Pushed by ebalazs@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/cfbcac62d08e Add AudioWorkletProcessor definitions. r=baku,karlt
Keywords: checkin-needed
Comment 23•6 years ago
|
||
Backed out changeset cfbcac62d08e (bug 1466182) for causing bustage builds/worker/workspace/build/src/dom/media/webaudio/AudioWorkletProcessor.cpp Push with failure: https://treeherder.mozilla.org/#/jobs?repo=autoland&revision=cfbcac62d08e6b552f56c858f314e45d15048b3a&selectedJob=185557797 Failure log: https://treeherder.mozilla.org/logviewer.html#?job_id=185557797&repo=autoland&lineNumber=21336 Backout: https://treeherder.mozilla.org/#/jobs?repo=autoland&revision=6f13930cf9282fbc6f937b6993365197de0a85be
Flags: needinfo?(arnaud.bienner)
Comment hidden (mozreview-request) |
Assignee | ||
Comment 25•6 years ago
|
||
Like for bug 1470856, IDL generated C++ classes have suffix "_Binding" instead of "Binding" so that's why the patch was broken. Patch updated + push to try again: https://treeherder.mozilla.org/#/jobs?repo=try&revision=38b32b2459a86127d37cb905e133c76c25dbbe27
Flags: needinfo?(arnaud.bienner)
Comment 27•6 years ago
|
||
Pushed by dluca@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/fb53c31538e7 Add AudioWorkletProcessor definitions. r=baku,karlt
Keywords: checkin-needed
Comment 28•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/fb53c31538e7
Status: NEW → RESOLVED
Closed: 6 years ago
status-firefox63:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Updated•6 years ago
|
Summary: Add AudioWorkletProcessor definitions → Add AudioWorkletProcessor interface definitions
You need to log in
before you can comment on or make changes to this bug.
Description
•