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 5from telemetry.core.heap import chrome_js_heap_snapshot_parser 6 7 8class Model(object): 9 """ The heap snapshot model is a set of LiveHeapObjects. The LiveHeapObjects 10 contain the RetainingEdge objects describing the relationships between the 11 LiveHeapObjects.""" 12 13 def __init__(self, raw_data): 14 if not chrome_js_heap_snapshot_parser.ChromeJsHeapSnapshotParser.CanImport( 15 raw_data): 16 raise ValueError("Cannot import snapshot data") 17 parser = chrome_js_heap_snapshot_parser.ChromeJsHeapSnapshotParser(raw_data) 18 self._all_live_heap_objects = parser.GetAllLiveHeapObjects() 19 20 @property 21 def all_live_heap_objects(self): 22 return self._all_live_heap_objects 23