| Index: third_party/WebKit/Source/devtools/front_end/common/FormatterWorkerPool.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/common/FormatterWorkerPool.js b/third_party/WebKit/Source/devtools/front_end/common/FormatterWorkerPool.js
|
| index 31a2ec5956b7337ac6926012fc2894f2e56f4eaa..3e3ed6801d3a04d0187618438f130e4f73231504 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/common/FormatterWorkerPool.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/common/FormatterWorkerPool.js
|
| @@ -4,18 +4,18 @@
|
| /**
|
| * @unrestricted
|
| */
|
| -WebInspector.FormatterWorkerPool = class {
|
| +Common.FormatterWorkerPool = class {
|
| constructor() {
|
| this._taskQueue = [];
|
| - /** @type {!Map<!WebInspector.Worker, ?WebInspector.FormatterWorkerPool.Task>} */
|
| + /** @type {!Map<!Common.Worker, ?Common.FormatterWorkerPool.Task>} */
|
| this._workerTasks = new Map();
|
| }
|
|
|
| /**
|
| - * @return {!WebInspector.Worker}
|
| + * @return {!Common.Worker}
|
| */
|
| _createWorker() {
|
| - var worker = new WebInspector.Worker('formatter_worker');
|
| + var worker = new Common.Worker('formatter_worker');
|
| worker.onmessage = this._onWorkerMessage.bind(this, worker);
|
| worker.onerror = this._onWorkerError.bind(this, worker);
|
| return worker;
|
| @@ -26,7 +26,7 @@ WebInspector.FormatterWorkerPool = class {
|
| return;
|
|
|
| var freeWorker = this._workerTasks.keysArray().find(worker => !this._workerTasks.get(worker));
|
| - if (!freeWorker && this._workerTasks.size < WebInspector.FormatterWorkerPool.MaxWorkers)
|
| + if (!freeWorker && this._workerTasks.size < Common.FormatterWorkerPool.MaxWorkers)
|
| freeWorker = this._createWorker();
|
| if (!freeWorker)
|
| return;
|
| @@ -37,7 +37,7 @@ WebInspector.FormatterWorkerPool = class {
|
| }
|
|
|
| /**
|
| - * @param {!WebInspector.Worker} worker
|
| + * @param {!Common.Worker} worker
|
| * @param {!MessageEvent} event
|
| */
|
| _onWorkerMessage(worker, event) {
|
| @@ -53,7 +53,7 @@ WebInspector.FormatterWorkerPool = class {
|
| }
|
|
|
| /**
|
| - * @param {!WebInspector.Worker} worker
|
| + * @param {!Common.Worker} worker
|
| * @param {!Event} event
|
| */
|
| _onWorkerError(worker, event) {
|
| @@ -74,7 +74,7 @@ WebInspector.FormatterWorkerPool = class {
|
| * @param {function(?MessageEvent)} callback
|
| */
|
| runChunkedTask(methodName, params, callback) {
|
| - var task = new WebInspector.FormatterWorkerPool.Task(methodName, params, callback, true);
|
| + var task = new Common.FormatterWorkerPool.Task(methodName, params, callback, true);
|
| this._taskQueue.push(task);
|
| this._processNextTask();
|
| }
|
| @@ -87,19 +87,19 @@ WebInspector.FormatterWorkerPool = class {
|
| runTask(methodName, params) {
|
| var callback;
|
| var promise = new Promise(fulfill => callback = fulfill);
|
| - var task = new WebInspector.FormatterWorkerPool.Task(methodName, params, callback, false);
|
| + var task = new Common.FormatterWorkerPool.Task(methodName, params, callback, false);
|
| this._taskQueue.push(task);
|
| this._processNextTask();
|
| return promise;
|
| }
|
| };
|
|
|
| -WebInspector.FormatterWorkerPool.MaxWorkers = 2;
|
| +Common.FormatterWorkerPool.MaxWorkers = 2;
|
|
|
| /**
|
| * @unrestricted
|
| */
|
| -WebInspector.FormatterWorkerPool.Task = class {
|
| +Common.FormatterWorkerPool.Task = class {
|
| /**
|
| * @param {string} method
|
| * @param {!Object<string, string>} params
|
| @@ -114,5 +114,5 @@ WebInspector.FormatterWorkerPool.Task = class {
|
| }
|
| };
|
|
|
| -/** @type {!WebInspector.FormatterWorkerPool} */
|
| -WebInspector.formatterWorkerPool;
|
| +/** @type {!Common.FormatterWorkerPool} */
|
| +Common.formatterWorkerPool;
|
|
|