1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 class RetainingEdge(object):
6 """Data structure for representing a retainer relationship between objects.
9 from_object_id: int, id of the object which is the start point of this
10 RetainingEdge. Used when the corresponding LiveHeapObject object is not
12 to_object_id: int, id of the object which is the end point of this
13 RetainingEdge. Used when the corresponding LiveHeapObject object is not
15 from_object: LiveHeapObject, the start point of this RetainingEdge.
16 to_object: LiveHeapObject, the end point of this RetainingEdge.
17 type_string: str, the type of the RetainingEdge.
18 name_string: str, the JavaScript attribute name this RetainingEdge
22 def __init__(self, from_object_id, to_object_id, type_string, name_string):
23 """Initializes the RetainingEdge object.
26 from_object_id: int, id of the object which is the start point of this
27 RetainingEdge. Used when the corresponding LiveHeapObject object is
29 to_object_id: int, id of the object which is the end point of this
30 RetainingEdge. Used when the corresponding LiveHeapObject object is
32 type_string: str, the type of the RetainingEdge.
33 name_string: str, the JavaScript attribute name this RetainingEdge
36 self.from_object_id = from_object_id
37 self.to_object_id = to_object_id
40 self.type_string = type_string
41 self.name_string = name_string
43 def SetFromObject(self, obj):
44 self.from_object = obj
47 def SetToObject(self, obj):
52 return 'RetainingEdge(' + self.type_string + ' ' + self.name_string + ')'