OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 from telemetry.core.heap import chrome_js_heap_snapshot_parser | 5 from telemetry.core.heap import chrome_js_heap_snapshot_parser |
6 | 6 |
| 7 |
7 class Model(object): | 8 class Model(object): |
8 """ The heap snapshot model is a set of LiveHeapObjects. The LiveHeapObjects | 9 """ The heap snapshot model is a set of LiveHeapObjects. The LiveHeapObjects |
9 contain the RetainingEdge objects describing the relationships between the | 10 contain the RetainingEdge objects describing the relationships between the |
10 LiveHeapObjects.""" | 11 LiveHeapObjects.""" |
11 | 12 |
12 def __init__(self, raw_data): | 13 def __init__(self, raw_data): |
13 if not chrome_js_heap_snapshot_parser.ChromeJsHeapSnapshotParser.CanImport( | 14 if not chrome_js_heap_snapshot_parser.ChromeJsHeapSnapshotParser.CanImport( |
14 raw_data): | 15 raw_data): |
15 raise ValueError("Cannot import snapshot data") | 16 raise ValueError("Cannot import snapshot data") |
16 parser = chrome_js_heap_snapshot_parser.ChromeJsHeapSnapshotParser(raw_data) | 17 parser = chrome_js_heap_snapshot_parser.ChromeJsHeapSnapshotParser(raw_data) |
17 self._all_live_heap_objects = parser.GetAllLiveHeapObjects() | 18 self._all_live_heap_objects = parser.GetAllLiveHeapObjects() |
18 | 19 |
19 @property | 20 @property |
20 def all_live_heap_objects(self): | 21 def all_live_heap_objects(self): |
21 return self._all_live_heap_objects | 22 return self._all_live_heap_objects |
OLD | NEW |