Closed Bug 1571875 Opened 5 years ago Closed 5 years ago

Update DynamicallyLinkedFunctionPtr to take advantage of new MOZ_STATIC_LOCAL_CLASS annotation

Categories

(Core :: mozglue, task, P1)

Unspecified
Windows
task

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: bugzilla, Assigned: bugzilla)

Details

Attachments

(2 files)

Most uses of DynamicallyLinkedFunctionPtr are as static locals, which means that we end up generating a bunch of unnecessary FreeLibrary calls when these objects are destroyed at shutdown.

Now that we have MOZ_STATIC_LOCAL_CLASS, we can create a variant for static locals that has a trivial destructor, thus eliminating all that FreeLibrary goop.

This patch does two things:

  1. We refactor the resolution of function pointer and return type so that we
    may support additional calling conventions besides just __stdcall;

  2. We refactor DynamicallyLinkedFunctionPtr into a base class, and create
    StaticDynamicallyLinkedFunctionPtr to specifically handle the static local
    use case.

Pushed by aklotz@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f1c97ef1f9cb
Part 1 - Refactor DynamicallyLinkedFunctionPtr into static local and normal variants; r=mhowell
https://hg.mozilla.org/integration/autoland/rev/20cdaeefd4e1
Part 2 - Change over all existing static local uses of DynamicallyLinkedFunctionPtr to use StaticDynamicallyLinkedFunctionPtr instead; r=mhowell
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: