Closed Bug 1895462 Opened 4 months ago Closed 4 months ago

Allow WeakCache containers to use UniquePtrs

Categories

(Core :: JavaScript: GC, task, P2)

task

Tracking

()

RESOLVED FIXED
128 Branch
Tracking Status
firefox128 --- fixed

People

(Reporter: jonco, Assigned: jonco)

References

Details

Attachments

(1 file)

While working on bug 1894012 I wanted to add a WeakCached map where the keys were UniquePtrs and was surprised this wasn't possible.

It turns out that our incremental sweeping for maps and sets calls the copy constructors of keys and values and that doesn't work with something like UniquePtr where the copy constructor is deleted.

Summary: Allow WeakCache containers to use UnqiuePtrs → Allow WeakCache containers to use UniquePtrs
Severity: -- → S3
Priority: -- → P2

The problem here is that we copy the keys/values in entryNeedsSweep. I tried
several strategies to avoid this but in the end the simplest thing to do was
add a needsSweep method to the GC policy templates that calls
IsAboutToBeFinalized. I've implemented this only where necessary (and WeakCache
is only used internally nowadays).

Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/bb3c347722e6
Allow UniquePtrs to be used in WeakCache hash maps r=sfink
Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 128 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: