| Index: tools/telemetry/telemetry/core/backends/chrome/inspector_backend.py
|
| diff --git a/tools/telemetry/telemetry/core/backends/chrome/inspector_backend.py b/tools/telemetry/telemetry/core/backends/chrome/inspector_backend.py
|
| index 1e64311f10008f1763d2c1f4d84c939bfaa0055b..d68c60a2c13b41826c49d8e4c9f6e3deec05171a 100644
|
| --- a/tools/telemetry/telemetry/core/backends/chrome/inspector_backend.py
|
| +++ b/tools/telemetry/telemetry/core/backends/chrome/inspector_backend.py
|
| @@ -322,15 +322,10 @@ class InspectorBackend(object):
|
| self._page.CollectGarbage()
|
|
|
| def TakeJSHeapSnapshot(self, timeout=120):
|
| - # This is a hack to make the nested function be able to modify the
|
| - # variables.
|
| - snapshot_uid = [0]
|
| snapshot = []
|
|
|
| def OnNotification(res):
|
| - if res['method'] == 'HeapProfiler.addProfileHeader':
|
| - snapshot_uid[0] = res['params']['header']['uid']
|
| - elif res['method'] == 'HeapProfiler.addHeapSnapshotChunk':
|
| + if res['method'] == 'HeapProfiler.addHeapSnapshotChunk':
|
| snapshot.append(res['params']['chunk'])
|
|
|
| def OnClose():
|
| @@ -340,10 +335,7 @@ class InspectorBackend(object):
|
|
|
| self.SyncRequest({'method': 'Page.getResourceTree'}, timeout)
|
| self.SyncRequest({'method': 'Debugger.enable'}, timeout)
|
| - self.SyncRequest({'method': 'HeapProfiler.clearProfiles'}, timeout)
|
| self.SyncRequest({'method': 'HeapProfiler.takeHeapSnapshot'}, timeout)
|
| - self.SyncRequest({'method': 'HeapProfiler.getHeapSnapshot',
|
| - 'params': {'uid': snapshot_uid[0]}}, timeout)
|
| snapshot = ''.join(snapshot)
|
|
|
| self.UnregisterDomain('HeapProfiler')
|
|
|