src/vs/workbench/api/common/extHostWebviewView.ts/ExtHostWebviewViews/registerWebviewViewProvider
class ExtHostWebviewViews:	public registerWebviewViewProvider(
		extension: IExtensionDescription,
		viewType: string,
		provider: vscode.WebviewViewProvider,
		webviewOptions?: {
			retainContextWhenHidden?: boolean;
		},
	): vscode.Disposable {
		if (this._viewProviders.has(viewType)) {
			throw new Error(`View provider for '${viewType}' already registered`);
		}

		this._viewProviders.set(viewType, { provider, extension });
		this._proxy.$registerWebviewViewProvider(toExtensionData(extension), viewType, {
			retainContextWhenHidden: webviewOptions?.retainContextWhenHidden,
			serializeBuffersForPostMessage: shouldSerializeBuffersForPostMessage(extension),
		});

		return new extHostTypes.Disposable(() => {
			this._viewProviders.delete(viewType);
			this._proxy.$unregisterWebviewViewProvider(viewType);
		});
	}