提交 086b2875 编写于 作者: I isidor

Revert "do not use map for pending requests"

This reverts commit fb838d20.
上级 fc67df29
......@@ -13,14 +13,14 @@ export abstract class V8Protocol {
private outputStream: stream.Writable;
private sequence: number;
private pendingRequests: { [id: number]: (e: DebugProtocol.Response) => void; };
private pendingRequests: Map<number, (e: DebugProtocol.Response) => void>;
private rawData: Buffer;
private contentLength: number;
constructor(private id: string) {
this.sequence = 1;
this.contentLength = -1;
this.pendingRequests = {};
this.pendingRequests = new Map<number, (e: DebugProtocol.Response) => void>();
this.rawData = new Buffer(0);
}
......@@ -77,7 +77,7 @@ export abstract class V8Protocol {
if (clb) {
// store callback for this request
this.pendingRequests[request.seq] = clb;
this.pendingRequests.set(request.seq, clb);
}
}
......@@ -130,9 +130,9 @@ export abstract class V8Protocol {
break;
case 'response':
const response = <DebugProtocol.Response>rawData;
const clb = this.pendingRequests[response.request_seq];
const clb = this.pendingRequests.get(response.request_seq);
if (clb) {
delete this.pendingRequests[response.request_seq];
this.pendingRequests.delete(response.request_seq);
clb(response);
}
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册