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(Profiler.HeapSnapshotWorkerProxy.Events.Wait,
hasLongRunningCalls); | 160 this.dispatchEventToListeners('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 | |
200 /** | 196 /** |
201 * @unrestricted | 197 * @unrestricted |
202 */ | 198 */ |
203 Profiler.HeapSnapshotProxyObject = class { | 199 Profiler.HeapSnapshotProxyObject = class { |
204 /** | 200 /** |
205 * @param {!Profiler.HeapSnapshotWorkerProxy} worker | 201 * @param {!Profiler.HeapSnapshotWorkerProxy} worker |
206 * @param {number} objectId | 202 * @param {number} objectId |
207 */ | 203 */ |
208 constructor(worker, objectId) { | 204 constructor(worker, objectId) { |
209 this._worker = worker; | 205 this._worker = worker; |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 | 542 |
547 /** | 543 /** |
548 * @override | 544 * @override |
549 * @param {!Profiler.HeapSnapshotCommon.ComparatorConfig} comparator | 545 * @param {!Profiler.HeapSnapshotCommon.ComparatorConfig} comparator |
550 * @return {!Promise<?>} | 546 * @return {!Promise<?>} |
551 */ | 547 */ |
552 sortAndRewind(comparator) { | 548 sortAndRewind(comparator) { |
553 return this._callMethodPromise('sortAndRewind', comparator); | 549 return this._callMethodPromise('sortAndRewind', comparator); |
554 } | 550 } |
555 }; | 551 }; |
OLD | NEW |