Update electron to 17.3.0

This commit is contained in:
Fedor Indutny 2022-03-29 10:06:42 -07:00 committed by GitHub
parent 8b36e37d18
commit f7c3a44056
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 87 deletions

View file

@ -4,13 +4,13 @@
import { join } from 'path';
import { Worker } from 'worker_threads';
import { format } from 'util';
import { app } from 'electron';
import { strictAssert } from '../util/assert';
import { explodePromise } from '../util/explodePromise';
import type { LoggerType } from '../types/Logging';
import { isCorruptionError } from './errors';
const ASAR_PATTERN = /app\.asar$/;
const MIN_TRACE_DURATION = 40;
export type InitializeOptions = Readonly<{
@ -85,18 +85,8 @@ export class MainSQL {
private onResponse = new Map<number, PromisePair<any>>();
constructor() {
let appDir = join(__dirname, '..', '..');
let isBundled = false;
if (ASAR_PATTERN.test(appDir)) {
appDir = appDir.replace(ASAR_PATTERN, 'app.asar.unpacked');
isBundled = true;
}
const scriptDir = join(appDir, 'ts', 'sql');
this.worker = new Worker(
join(scriptDir, isBundled ? 'mainWorker.bundle.js' : 'mainWorker.js')
);
const scriptDir = join(app.getAppPath(), 'ts', 'sql', 'mainWorker.js');
this.worker = new Worker(scriptDir);
const { promise: onCorruption, resolve: resolveCorruption } =
explodePromise<Error>();

View file

@ -1,13 +0,0 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
// This is a shim that gets inserted in place of `bindings` npm module when
// building sql worker bundle.
module.exports = (binding: string) => {
if (binding === 'better_sqlite3.node') {
// eslint-disable-next-line global-require, import/no-unresolved
return require('better_sqlite3.node');
}
throw new Error(`Unknown binding ${binding}`);
};

View file

@ -3,6 +3,7 @@
import { join } from 'path';
import { Worker } from 'worker_threads';
import { app } from 'electron';
export type WrappedWorkerRequest = {
readonly uuid: string;
@ -15,25 +16,17 @@ export type WrappedWorkerResponse = {
readonly response?: File;
};
const ASAR_PATTERN = /app\.asar$/;
export function getHeicConverter(): (
uuid: string,
data: Uint8Array
) => Promise<WrappedWorkerResponse> {
let appDir = join(__dirname, '..', '..');
let isBundled = false;
if (ASAR_PATTERN.test(appDir)) {
appDir = appDir.replace(ASAR_PATTERN, 'app.asar.unpacked');
isBundled = true;
}
const scriptDir = join(appDir, 'ts', 'workers');
const worker = new Worker(
join(
scriptDir,
isBundled ? 'heicConverter.bundle.js' : 'heicConverterWorker.js'
)
const scriptDir = join(
app.getAppPath(),
'ts',
'workers',
'heicConverterWorker.js'
);
const worker = new Worker(scriptDir);
const ResponseMap = new Map<
string,