Open Bug 1905445 Opened 1 year ago Updated 1 year ago

Provide a generic keep alive mechanism

Categories

(Core :: Storage: Quota Manager, task, P2)

task

Tracking

()

ASSIGNED

People

(Reporter: janv, Assigned: janv)

References

(Blocks 1 open bug)

Details

Attachments

(3 files, 3 obsolete files)

We have many cases where we use CheckedUnsafePtr to ensure that we get notified (by an assertion) if an object is being destroyed before it is removed from a global hash table or array. Simply replacing CheckedUnsafePtr with RefPtr would make it hard to identify where we missed an unregistration in a global hash table or array (global tracking would keep the object alive forever). I believe we can create a generic keep-alive mechanism that would prevent lifecycle issues as much as possible, so diagnostic assertions wouldn't be needed anymore. This would eventually lead to replacing CheckedUnsafePtr with ordinary RefPtr in global hash tables or arrays.

Blocks: 1905612

This is a new version of D215351 which addresses some initial design comments.
A thread safe version of RefCountedSharedObject should be able to avoid a
static mutex and use std::atomic.
The new design is not limited to always trigger a diagnostic assertion. It
allows to do custom checks and cleanup when the holder becomes the last one
holding a strong ref to the object.

This is only a demo patch, not intended for landing.

Summary: Provide a safer alternative for some CheckedUnsafePtr use cases → Provide a generic keep alive mechanism
Depends on: 1908663
Blocks: 1890097
Blocks: 1926778
Attachment #9411600 - Attachment is obsolete: true
Attachment #9410467 - Attachment is obsolete: true
Attachment #9411526 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: