Closed Bug 830099 Opened 10 years ago Closed 10 years ago

Don't generate dictionary code for workers when binding is used only in the main thread


(Core :: DOM: Core & HTML, defect)

Not set





(Reporter: smaug, Assigned: bzbarsky)



(Keywords: dev-doc-complete)


(1 file, 1 obsolete file)

Seems like we generate worker code for dictionaries which are main thread only.
Either .conf is missing something, or we just generate the code always.
We always generate both worker and main-thread code for workers, yes.  Same thing for callbacks (modulo WorkerOnly annotations), as I recall.

We could try to do something smarter, I guess.  Maybe using code similar to that which generates includes and forward-declares...
So some thoughts on implementing this, so I can sleep:

The right approach seems to be to start at relevant descriptors (all main-thread ones or all worker ones, including callback interface descriptors for main-thread) and then go through all the types listed.  For each type, if it's a union add all types in the union, if it's a callback add the return type and all argument types, if it's a dictionary add all member types.  This is kinda like the callForEachType setup, except that only takes a subset of descriptors and expects to be handed the dictionaries and callbacks, whereas here we'd figure those bits out.

Then we see what callbacks and dictionaries are in that set of types, and only generate code for those.

Note that all that information will not depend on the WebIDL file, so only needs to be computed once.  I wonder whether we can pickle it... need to check what we pickle right now.
Assignee: nobody → bzbarsky
Whiteboard: [need review]
Depends on: 822470
Attachment #704009 - Flags: review?(peterv)
Attachment #702139 - Attachment is obsolete: true
Attachment #702139 - Flags: review?(peterv)
Attachment #704009 - Attachment description: Merged on top of → Merged on top of bug 822470
If this lands as-is, I should remember to remove the docs for [WorkerOnly]
Keywords: dev-doc-needed
Attachment #704009 - Flags: review?(peterv) → review+
Flags: in-testsuite-
Whiteboard: [need review]
Target Milestone: --- → mozilla21
Documentation updated.
Ah, yes, RTCIceServer C++ uses got added without any actual WebIDL using it...

Added it to the DummyBinding and relanded:
And a followup to fix the RTC stuff on Android:
Gah.  I'm so tired of all the goddamned ifdefed not-WebIDL-but-pretending crap.  :(
Once more, with feeling, and a lot fewer ifdefs in our IDL:
Er, I meant

Can this now qualify for Most Confusing Bug Ever awards?
Closed: 10 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.