diff options
author | 2022-08-22 10:59:49 -0700 | |
---|---|---|
committer | 2022-08-22 10:59:49 -0700 | |
commit | 75a76fb8361fef540fd9025eff2251fc0fa8f4b8 (patch) | |
tree | a65d5ed1c6cb3ca4f23b77428e9a7e40484d3b41 /src/bun.js/webcore | |
parent | 2a0ab2aa9b07b99ce82564a01eeca3b666e91cf2 (diff) | |
download | bun-75a76fb8361fef540fd9025eff2251fc0fa8f4b8.tar.gz bun-75a76fb8361fef540fd9025eff2251fc0fa8f4b8.tar.zst bun-75a76fb8361fef540fd9025eff2251fc0fa8f4b8.zip |
Remove response pool
Diffstat (limited to 'src/bun.js/webcore')
-rw-r--r-- | src/bun.js/webcore/response.zig | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/src/bun.js/webcore/response.zig b/src/bun.js/webcore/response.zig index fb2ffe19c..2e6b73be1 100644 --- a/src/bun.js/webcore/response.zig +++ b/src/bun.js/webcore/response.zig @@ -46,43 +46,6 @@ const uws = @import("uws"); pub const Response = struct { pub usingnamespace JSC.Codegen.JSResponse; - pub const Pool = struct { - response_objects_pool: [127]JSC.JSValue = undefined, - response_objects_used: u8 = 0, - - pub fn get(this: *Pool, ptr: *Response) ?JSValue { - if (comptime JSC.is_bindgen) - unreachable; - if (this.response_objects_used > 0) { - var result = this.response_objects_pool[this.response_objects_used - 1]; - this.response_objects_used -= 1; - if (Response.dangerouslySetPtr(result, ptr)) { - return result; - } else { - JSC.C.JSValueUnprotect(VirtualMachine.vm.global.ref(), result.asObjectRef()); - } - } - - return null; - } - - pub fn push(this: *Pool, globalThis: *JSC.JSGlobalObject, object: JSC.JSValue) void { - var remaining = this.response_objects_pool[@minimum(this.response_objects_used, this.response_objects_pool.len)..]; - if (remaining.len == 0) { - JSC.C.JSValueUnprotect(globalThis.ref(), object.asObjectRef()); - return; - } - - if (object.as(Response)) |resp| { - _ = Response.dangerouslySetPtr(object, null); - - _ = resp.body.use(); - resp.finalize(); - remaining[0] = object; - this.response_objects_used += 1; - } - } - }; allocator: std.mem.Allocator, body: Body, |