| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 /** | 5 /** |
| 6 * @implements {UI.ContextMenu.Provider} | 6 * @implements {UI.ContextMenu.Provider} |
| 7 * @implements {UI.ActionDelegate} | 7 * @implements {UI.ActionDelegate} |
| 8 */ | 8 */ |
| 9 Profiler.HeapProfilerPanel = class extends Profiler.ProfilesPanel { | 9 Profiler.HeapProfilerPanel = class extends Profiler.ProfilesPanel { |
| 10 constructor() { | 10 constructor() { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * @param {!Object} target | 22 * @param {!Object} target |
| 23 */ | 23 */ |
| 24 appendApplicableItems(event, contextMenu, target) { | 24 appendApplicableItems(event, contextMenu, target) { |
| 25 if (!(target instanceof SDK.RemoteObject)) | 25 if (!(target instanceof SDK.RemoteObject)) |
| 26 return; | 26 return; |
| 27 | 27 |
| 28 if (!this.isShowing()) | 28 if (!this.isShowing()) |
| 29 return; | 29 return; |
| 30 | 30 |
| 31 var object = /** @type {!SDK.RemoteObject} */ (target); | 31 var object = /** @type {!SDK.RemoteObject} */ (target); |
| 32 var objectId = object.objectId; | 32 if (!object.objectId) |
| 33 if (!objectId) | |
| 34 return; | 33 return; |
| 34 var objectId = /** @type {string} */ (object.objectId); |
| 35 | 35 |
| 36 var heapProfiles = Profiler.ProfileTypeRegistry.instance.heapSnapshotProfile
Type.getProfiles(); | 36 var heapProfiles = Profiler.ProfileTypeRegistry.instance.heapSnapshotProfile
Type.getProfiles(); |
| 37 if (!heapProfiles.length) | 37 if (!heapProfiles.length) |
| 38 return; | 38 return; |
| 39 | 39 |
| 40 var heapProfilerModel = object.target().model(SDK.HeapProfilerModel); | 40 var heapProfilerModel = object.runtimeModel().heapProfilerModel(); |
| 41 if (!heapProfilerModel) | 41 if (!heapProfilerModel) |
| 42 return; | 42 return; |
| 43 | 43 |
| 44 /** | 44 /** |
| 45 * @param {string} viewName | 45 * @param {string} viewName |
| 46 * @this {Profiler.ProfilesPanel} | 46 * @this {Profiler.ProfilesPanel} |
| 47 */ | 47 */ |
| 48 function revealInView(viewName) { | 48 function revealInView(viewName) { |
| 49 heapProfilerModel.snapshotObjectIdForObjectId(objectId).then(result => { | 49 heapProfilerModel.snapshotObjectIdForObjectId(objectId).then(result => { |
| 50 if (this.isShowing() && result) | 50 if (this.isShowing() && result) |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // FIXME: allow to choose snapshot if there are several options. | 95 // FIXME: allow to choose snapshot if there are several options. |
| 96 if (profile.maxJSObjectId >= snapshotObjectId) { | 96 if (profile.maxJSObjectId >= snapshotObjectId) { |
| 97 this.showProfile(profile); | 97 this.showProfile(profile); |
| 98 var view = this.viewForProfile(profile); | 98 var view = this.viewForProfile(profile); |
| 99 view.selectLiveObject(perspectiveName, snapshotObjectId); | 99 view.selectLiveObject(perspectiveName, snapshotObjectId); |
| 100 break; | 100 break; |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 }; | 104 }; |
| OLD | NEW |