Bug 154410 - Web Inspector: Programmatically mark/paint objects for heap snapshot
Summary: Web Inspector: Programmatically mark/paint objects for heap snapshot
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-02-18 13:19 PST by Joseph Pecoraro
Modified: 2016-12-13 15:37 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2016-02-18 13:19:37 PST
* SUMMARY
Programmatically mark/paint objects for heap snapshot.

Great idea from Mark Lam! With Heap Snapshots, it would be very useful to programmatically mark objects.

Things that could be done when marking an individual object:

  - easily filter the snapshot for marked objects with the tag/label/color
    - fine grained control over tracking the objects the developer is most interested in
    - could allow Inspector to save memory for things like allocation tracking if we can fallback to only tracking marked objects
  - easily identify objects in the snapshot and anywhere else in Inspector if they are marked
  - debugger watchpoints for specific objects

One approach would be public properties on the object that the Inspector can use in its Heap Profile, similar to `displayName` used by JavaScript Profiles:

    let myView = new View(...);
    myView.inspectorMarker = label;

Another approach would be a console paint/mark function that puts private properties on the object that the Inspector can use/access:

    let myView = new View(...);
    console.mark(myView, {label, color, otherJsonData});

Or, like we've considered for documentation, a mix of public/private using a well known Symbol.

    let myView = new View(...);
    myView[console.mark] = label;
    // console.mark would be a built-in Symbol("console-mark")

* RELATED
<https://webkit.org/b/154407> Web Inspector: We should have a way to capture heap snapshots programatically.
<https://webkit.org/b/142658> Web Inspector: Show Documentation for Prototype Functions in Object Tree API view
Comment 1 Radar WebKit Bug Importer 2016-02-18 13:19:56 PST
<rdar://problem/24726885>