Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Unified Diff: tools/telemetry/telemetry/core/heap/retaining_edge.py

Issue 24076016: Add JS heap snapshotting functionality to Telemetry (part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review (nduca) Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/core/heap/retaining_edge.py
diff --git a/tools/telemetry/telemetry/core/heap/retaining_edge.py b/tools/telemetry/telemetry/core/heap/retaining_edge.py
new file mode 100644
index 0000000000000000000000000000000000000000..d6b9978ce6a12a5d4f287459b665cd42f10d7ab1
--- /dev/null
+++ b/tools/telemetry/telemetry/core/heap/retaining_edge.py
@@ -0,0 +1,52 @@
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+class RetainingEdge(object):
+ """Data structure for representing a retainer relationship between objects.
+
+ Attributes:
+ from_object_id: int, id of the object which is the start point of this
+ RetainingEdge. Used when the corresponding LiveHeapObject object is not
+ yet contstructed.
+ to_object_id: int, id of the object which is the end point of this
+ RetainingEdge. Used when the corresponding LiveHeapObject object is not
+ yet contstructed.
+ from_object: LiveHeapObject, the start point of this RetainingEdge.
+ to_object: LiveHeapObject, the end point of this RetainingEdge.
+ type_string: str, the type of the RetainingEdge.
+ name_string: str, the JavaScript attribute name this RetainingEdge
+ represents.
+ """
+
+ def __init__(self, from_object_id, to_object_id, type_string, name_string):
+ """Initializes the RetainingEdge object.
+
+ Args:
+ from_object_id: int, id of the object which is the start point of this
+ RetainingEdge. Used when the corresponding LiveHeapObject object is
+ not yet contstructed.
+ to_object_id: int, id of the object which is the end point of this
+ RetainingEdge. Used when the corresponding LiveHeapObject object is
+ not yet contstructed.
+ type_string: str, the type of the RetainingEdge.
+ name_string: str, the JavaScript attribute name this RetainingEdge
+ represents.
+ """
+ self.from_object_id = from_object_id
+ self.to_object_id = to_object_id
+ self.from_object = {}
+ self.to_object = {}
+ self.type_string = type_string
+ self.name_string = name_string
+
+ def SetFromObject(self, obj):
+ self.from_object = obj
+ return self
+
+ def SetToObject(self, obj):
+ self.to_object = obj
+ return self
+
+ def __str__(self):
+ return 'RetainingEdge(' + self.type_string + ' ' + self.name_string + ')'

Powered by Google App Engine
This is Rietveld 408576698