Skip to content

Commit

Permalink
Share a single blob URL between all workers
Browse files Browse the repository at this point in the history
  • Loading branch information
jfirebaugh committed Sep 22, 2016
1 parent 56e9761 commit f693ec1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 4 additions & 1 deletion js/util/browser/web_worker.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
'use strict';

var WebWorkify = require('webworkify');
var window = require('../window');
var workerURL = window.URL.createObjectURL(new WebWorkify(require('../../source/worker'), {bare: true}));

module.exports = function () {
return new WebWorkify(require('../../source/worker'));
return new window.Worker(workerURL);
};
2 changes: 0 additions & 2 deletions js/util/worker_pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

var assert = require('assert');
var WebWorker = require('./web_worker');
var URL = require('./window').URL;

module.exports = WorkerPool;

Expand Down Expand Up @@ -37,7 +36,6 @@ WorkerPool.prototype = {
delete this.active[mapId];
if (Object.keys(this.active).length === 0) {
this.workers.forEach(function (w) {
URL.revokeObjectURL(w.objectURL);
w.terminate();
});
this.workers = null;
Expand Down

0 comments on commit f693ec1

Please sign in to comment.