Reduce amount of boilerplate code required for CodeAddressService

NEW
Unassigned

Status

()

Core
XPCOM
4 years ago
4 years ago

People

(Reporter: erahm, Unassigned)

Tracking

Trunk
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

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.
You need to log in before you can comment on or make changes to this bug.