提交 19c85f88 编写于 作者: J Johannes Rieken

for rapid render data use a file, not storage, #68395

上级 2eb40a88
......@@ -56,10 +56,12 @@ function showPartsSplash(configuration) {
perf.mark('willShowPartsSplash');
let data;
try {
data = JSON.parse(configuration.partsSplashData);
} catch (e) {
// ignore
if (typeof configuration.partsSplashPath === 'string') {
try {
data = JSON.parse(require('fs').readFileSync(configuration.partsSplashPath, 'utf8'));
} catch (e) {
// ignore
}
}
// high contrast mode has been turned on from the outside, e.g OS -> ignore stored colors and layouts
......
......@@ -24,7 +24,6 @@ import { ISerializableCommandAction } from 'vs/platform/actions/common/actions';
import * as perf from 'vs/base/common/performance';
import { resolveMarketplaceHeaders } from 'vs/platform/extensionManagement/node/extensionGalleryService';
import { getBackgroundColor } from 'vs/code/electron-main/theme';
import { IStorageMainService } from 'vs/platform/storage/node/storageMainService';
import { RunOnceScheduler } from 'vs/base/common/async';
export interface IWindowCreationOptions {
......@@ -87,7 +86,6 @@ export class CodeWindow extends Disposable implements ICodeWindow {
@IStateService private readonly stateService: IStateService,
@IWorkspacesMainService private readonly workspacesMainService: IWorkspacesMainService,
@IBackupMainService private readonly backupMainService: IBackupMainService,
@IStorageMainService private readonly storageMainService: IStorageMainService
) {
super();
......@@ -590,7 +588,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
windowConfiguration.perfEntries = perf.exportEntries();
// Parts splash
windowConfiguration.partsSplashData = this.storageMainService.get('parts-splash-data', undefined);
windowConfiguration.partsSplashPath = path.join(this.environmentService.userDataPath, 'rapid_render.json');
// Config (combination of process.argv and window configuration)
const environment = parseArgs(process.argv);
......
......@@ -395,7 +395,7 @@ export interface IWindowConfiguration extends ParsedArgs {
highContrast?: boolean;
frameless?: boolean;
accessibilitySupport?: boolean;
partsSplashData?: string;
partsSplashPath?: string;
perfStartTime?: number;
perfAppReady?: number;
......
......@@ -11,7 +11,6 @@ import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import { IBroadcastService } from 'vs/workbench/services/broadcast/electron-browser/broadcastService';
import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { Registry } from 'vs/platform/registry/common/platform';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { ColorIdentifier, editorBackground, foreground } from 'vs/platform/theme/common/colorRegistry';
import { getThemeTypeSelector, IThemeService } from 'vs/platform/theme/common/themeService';
import { DEFAULT_EDITOR_MIN_DIMENSIONS } from 'vs/workbench/browser/parts/editor/editor';
......@@ -19,6 +18,9 @@ import { Extensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common
import * as themes from 'vs/workbench/common/theme';
import { IPartService, Parts, Position } from 'vs/workbench/services/part/common/partService';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IFileService } from 'vs/platform/files/common/files';
import { URI } from 'vs/base/common/uri';
import { join } from 'vs/base/common/paths';
class PartsSplash {
......@@ -32,10 +34,10 @@ class PartsSplash {
constructor(
@IThemeService private readonly _themeService: IThemeService,
@IPartService private readonly _partService: IPartService,
@IStorageService private readonly _storageService: IStorageService,
@IFileService private readonly _fileService: IFileService,
@IEnvironmentService private readonly _envService: IEnvironmentService,
@IBroadcastService private readonly _broadcastService: IBroadcastService,
@ILifecycleService lifecycleService: ILifecycleService,
@IBroadcastService private readonly broadcastService: IBroadcastService
) {
lifecycleService.when(LifecyclePhase.Restored).then(_ => this._removePartsSplash());
Event.debounce(Event.any<any>(
......@@ -67,12 +69,16 @@ class PartsSplash {
sideBarWidth: getTotalWidth(this._partService.getContainer(Parts.SIDEBAR_PART)!),
statusBarHeight: getTotalHeight(this._partService.getContainer(Parts.STATUSBAR_PART)!),
};
this._storageService.store('parts-splash-data', JSON.stringify({
id: PartsSplash._splashElementId,
colorInfo,
layoutInfo,
baseTheme
}), StorageScope.GLOBAL);
this._fileService.updateContent(
URI.file(join(this._envService.userDataPath, 'rapid_render.json')),
JSON.stringify({
id: PartsSplash._splashElementId,
colorInfo,
layoutInfo,
baseTheme
}),
{ encoding: 'utf8' }
);
if (baseTheme !== this._lastBaseTheme || colorInfo.editorBackground !== this._lastBackground) {
// notify the main window on background color changes: the main window sets the background color to new windows
......@@ -81,7 +87,7 @@ class PartsSplash {
// the color needs to be in hex
const backgroundColor = this._themeService.getTheme().getColor(editorBackground) || themes.WORKBENCH_BACKGROUND(this._themeService.getTheme());
this.broadcastService.broadcast({ channel: 'vscode:changeColorTheme', payload: JSON.stringify({ baseTheme, background: Color.Format.CSS.formatHex(backgroundColor) }) });
this._broadcastService.broadcast({ channel: 'vscode:changeColorTheme', payload: JSON.stringify({ baseTheme, background: Color.Format.CSS.formatHex(backgroundColor) }) });
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册