OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 class RetainingEdge(object): |
| 6 """Data structure for representing a retainer relationship between objects. |
| 7 |
| 8 Attributes: |
| 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 |
| 11 yet contstructed. |
| 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 |
| 14 yet contstructed. |
| 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 |
| 19 represents. |
| 20 """ |
| 21 |
| 22 def __init__(self, from_object_id, to_object_id, type_string, name_string): |
| 23 """Initializes the RetainingEdge object. |
| 24 |
| 25 Args: |
| 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 |
| 28 not yet contstructed. |
| 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 |
| 31 not yet contstructed. |
| 32 type_string: str, the type of the RetainingEdge. |
| 33 name_string: str, the JavaScript attribute name this RetainingEdge |
| 34 represents. |
| 35 """ |
| 36 self.from_object_id = from_object_id |
| 37 self.to_object_id = to_object_id |
| 38 self.from_object = {} |
| 39 self.to_object = {} |
| 40 self.type_string = type_string |
| 41 self.name_string = name_string |
| 42 |
| 43 def SetFromObject(self, obj): |
| 44 self.from_object = obj |
| 45 return self |
| 46 |
| 47 def SetToObject(self, obj): |
| 48 self.to_object = obj |
| 49 return self |
| 50 |
| 51 def __str__(self): |
| 52 return 'RetainingEdge(' + self.type_string + ' ' + self.name_string + ')' |
OLD | NEW |