Closed Bug 720555 Opened 12 years ago Closed 12 years ago

Provide a way to have device-specific code in gecko

Categories

(Firefox OS Graveyard :: General, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: fabrice, Assigned: fabrice)

Details

Attachments

(1 file)

Attached patch patchSplinter Review
A bit sad, but this is useful when there are some differences on how devices offer some low level interfaces that we use in gecko.

This patch adds a --with-b2g-device=MY_DEVICE configure option that sets -DMY_DEVICE
Attachment #590915 - Flags: review?(jones.chris.g)
Assignee: nobody → fabrice
Comment on attachment 590915 [details] [diff] [review]
patch

I don't like the direction this is heading.  What's the intended use for this?  There are two general cases
 - switching between different interfaces at compile time, e.g. different vtables.
 - working around runtime quirks, e.g. call X() on device A but Y() on device B

Each compile-time build switch we add contributes to a combinatorial explosion of supported options.  "Did you try compiling for device A?  How about B?  C?"  I would really rather not do that unless we absolutely have to.

Both examples above can be handled with runtime detection.  First detect the device type.  Then for runtime quirks, add a QUIRK_USE_Y flag or something to select runtime behavior, based on features.  For mismatched vtables, we can similarly have the union of layouts as FooClass_Interface_A / FooClass_Interface_B etc. and choose the layout at runtime.  This is the approach we use for NPAPI plugins, and it's pretty much the only way to maintain that code.  Of course, in the long run this should go away, as we're better able to stabilize on interface versions across blob/source.

Let's chat a bit more about this.
Attachment #590915 - Flags: review?(jones.chris.g) → review-
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: