Closed Bug 907307 Opened 12 years ago Closed 11 years ago

Codegen c++ webidl bindings that binary addons can use

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: dzbarsky, Unassigned)

Details

Currently, binary addons can't use WebIDL bindings because most methods have hidden visibility and aren't virtual. Since Gecko uses hidden visibility by default, changing the visibility would require patch authors and reviewers to constantly remember to provide external linkage. Instead, we can have Codegen.py generate a secondary set of bindings for binary addons. Say we have a WebIDL interface Foo implemented by mozilla::dom::Foo. Codegen can create a class, for example, mozilla::DOM::Foo that implements the WebIDL API with virtual functions, stores a nsRefPtr<mozilla::dom::Foo>, and forwards the implementation to it. The binding can only have a hashtable mapping each mozilla::dom::Foo to its wrapper, the mozilla::DOM::Foo. That way, when Foo tries to return interface Bar, DOM::Foo can look up/create the correct DOM::Bar wrapper so that attributes continue to return the same object every time. If we care about allowing QI, we can do so using nsIInterfaceRequestor. I think we can start with the example binding generation, and condition it on a build flag to avoid building a bunch of new c++ files for local builds. Thoughts?
Flags: needinfo?(peterv)
Flags: needinfo?(bzbarsky)
I would like to WONTFIX this bug. I don't think we should put much effort into supporting binary addons.
We _should_ have some sort of embedding API, but I'm not sure whether this is the way to go about it...
Flags: needinfo?(bzbarsky)
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: needinfo?(peterv)
Resolution: --- → WONTFIX
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.