diff options
author | 2023-08-26 02:34:25 -0700 | |
---|---|---|
committer | 2023-08-26 02:34:25 -0700 | |
commit | 2a9e967fd1c766a718808d5a7fa779d74d44e62c (patch) | |
tree | 3bf4c059c03b9b561bc565ecf7cf21eaceae5353 /src/bun.js | |
parent | 910daeff27ead119e15f35f6c1e0aa09d2aa7562 (diff) | |
download | bun-2a9e967fd1c766a718808d5a7fa779d74d44e62c.tar.gz bun-2a9e967fd1c766a718808d5a7fa779d74d44e62c.tar.zst bun-2a9e967fd1c766a718808d5a7fa779d74d44e62c.zip |
More improvements to debugger support (#4345)
* More fixes for dap
* More changes
* More changes 2
* More fixes
* Fix debugger.ts
* Bun Terminal
Diffstat (limited to 'src/bun.js')
-rw-r--r-- | src/bun.js/node/types.zig | 15 | ||||
-rw-r--r-- | src/bun.js/webcore/blob.zig | 4 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/bun.js/node/types.zig b/src/bun.js/node/types.zig index 79fdf9e6b..6c4ee9f51 100644 --- a/src/bun.js/node/types.zig +++ b/src/bun.js/node/types.zig @@ -626,6 +626,14 @@ pub const PathLike = union(Tag) { pub const Tag = enum { string, buffer, slice_with_underlying_string }; + pub fn estimatedSize(this: *const PathLike) usize { + return switch (this.*) { + .string => this.string.estimatedSize(), + .buffer => this.buffer.slice().len, + .slice_with_underlying_string => 0, + }; + } + pub fn deinit(this: *const PathLike) void { if (this.* == .slice_with_underlying_string) { this.slice_with_underlying_string.deinit(); @@ -1059,6 +1067,13 @@ pub const PathOrFileDescriptor = union(Tag) { } } + pub fn estimatedSize(this: *const PathOrFileDescriptor) usize { + return switch (this.*) { + .path => this.path.estimatedSize(), + .fd => 0, + }; + } + pub fn toThreadSafe(this: *PathOrFileDescriptor) void { if (this.* == .path) { this.path.toThreadSafe(); diff --git a/src/bun.js/webcore/blob.zig b/src/bun.js/webcore/blob.zig index 604726c1e..c8d842a21 100644 --- a/src/bun.js/webcore/blob.zig +++ b/src/bun.js/webcore/blob.zig @@ -1253,8 +1253,8 @@ pub const Blob = struct { if (this.store) |store| { size += @sizeOf(Blob.Store); size += switch (store.data) { - .bytes => store.data.bytes.stored_name.len, - .file => store.data.file.pathlike.path.slice().len, + .bytes => store.data.bytes.stored_name.estimatedSize(), + .file => store.data.file.pathlike.estimatedSize(), }; } |