From 0b98043c1ce45682db1ce6853e23f0811dd93ff2 Mon Sep 17 00:00:00 2001 From: lilia Date: Wed, 26 Aug 2015 16:07:44 -0700 Subject: [PATCH] Add a worker Offload all the asm.js code to a second thread. This is usually the source of intermittent frontend freezes when running single-threaded. --- js/libtextsecure.js | 3 --- js/panel_controller.js | 2 ++ libtextsecure/account_manager.js | 3 --- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/js/libtextsecure.js b/js/libtextsecure.js index 79cd43a4e..8fa14a00d 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -39483,8 +39483,6 @@ function generateKeys(count, progressCallback) { throw new Error('Invalid signedKeyId'); } - textsecure.protocol_wrapper.startWorker(); - var store = textsecure.storage.axolotl; return store.getMyIdentityKey().then(function(identityKey) { var result = { preKeys: [], identityKey: identityKey.pubKey }; @@ -39518,7 +39516,6 @@ function generateKeys(count, progressCallback) { textsecure.storage.put('maxPreKeyId', startId + count); textsecure.storage.put('signedKeyId', signedKeyId + 1); return Promise.all(promises).then(function() { - textsecure.protocol_wrapper.stopWorker(); return result; }); }); diff --git a/js/panel_controller.js b/js/panel_controller.js index 582762be5..aefc3a0a2 100644 --- a/js/panel_controller.js +++ b/js/panel_controller.js @@ -22,6 +22,8 @@ window.Whisper = window.Whisper || {}; + textsecure.protocol_wrapper.startWorker(); + var windowMap = new Whisper.Bimap('windowId', 'modelId'); var conversations = new Whisper.ConversationCollection(); diff --git a/libtextsecure/account_manager.js b/libtextsecure/account_manager.js index 5d414ba4d..f499cd680 100644 --- a/libtextsecure/account_manager.js +++ b/libtextsecure/account_manager.js @@ -134,8 +134,6 @@ function generateKeys(count, progressCallback) { throw new Error('Invalid signedKeyId'); } - textsecure.protocol_wrapper.startWorker(); - var store = textsecure.storage.axolotl; return store.getMyIdentityKey().then(function(identityKey) { var result = { preKeys: [], identityKey: identityKey.pubKey }; @@ -169,7 +167,6 @@ function generateKeys(count, progressCallback) { textsecure.storage.put('maxPreKeyId', startId + count); textsecure.storage.put('signedKeyId', signedKeyId + 1); return Promise.all(promises).then(function() { - textsecure.protocol_wrapper.stopWorker(); return result; }); });