Optimizations to the performance improvement changes

This commit is contained in:
Josh Perez 2021-03-09 14:11:52 -05:00 committed by Josh Perez
parent cee8207e72
commit 468d491d34
7 changed files with 109 additions and 11 deletions

View file

@ -124,6 +124,8 @@ class MessageReceiverInner extends EventTarget {
count: number;
processedCount: number;
deviceId?: number;
hasConnected?: boolean;
@ -170,6 +172,7 @@ class MessageReceiverInner extends EventTarget {
super();
this.count = 0;
this.processedCount = 0;
this.signalingKey = signalingKey;
this.username = oldUsername;
@ -784,6 +787,7 @@ class MessageReceiverInner extends EventTarget {
removeFromCache(envelope: EnvelopeClass) {
const { id } = envelope;
this.cacheRemoveBatcher.add(id);
this.processedCount += 1;
}
// Same as handleEnvelope, just without the decryption step. Necessary for handling
@ -2396,6 +2400,7 @@ export default class MessageReceiver {
this.cleanupSessionResets = inner.cleanupSessionResets.bind(inner);
inner.connect();
this.getProcessedCount = () => inner.processedCount;
}
addEventListener: (name: string, handler: Function) => void;
@ -2420,6 +2425,8 @@ export default class MessageReceiver {
cleanupSessionResets: () => void;
getProcessedCount: () => number;
static stringToArrayBuffer = MessageReceiverInner.stringToArrayBuffer;
static arrayBufferToString = MessageReceiverInner.arrayBufferToString;