lib/third_party/tracing/model/global_memory_dump.js
function(fn) {
      var visitedDumps = new WeakSet();

      function visit(dump) {
        if (visitedDumps.has(dump))
          return;

        // If this dumps owns another dump which hasn't been visited yet, then
        // wait for this dump to be visited later.
        if (dump.owns !== undefined && !visitedDumps.has(dump.owns.target))
          return;

        // If this dump's parent hasn't been visited yet, then wait for this
        // dump to be visited later.
        if (dump.parent !== undefined && !visitedDumps.has(dump.parent))
          return;

        // Actually visit the current memory allocator dump.
        fn.call(this, dump);
        visitedDumps.add(dump);

        // Visit owners after the dumps they own.
        dump.ownedBy.forEach(function(ownershipLink) {
          visit.call(this, ownershipLink.source);
        }, this);

        // Visit children after parents.
        dump.children.forEach(visit, this);
      }

      this.iterateAllRootAllocatorDumps(visit);
    }
function(fn) {
      var visitedDumps = new WeakSet();

      function visit(dump) {
        if (visitedDumps.has(dump))
          return;

        // If this dumps owns another dump which hasn't been visited yet, then
        // wait for this dump to be visited later.
        if (dump.owns !== undefined && !visitedDumps.has(dump.owns.target))
          return;

        // If this dump's parent hasn't been visited yet, then wait for this
        // dump to be visited later.
        if (dump.parent !== undefined && !visitedDumps.has(dump.parent))
          return;

        // Actually visit the current memory allocator dump.
        fn.call(this, dump);
        visitedDumps.add(dump);

        // Visit owners after the dumps they own.
        dump.ownedBy.forEach(function(ownershipLink) {
          visit.call(this, ownershipLink.source);
        }, this);

        // Visit children after parents.
        dump.children.forEach(visit, this);
      }

      this.iterateAllRootAllocatorDumps(visit);
    }
function ( fn ) { var visitedDumps = new WeakSet ( ) ; function visit ( dump ) { if ( visitedDumps . has ( dump ) ) return ; // If this dumps owns another dump which hasn't been visited yet, then // wait for this dump to be visited later. if ( dump . owns !== undefined && ! visitedDumps . has ( dump . owns . target ) ) return ; // If this dump's parent hasn't been visited yet, then wait for this // dump to be visited later. if ( dump . parent !== undefined && ! visitedDumps . has ( dump . parent ) ) return ; // Actually visit the current memory allocator dump. fn . call ( this , dump ) ; visitedDumps . add ( dump ) ; // Visit owners after the dumps they own. dump . ownedBy . forEach ( function ( ownershipLink ) { visit . call ( this , ownershipLink . source ) ; } , this ) ; // Visit children after parents. dump . children . forEach ( visit , this ) ; } this . iterateAllRootAllocatorDumps ( visit ) ; }
Traverse the memory dump graph in a depth first pre-order, i.e.
children and owners of a memory allocator dump are visited after the
dump itself. This method will not visit some dumps if the graph contains
a cycle.
Traverse the memory dump graph in a depth first pre - order i . e . children and owners of a memory allocator dump are visited after the dump itself . This method will not visit some dumps if the graph contains a cycle .