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

RESOLVED FIXED in mozilla21

Status

()

defect
RESOLVED FIXED
7 years ago
4 months ago

People

(Reporter: smaug, Assigned: bzbarsky)

Tracking

({dev-doc-complete})

unspecified
mozilla21
x86
Linux
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

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 #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+
http://hg.mozilla.org/integration/mozilla-inbound/rev/32786d29daf8
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:

http://hg.mozilla.org/integration/mozilla-inbound/rev/b3cabb259af7
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: https://hg.mozilla.org/integration/mozilla-inbound/rev/2b9a689ac459
Er, I meant https://hg.mozilla.org/integration/mozilla-inbound/rev/e894c103775f

Can this now qualify for Most Confusing Bug Ever awards?
https://hg.mozilla.org/mozilla-central/rev/e894c103775f
Status: NEW → RESOLVED
Closed: 7 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.