Closed Bug 1565704 Opened 5 years ago Closed 5 years ago

[jsdbg2] Debugger API Handler base class makes memory tracking difficult

Categories

(Core :: JavaScript Engine, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: jimb, Assigned: jimb)

Details

Attachments

(1 file)

The design of the js::Handler abstract base class, used for Debugger API handlers at the C++ level, makes it difficult to properly support the new js::gc::MemoryUse-based allocation tracking.

For example, DebuggerFrame::setOnStepHandler reports when a DebuggerFrame takes ownership of a handler, but that method is not in a position to know whether the handler is owned exclusively by that DebuggerFrame or shared as the handler for many events. (We don't have any shared handlers at the moment, but as we extend the C++-level API to support other uses of the debugger, we expect them to exist.)

Extend js::Handler, the base class for Debugger API handler functions, with a
hold method, to act as a pair with the drop method. Clarify comments
explaining how they're to be used, with a more explicit explanation of how
reference-counted handlers could be implemented.

Following the new rules:

  • Change ScriptedOnStepHandler and ScriptedOnPopHandler to report the
    handler's ownership.

  • Change DebuggerFrame::setOnStepHandler and DebuggerFrame::setOnPopHandler
    to let the handler deal with that.

Change the owner argument type from DebuggerFrame to the looser JSObject;
the Handler base class isn't specific to stack frames at all, but is meant to
eventually be used for onNewScript and onEnterFrame as well.

Priority: -- → P2
Pushed by jblandy@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fe8cfb80b5b8
Clarify ownership reporting in Debugger's js::Handler base class. r=jonco
Assignee: nobody → jimb
Status: NEW → 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: