mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Merge from vscode 8c426f9f3b6b18935cc6c2ec8aa6d45ccd88021e
This commit is contained in:
@@ -184,6 +184,7 @@ export class ExtensionHostManager extends Disposable {
|
||||
getProxy: <T>(identifier: ProxyIdentifier<T>): T => this._rpcProtocol!.getProxy(identifier),
|
||||
set: <T, R extends T>(identifier: ProxyIdentifier<T>, instance: R): R => this._rpcProtocol!.set(identifier, instance),
|
||||
assertRegistered: (identifiers: ProxyIdentifier<any>[]): void => this._rpcProtocol!.assertRegistered(identifiers),
|
||||
drain: (): Promise<void> => this._rpcProtocol!.drain(),
|
||||
};
|
||||
|
||||
// Named customers
|
||||
|
||||
@@ -18,6 +18,11 @@ export interface IRPCProtocol {
|
||||
* Assert these identifiers are already registered via `.set`.
|
||||
*/
|
||||
assertRegistered(identifiers: ProxyIdentifier<any>[]): void;
|
||||
|
||||
/**
|
||||
* Wait for the write buffer (if applicable) to become empty.
|
||||
*/
|
||||
drain(): Promise<void>;
|
||||
}
|
||||
|
||||
export class ProxyIdentifier<T> {
|
||||
|
||||
@@ -115,6 +115,13 @@ export class RPCProtocol extends Disposable implements IRPCProtocol {
|
||||
});
|
||||
}
|
||||
|
||||
public drain(): Promise<void> {
|
||||
if (typeof this._protocol.drain === 'function') {
|
||||
return this._protocol.drain();
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
private _onWillSendRequest(req: number): void {
|
||||
if (this._unacknowledgedCount === 0) {
|
||||
// Since this is the first request we are sending in a while,
|
||||
|
||||
@@ -96,10 +96,10 @@ let onTerminate = function () {
|
||||
nativeExit();
|
||||
};
|
||||
|
||||
function _createExtHostProtocol(): Promise<IMessagePassingProtocol> {
|
||||
function _createExtHostProtocol(): Promise<PersistentProtocol> {
|
||||
if (process.env.VSCODE_EXTHOST_WILL_SEND_SOCKET) {
|
||||
|
||||
return new Promise<IMessagePassingProtocol>((resolve, reject) => {
|
||||
return new Promise<PersistentProtocol>((resolve, reject) => {
|
||||
|
||||
let protocol: PersistentProtocol | null = null;
|
||||
|
||||
@@ -163,7 +163,7 @@ function _createExtHostProtocol(): Promise<IMessagePassingProtocol> {
|
||||
|
||||
const pipeName = process.env.VSCODE_IPC_HOOK_EXTHOST!;
|
||||
|
||||
return new Promise<IMessagePassingProtocol>((resolve, reject) => {
|
||||
return new Promise<PersistentProtocol>((resolve, reject) => {
|
||||
|
||||
const socket = net.createConnection(pipeName, () => {
|
||||
socket.removeListener('error', reject);
|
||||
@@ -203,6 +203,10 @@ async function createExtHostProtocol(): Promise<IMessagePassingProtocol> {
|
||||
protocol.send(msg);
|
||||
}
|
||||
}
|
||||
|
||||
drain(): Promise<void> {
|
||||
return protocol.drain();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user