OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 * @constructor | 6 * @constructor |
7 */ | 7 */ |
8 WebInspector.FormatterWorkerPool = function() | 8 WebInspector.FormatterWorkerPool = function() |
9 { | 9 { |
10 this._taskQueue = []; | 10 this._taskQueue = []; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 _onWorkerMessage: function(worker, event) | 52 _onWorkerMessage: function(worker, event) |
53 { | 53 { |
54 var task = this._workerTasks.get(worker); | 54 var task = this._workerTasks.get(worker); |
55 if (task.isChunked && event.data && !event.data["isLastChunk"]) { | 55 if (task.isChunked && event.data && !event.data["isLastChunk"]) { |
56 task.callback(event); | 56 task.callback(event); |
57 return; | 57 return; |
58 } | 58 } |
59 | 59 |
60 this._workerTasks.set(worker, null); | 60 this._workerTasks.set(worker, null); |
61 this._processNextTask(); | 61 this._processNextTask(); |
62 task.callback(event); | 62 task.callback(event.data ? event : null); |
63 }, | 63 }, |
64 | 64 |
65 /** | 65 /** |
66 * @param {!WebInspector.Worker} worker | 66 * @param {!WebInspector.Worker} worker |
67 * @param {!Event} event | 67 * @param {!Event} event |
68 */ | 68 */ |
69 _onWorkerError: function(worker, event) | 69 _onWorkerError: function(worker, event) |
70 { | 70 { |
71 console.error(event); | 71 console.error(event); |
72 var task = this._workerTasks.get(worker); | 72 var task = this._workerTasks.get(worker); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 WebInspector.FormatterWorkerPool.Task = function(method, params, callback, isChu
nked) | 117 WebInspector.FormatterWorkerPool.Task = function(method, params, callback, isChu
nked) |
118 { | 118 { |
119 this.method = method; | 119 this.method = method; |
120 this.params = params; | 120 this.params = params; |
121 this.callback = callback; | 121 this.callback = callback; |
122 this.isChunked = isChunked; | 122 this.isChunked = isChunked; |
123 } | 123 } |
124 | 124 |
125 /** @type {!WebInspector.FormatterWorkerPool} */ | 125 /** @type {!WebInspector.FormatterWorkerPool} */ |
126 WebInspector.formatterWorkerPool; | 126 WebInspector.formatterWorkerPool; |
OLD | NEW |