Closed Bug 1053379 Opened 10 years ago Closed 5 years ago

Reduce amount of boilerplate code required for CodeAddressService

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: erahm, Assigned: heycam)

References

Details

Attachments

(1 file)

In bug 1050445 a fair amount of duplicated template params for CodeAddressService were added to BlockingResourceBase (copied from nsTraceRefcnt). We can probably either factor these out to a shared header or add sensible defaults to CodeAddressService itself.

It seems like for CodeAddressService we could reduce the amount of template params to:
  - writer
  - allocator
  - unlocker

The hashtable param could just be replaced w/ the standard implementation we have now and the allocator provided as a template param would be used.

We could go further and provide sensible defaults for allocator and unlocker and DMD could override those. So in theory a standard implementation would just look like this:

  struct MyWriter { ... };
  CodeAddressService<MyWriter> cas;
That sounds like a good idea.  The parameters are basically needed because DMD is weird.  I expect every usage in the browser itself will just use the standard set of arguments.
Depends on: 1061385
Bug 1061385 removed the |Writer| param, which was a big part of this.

None of the StringTable implementations were freeing their strdup'd
strings, either.

Pushed by cmccormack@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6411cd0771a9
Simplify CodeAddressService so non-DMD users can rely on defaults. r=njn
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: