Open Bug 1633018 Opened 5 years ago Updated 5 years ago

nsICanvasRenderingContextInternal is a leaky abstraction

Categories

(Core :: Graphics, defect, P3)

defect

Tracking

()

People

(Reporter: kvark, Unassigned)

References

(Blocks 1 open bug)

Details

It's not a proper abstraction, and it's error prone to use.

Reason-1: the user has to explicitly CC clean up the class'es members:

NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_WEAK_PTR(
    ClientWebGLContext, mExtLoseContext, mNotLost,
    // Don't forget nsICanvasRenderingContextInternal:
    mCanvasElement, mOffscreenCanvas)

Reason-2: the user has to unlink from the refresh driver even though they don't register there explicitly:

ClientWebGLContext::~ClientWebGLContext() { RemovePostRefreshObserver(); }

When implementing WebGPU's CanvasContext, I got caught in both of this cases separately.

Severity: -- → normal

The severity field is not set for this bug.
:jbonisteel, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(jbonisteel)
Severity: normal → S4
Flags: needinfo?(jbonisteel)
You need to log in before you can comment on or make changes to this bug.