interest and keyword workers in WorkerFactory
This commit is contained in:
Родитель
1fab4fc189
Коммит
6b19e08706
|
@ -87,7 +87,7 @@ WorkerFactory.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
_setupWorker: function(modelName) {
|
||||
_setupInterestsWorker: function(modelName) {
|
||||
let scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader);
|
||||
scriptLoader.loadSubScript(data.url("models/" + this._localeCode + "/" + modelName + "/domainRules.json"));
|
||||
scriptLoader.loadSubScript(data.url("models/" + this._localeCode + "/" + modelName + "/textModel.json"));
|
||||
|
@ -117,7 +117,29 @@ WorkerFactory.prototype = {
|
|||
let workers = [];
|
||||
let {modelNames} = this._localeData;
|
||||
modelNames.forEach(modelName => {
|
||||
workers.push(this._setupWorker(modelName));
|
||||
workers.push(this._setupInterestsWorker(modelName));
|
||||
});
|
||||
return workers;
|
||||
},
|
||||
|
||||
_setupKeywordsWorker: function(modelName) {
|
||||
let scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader);
|
||||
scriptLoader.loadSubScript(data.url("models/urlStopwords.json"));
|
||||
|
||||
let worker = new ChromeWorker(data.url("interests/keywordsWorker.js"));
|
||||
worker.postMessage({
|
||||
message: "bootstrap",
|
||||
workerRegionCode: this._localeCode,
|
||||
urlStopwordSet: interestsUrlStopwords
|
||||
});
|
||||
return worker;
|
||||
},
|
||||
|
||||
getKeywordsWorkers: function() {
|
||||
let workers = [];
|
||||
let {modelNames} = this._localeData;
|
||||
modelNames.forEach(modelName => {
|
||||
workers.push(this._setupKeywordsWorker(modelName));
|
||||
});
|
||||
return workers;
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче