Exploration: Better transferring of TypedArrays used in Webview.postMessage (#115664)

* Improve passing of ArrayBuffers to and from webviews

Fixes #115807

* Serialize and restore typed arrays too

This also makes it so that if you pass the same ArrayBuffer twice in an object, we use a single object on the receiver side too

* Fix spelling

* Require VS Code 1.56+
This commit is contained in:
Matt Bierner
2021-03-29 23:49:34 -07:00
committed by GitHub
parent 242bea8c8f
commit 3499f63dc1
20 changed files with 434 additions and 67 deletions

View File

@@ -146,7 +146,10 @@ export class ExtHostWebviewViews implements extHostProtocol.ExtHostWebviewViewsS
}
this._viewProviders.set(viewType, { provider, extension });
this._proxy.$registerWebviewViewProvider(toExtensionData(extension), viewType, webviewOptions);
this._proxy.$registerWebviewViewProvider(toExtensionData(extension), viewType, {
retainContextWhenHidden: webviewOptions?.retainContextWhenHidden,
serializeBuffersForPostMessage: false,
});
return new extHostTypes.Disposable(() => {
this._viewProviders.delete(viewType);