Closed Bug 1847758 Opened 1 year ago Closed 11 months ago

pre-calculate length and hash for dom::PinnedStringId::init

Categories

(Core :: DOM: Bindings (WebIDL), task, P3)

task

Tracking

()

RESOLVED DUPLICATE of bug 1850344

People

(Reporter: arai, Assigned: arai)

References

(Blocks 1 open bug)

Details

https://searchfox.org/mozilla-central/rev/e4d8451468be3a0f8a9faa3d37cadf07200821ec/dom/bindings/PinnedStringId.h#24,30-31

class PinnedStringId {
...
  bool init(JSContext* cx, const char* string) {
    JSString* str = JS_AtomizeAndPinString(cx, string);

the consumer of PinnedStringId::init is auto-generated from webidl, and the length and the hash can be pre-calculated either in the bindgen or compile-time.

https://searchfox.org/mozilla-central/source/__GENERATED__/dom/bindings/APZTestDataBinding.cpp#935-936,942-943

bool
APZBucket::InitIds(JSContext* cx, APZBucketAtoms* atomsCache)
...
  if (!atomsCache->sequenceNumber_id.init(cx, "sequenceNumber") ||
      !atomsCache->scrollFrames_id.init(cx, "scrollFrames")) {
Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED
Type: defect → task

this might become unnecessary if we can extend the well-known atoms with gecko atoms in bug 1848278.

See Also: → 1848278

This will be handled as part of bug 1850344, by merging them into extended-known atoms.

Status: ASSIGNED → RESOLVED
Closed: 11 months ago
Duplicate of bug: 1850344
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.