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.
This commit is contained in:
parent
d07357ce9a
commit
0b98043c1c
3 changed files with 2 additions and 6 deletions
|
@ -39483,8 +39483,6 @@ function generateKeys(count, progressCallback) {
|
||||||
throw new Error('Invalid signedKeyId');
|
throw new Error('Invalid signedKeyId');
|
||||||
}
|
}
|
||||||
|
|
||||||
textsecure.protocol_wrapper.startWorker();
|
|
||||||
|
|
||||||
var store = textsecure.storage.axolotl;
|
var store = textsecure.storage.axolotl;
|
||||||
return store.getMyIdentityKey().then(function(identityKey) {
|
return store.getMyIdentityKey().then(function(identityKey) {
|
||||||
var result = { preKeys: [], identityKey: identityKey.pubKey };
|
var result = { preKeys: [], identityKey: identityKey.pubKey };
|
||||||
|
@ -39518,7 +39516,6 @@ function generateKeys(count, progressCallback) {
|
||||||
textsecure.storage.put('maxPreKeyId', startId + count);
|
textsecure.storage.put('maxPreKeyId', startId + count);
|
||||||
textsecure.storage.put('signedKeyId', signedKeyId + 1);
|
textsecure.storage.put('signedKeyId', signedKeyId + 1);
|
||||||
return Promise.all(promises).then(function() {
|
return Promise.all(promises).then(function() {
|
||||||
textsecure.protocol_wrapper.stopWorker();
|
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
window.Whisper = window.Whisper || {};
|
window.Whisper = window.Whisper || {};
|
||||||
|
|
||||||
|
textsecure.protocol_wrapper.startWorker();
|
||||||
|
|
||||||
var windowMap = new Whisper.Bimap('windowId', 'modelId');
|
var windowMap = new Whisper.Bimap('windowId', 'modelId');
|
||||||
var conversations = new Whisper.ConversationCollection();
|
var conversations = new Whisper.ConversationCollection();
|
||||||
|
|
||||||
|
|
|
@ -134,8 +134,6 @@ function generateKeys(count, progressCallback) {
|
||||||
throw new Error('Invalid signedKeyId');
|
throw new Error('Invalid signedKeyId');
|
||||||
}
|
}
|
||||||
|
|
||||||
textsecure.protocol_wrapper.startWorker();
|
|
||||||
|
|
||||||
var store = textsecure.storage.axolotl;
|
var store = textsecure.storage.axolotl;
|
||||||
return store.getMyIdentityKey().then(function(identityKey) {
|
return store.getMyIdentityKey().then(function(identityKey) {
|
||||||
var result = { preKeys: [], identityKey: identityKey.pubKey };
|
var result = { preKeys: [], identityKey: identityKey.pubKey };
|
||||||
|
@ -169,7 +167,6 @@ function generateKeys(count, progressCallback) {
|
||||||
textsecure.storage.put('maxPreKeyId', startId + count);
|
textsecure.storage.put('maxPreKeyId', startId + count);
|
||||||
textsecure.storage.put('signedKeyId', signedKeyId + 1);
|
textsecure.storage.put('signedKeyId', signedKeyId + 1);
|
||||||
return Promise.all(promises).then(function() {
|
return Promise.all(promises).then(function() {
|
||||||
textsecure.protocol_wrapper.stopWorker();
|
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue