OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyrightdd | 8 * * Redistributions of source code must retain the above copyrightdd |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 this._checkLongRunningCalls(); | 150 this._checkLongRunningCalls(); |
151 this._interval = setInterval(this._checkLongRunningCalls.bind(this), 300); | 151 this._interval = setInterval(this._checkLongRunningCalls.bind(this), 300); |
152 } | 152 } |
153 | 153 |
154 _checkLongRunningCalls() { | 154 _checkLongRunningCalls() { |
155 for (var callId of this._previousCallbacks) { | 155 for (var callId of this._previousCallbacks) { |
156 if (!this._callbacks.has(callId)) | 156 if (!this._callbacks.has(callId)) |
157 this._previousCallbacks.delete(callId); | 157 this._previousCallbacks.delete(callId); |
158 } | 158 } |
159 var hasLongRunningCalls = !!this._previousCallbacks.size; | 159 var hasLongRunningCalls = !!this._previousCallbacks.size; |
160 this.dispatchEventToListeners('wait', hasLongRunningCalls); | 160 this.dispatchEventToListeners(Profiler.HeapSnapshotWorkerProxy.Events.Wait,
hasLongRunningCalls); |
161 for (var callId of this._callbacks.keysArray()) | 161 for (var callId of this._callbacks.keysArray()) |
162 this._previousCallbacks.add(callId); | 162 this._previousCallbacks.add(callId); |
163 } | 163 } |
164 | 164 |
165 /** | 165 /** |
166 * @param {!MessageEvent} event | 166 * @param {!MessageEvent} event |
167 */ | 167 */ |
168 _messageReceived(event) { | 168 _messageReceived(event) { |
169 var data = event.data; | 169 var data = event.data; |
170 if (data.eventName) { | 170 if (data.eventName) { |
(...skipping 15 matching lines...) Expand all Loading... |
186 var callback = this._callbacks.get(data.callId); | 186 var callback = this._callbacks.get(data.callId); |
187 this._callbacks.delete(data.callId); | 187 this._callbacks.delete(data.callId); |
188 callback(data.result); | 188 callback(data.result); |
189 } | 189 } |
190 | 190 |
191 _postMessage(message) { | 191 _postMessage(message) { |
192 this._worker.postMessage(message); | 192 this._worker.postMessage(message); |
193 } | 193 } |
194 }; | 194 }; |
195 | 195 |
| 196 Profiler.HeapSnapshotWorkerProxy.Events = { |
| 197 Wait: Symbol('Wait') |
| 198 }; |
| 199 |
196 /** | 200 /** |
197 * @unrestricted | 201 * @unrestricted |
198 */ | 202 */ |
199 Profiler.HeapSnapshotProxyObject = class { | 203 Profiler.HeapSnapshotProxyObject = class { |
200 /** | 204 /** |
201 * @param {!Profiler.HeapSnapshotWorkerProxy} worker | 205 * @param {!Profiler.HeapSnapshotWorkerProxy} worker |
202 * @param {number} objectId | 206 * @param {number} objectId |
203 */ | 207 */ |
204 constructor(worker, objectId) { | 208 constructor(worker, objectId) { |
205 this._worker = worker; | 209 this._worker = worker; |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 | 546 |
543 /** | 547 /** |
544 * @override | 548 * @override |
545 * @param {!Profiler.HeapSnapshotCommon.ComparatorConfig} comparator | 549 * @param {!Profiler.HeapSnapshotCommon.ComparatorConfig} comparator |
546 * @return {!Promise<?>} | 550 * @return {!Promise<?>} |
547 */ | 551 */ |
548 sortAndRewind(comparator) { | 552 sortAndRewind(comparator) { |
549 return this._callMethodPromise('sortAndRewind', comparator); | 553 return this._callMethodPromise('sortAndRewind', comparator); |
550 } | 554 } |
551 }; | 555 }; |
OLD | NEW |