Changeset 117241 in webkit
- Timestamp:
- May 16, 2012 2:26:19 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r117238 r117241 1 2012-05-16 Yury Semikhatsky <yurys@chromium.org> 2 3 Web Inspector: exception when switching to heap profiler comparison view 4 https://bugs.webkit.org/show_bug.cgi?id=86224 5 6 Reviewed by Pavel Feldman. 7 8 Make sure the messages are dispatched in the same order as they are sent in 9 case a fake worker is used for heap snapshot processing. 10 11 * inspector/front-end/HeapSnapshotProxy.js: 12 (WebInspector.AsyncTaskQueue): 13 (WebInspector.AsyncTaskQueue.prototype.addTask): 14 (WebInspector.AsyncTaskQueue.prototype._onTimeout): 15 (WebInspector.AsyncTaskQueue.prototype._scheduleTimer): 16 (WebInspector.HeapSnapshotFakeWorker): 17 (WebInspector.HeapSnapshotFakeWorker.prototype.postMessage): 18 (WebInspector.HeapSnapshotFakeWorker.prototype._postMessageFromWorker): 19 1 20 2012-05-16 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> 2 21 -
trunk/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js
r117234 r117241 79 79 /** 80 80 * @constructor 81 */ 82 WebInspector.AsyncTaskQueue = function() 83 { 84 this._queue = []; 85 this._isTimerSheduled = false; 86 } 87 88 WebInspector.AsyncTaskQueue.prototype = { 89 /** 90 * @param {function()} task 91 */ 92 addTask: function(task) 93 { 94 this._queue.push(task); 95 this._scheduleTimer(); 96 }, 97 98 _onTimeout: function() 99 { 100 this._isTimerSheduled = false; 101 var queue = this._queue; 102 this._queue = []; 103 for (var i = 0; i < queue.length; i++) { 104 try { 105 queue[i](); 106 } catch (e) { 107 console.error("Exception while running task: " + e.stack); 108 } 109 } 110 this._scheduleTimer(); 111 }, 112 113 _scheduleTimer: function() 114 { 115 if (this._queue.length && !this._isTimerSheduled) { 116 setTimeout(this._onTimeout.bind(this), 0); 117 this._isTimerSheduled = true; 118 } 119 } 120 } 121 122 /** 123 * @constructor 81 124 * @extends {WebInspector.HeapSnapshotWorkerWrapper} 82 125 */ … … 84 127 { 85 128 this._dispatcher = new WebInspector.HeapSnapshotWorkerDispatcher(window, this._postMessageFromWorker.bind(this)); 129 this._asyncTaskQueue = new WebInspector.AsyncTaskQueue(); 86 130 } 87 131 … … 94 138 this._dispatcher.dispatchMessage({data: message}); 95 139 } 96 setTimeout(dispatch.bind(this), 0);140 this._asyncTaskQueue.addTask(dispatch.bind(this)); 97 141 }, 98 142 … … 108 152 this.dispatchEventToListeners("message", message); 109 153 } 110 setTimeout(send.bind(this), 0);154 this._asyncTaskQueue.addTask(send.bind(this)); 111 155 } 112 156 };
Note: See TracChangeset
for help on using the changeset viewer.