Closed Bug 1867604 Opened 2 years ago Closed 2 years ago

RequestedFrameRefreshObserver uses threadsafe refcounting macro despite only being used on main thread

Categories

(Core :: Graphics: CanvasWebGL, defect)

defect

Tracking

()

RESOLVED FIXED
122 Branch
Tracking Status
firefox122 --- fixed

People

(Reporter: dholbert, Assigned: dholbert)

References

Details

Attachments

(1 file)

When reviewing refresh-observer logic, hiro noticed that RequestedFrameRefreshObserver uses the threadsafe version of the refcounting-method-declaration-macro which seems unnecessary since this seems to be a main-thread-only object.

I chatted with :pehrsons about it and it seems there's no reason we need threadsafe refcounting here.

Let's switch from NS_INLINE_DECL_THREADSAFE_REFCOUNTING to the NS_INLINE_DECL_REFCOUNTING macro here, for performance and to avoid giving the mistaken impression that this object is used off-main-thread.

For reference, we have several other nsARefreshObserver subclasses that use the simpler NS_INLINE_DECL_REFCOUNTING macro:
https://searchfox.org/mozilla-central/rev/12ea2c521cdd071a6d25b0894f31f8f23b18b76a/widget/SwipeTracker.h#48-50
https://searchfox.org/mozilla-central/rev/12ea2c521cdd071a6d25b0894f31f8f23b18b76a/dom/ipc/CoalescedInputData.h#53,59

Just mentioning for added-confidence that this is a reasonable thing to do (for main-thread-only objects).

Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Pushed by dholbert@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/05fa00c2dc57 Use regular refcounting macro (not threadsafe one) for RequestedFrameRefreshObserver, since it's only used on the main thread. r=pehrsons
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 122 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: