MCPcopy Create free account
hub / github.com/angular/dev-infra / execute

Method execute

github-actions/saucelabs/set-saucelabs-env.js:6105–6145  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

6103 }
6104 readMore() {
6105 while (!this.paused && this.ptr) {
6106 const chunk = this.socket.read();
6107 if (chunk === null) {
6108 break;
6109 }
6110 this.execute(chunk);
6111 }
6112 }
6113 execute(data) {
6114 assert(this.ptr != null);
6115 assert(currentParser == null);
6116 assert(!this.paused);
6117 const { socket, llhttp } = this;
6118 if (data.length > currentBufferSize) {
6119 if (currentBufferPtr) {
6120 llhttp.free(currentBufferPtr);
6121 }
6122 currentBufferSize = Math.ceil(data.length / 4096) * 4096;
6123 currentBufferPtr = llhttp.malloc(currentBufferSize);
6124 }
6125 new Uint8Array(llhttp.memory.buffer, currentBufferPtr, currentBufferSize).set(data);
6126 try {
6127 let ret;
6128 try {
6129 currentBufferRef = data;
6130 currentParser = this;
6131 ret = llhttp.llhttp_execute(this.ptr, currentBufferPtr, data.length);
6132 } catch (err) {
6133 throw err;
6134 } finally {
6135 currentParser = null;
6136 currentBufferRef = null;
6137 }
6138 const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr;
6139 if (ret !== constants3.ERROR.OK) {
6140 const body = data.subarray(offset);
6141 if (ret === constants3.ERROR.PAUSED_UPGRADE) {
6142 this.onUpgrade(body);
6143 } else if (ret === constants3.ERROR.PAUSED) {
6144 this.paused = true;
6145 socket.unshift(body);
6146 } else {
6147 throw this.createError(ret, body);
6148 }

Callers 2

resumeMethod · 0.45
readMoreMethod · 0.45

Calls 5

freeMethod · 0.45
setMethod · 0.45
onUpgradeMethod · 0.45
createErrorMethod · 0.45
destroyMethod · 0.45

Tested by

no test coverage detected