mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-15 07:48:58 +00:00
Merge pull request #598 from lightpanda-io/unused_imports
Some checks failed
e2e-test / zig build release (push) Has been cancelled
wpt / web platform tests (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
zig-test / zig build dev (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
e2e-test / puppeteer-perf (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
zig-test / browser fetch (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
nightly build / build-linux-x86_64 (push) Has been cancelled
nightly build / build-linux-aarch64 (push) Has been cancelled
nightly build / build-macos-aarch64 (push) Has been cancelled
nightly build / build-macos-x86_64 (push) Has been cancelled
Some checks failed
e2e-test / zig build release (push) Has been cancelled
wpt / web platform tests (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
zig-test / zig build dev (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
e2e-test / puppeteer-perf (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
zig-test / browser fetch (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
nightly build / build-linux-x86_64 (push) Has been cancelled
nightly build / build-linux-aarch64 (push) Has been cancelled
nightly build / build-macos-aarch64 (push) Has been cancelled
nightly build / build-macos-x86_64 (push) Has been cancelled
remove unused code, mostly imports
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Allocator = std.mem.Allocator;
|
const Allocator = std.mem.Allocator;
|
||||||
|
|
||||||
const js = @import("runtime/js.zig");
|
|
||||||
const Loop = @import("runtime/loop.zig").Loop;
|
const Loop = @import("runtime/loop.zig").Loop;
|
||||||
const HttpClient = @import("http/client.zig").Client;
|
const HttpClient = @import("http/client.zig").Client;
|
||||||
const Telemetry = @import("telemetry/telemetry.zig").Telemetry;
|
const Telemetry = @import("telemetry/telemetry.zig").Telemetry;
|
||||||
|
|||||||
@@ -37,21 +37,16 @@ const URL = @import("../url.zig").URL;
|
|||||||
|
|
||||||
const http = @import("../http/client.zig");
|
const http = @import("../http/client.zig");
|
||||||
const storage = @import("storage/storage.zig");
|
const storage = @import("storage/storage.zig");
|
||||||
const Loop = @import("../runtime/loop.zig").Loop;
|
|
||||||
const SessionState = @import("env.zig").SessionState;
|
const SessionState = @import("env.zig").SessionState;
|
||||||
const HttpClient = @import("../http/client.zig").Client;
|
|
||||||
const Notification = @import("../notification.zig").Notification;
|
const Notification = @import("../notification.zig").Notification;
|
||||||
|
|
||||||
const polyfill = @import("polyfill/polyfill.zig");
|
const polyfill = @import("polyfill/polyfill.zig");
|
||||||
|
|
||||||
const log = std.log.scoped(.browser);
|
const log = std.log.scoped(.browser);
|
||||||
|
|
||||||
pub const user_agent = "Lightpanda/1.0";
|
|
||||||
|
|
||||||
// Browser is an instance of the browser.
|
// Browser is an instance of the browser.
|
||||||
// You can create multiple browser instances.
|
// You can create multiple browser instances.
|
||||||
// A browser contains only one session.
|
// A browser contains only one session.
|
||||||
// TODO allow multiple sessions per browser.
|
|
||||||
pub const Browser = struct {
|
pub const Browser = struct {
|
||||||
env: *Env,
|
env: *Env,
|
||||||
app: *App,
|
app: *App,
|
||||||
@@ -851,12 +846,6 @@ const FlatRenderer = struct {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const NoopContext = struct {
|
|
||||||
pub fn onInspectorResponse(_: *anyopaque, _: u32, _: []const u8) void {}
|
|
||||||
pub fn onInspectorEvent(_: *anyopaque, _: []const u8) void {}
|
|
||||||
pub fn notify(_: *anyopaque, _: *const Notification) !void {}
|
|
||||||
};
|
|
||||||
|
|
||||||
fn timestamp() u32 {
|
fn timestamp() u32 {
|
||||||
const ts = std.posix.clock_gettime(std.posix.CLOCK.MONOTONIC) catch unreachable;
|
const ts = std.posix.clock_gettime(std.posix.CLOCK.MONOTONIC) catch unreachable;
|
||||||
return @intCast(ts.sec);
|
return @intCast(ts.sec);
|
||||||
|
|||||||
@@ -16,12 +16,9 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
const std = @import("std");
|
|
||||||
|
|
||||||
const parser = @import("../netsurf.zig");
|
const parser = @import("../netsurf.zig");
|
||||||
|
|
||||||
const Node = @import("node.zig").Node;
|
const Node = @import("node.zig").Node;
|
||||||
const DOMException = @import("exceptions.zig").DOMException;
|
|
||||||
|
|
||||||
// WEB IDL https://dom.spec.whatwg.org/#attr
|
// WEB IDL https://dom.spec.whatwg.org/#attr
|
||||||
pub const Attr = struct {
|
pub const Attr = struct {
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
const std = @import("std");
|
|
||||||
|
|
||||||
const parser = @import("../netsurf.zig");
|
const parser = @import("../netsurf.zig");
|
||||||
|
|
||||||
const Text = @import("text.zig").Text;
|
const Text = @import("text.zig").Text;
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
const std = @import("std");
|
|
||||||
|
|
||||||
const parser = @import("../netsurf.zig");
|
const parser = @import("../netsurf.zig");
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,6 @@ const css = @import("css.zig");
|
|||||||
const Element = @import("element.zig").Element;
|
const Element = @import("element.zig").Element;
|
||||||
const ElementUnion = @import("element.zig").Union;
|
const ElementUnion = @import("element.zig").Union;
|
||||||
|
|
||||||
const DocumentType = @import("document_type.zig").DocumentType;
|
|
||||||
const DocumentFragment = @import("document_fragment.zig").DocumentFragment;
|
|
||||||
const DOMImplementation = @import("implementation.zig").DOMImplementation;
|
const DOMImplementation = @import("implementation.zig").DOMImplementation;
|
||||||
|
|
||||||
// WEB IDL https://dom.spec.whatwg.org/#document
|
// WEB IDL https://dom.spec.whatwg.org/#document
|
||||||
|
|||||||
@@ -31,8 +31,6 @@ const NodeList = @import("nodelist.zig").NodeList;
|
|||||||
const HTMLElem = @import("../html/elements.zig");
|
const HTMLElem = @import("../html/elements.zig");
|
||||||
pub const Union = @import("../html/elements.zig").Union;
|
pub const Union = @import("../html/elements.zig").Union;
|
||||||
|
|
||||||
const DOMException = @import("exceptions.zig").DOMException;
|
|
||||||
|
|
||||||
// WEB IDL https://dom.spec.whatwg.org/#element
|
// WEB IDL https://dom.spec.whatwg.org/#element
|
||||||
pub const Element = struct {
|
pub const Element = struct {
|
||||||
pub const Self = parser.Element;
|
pub const Self = parser.Element;
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
const std = @import("std");
|
|
||||||
|
|
||||||
const Env = @import("../env.zig").Env;
|
const Env = @import("../env.zig").Env;
|
||||||
const parser = @import("../netsurf.zig");
|
const parser = @import("../netsurf.zig");
|
||||||
const SessionState = @import("../env.zig").SessionState;
|
const SessionState = @import("../env.zig").SessionState;
|
||||||
|
|||||||
@@ -21,16 +21,10 @@ const Allocator = std.mem.Allocator;
|
|||||||
|
|
||||||
const parser = @import("../netsurf.zig");
|
const parser = @import("../netsurf.zig");
|
||||||
|
|
||||||
const utils = @import("utils.z");
|
|
||||||
const Element = @import("element.zig").Element;
|
const Element = @import("element.zig").Element;
|
||||||
const Union = @import("element.zig").Union;
|
const Union = @import("element.zig").Union;
|
||||||
|
|
||||||
const JsThis = @import("../env.zig").JsThis;
|
const JsThis = @import("../env.zig").JsThis;
|
||||||
|
|
||||||
const Walker = @import("walker.zig").Walker;
|
const Walker = @import("walker.zig").Walker;
|
||||||
const WalkerDepthFirst = @import("walker.zig").WalkerDepthFirst;
|
|
||||||
const WalkerChildren = @import("walker.zig").WalkerChildren;
|
|
||||||
const WalkerNone = @import("walker.zig").WalkerNone;
|
|
||||||
|
|
||||||
const Matcher = union(enum) {
|
const Matcher = union(enum) {
|
||||||
matchByName: MatchByName,
|
matchByName: MatchByName,
|
||||||
|
|||||||
@@ -16,13 +16,7 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
const std = @import("std");
|
|
||||||
|
|
||||||
const parser = @import("../netsurf.zig");
|
const parser = @import("../netsurf.zig");
|
||||||
const SessionState = @import("../env.zig").SessionState;
|
|
||||||
|
|
||||||
const Document = @import("document.zig").Document;
|
|
||||||
const DocumentType = @import("document_type.zig").DocumentType;
|
|
||||||
const DOMException = @import("exceptions.zig").DOMException;
|
const DOMException = @import("exceptions.zig").DOMException;
|
||||||
|
|
||||||
// WEB IDL https://dom.spec.whatwg.org/#domimplementation
|
// WEB IDL https://dom.spec.whatwg.org/#domimplementation
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ const parser = @import("../netsurf.zig");
|
|||||||
|
|
||||||
const JsThis = @import("../env.zig").JsThis;
|
const JsThis = @import("../env.zig").JsThis;
|
||||||
const Callback = @import("../env.zig").Callback;
|
const Callback = @import("../env.zig").Callback;
|
||||||
const SessionState = @import("../env.zig").SessionState;
|
|
||||||
|
|
||||||
const NodeUnion = @import("node.zig").Union;
|
const NodeUnion = @import("node.zig").Union;
|
||||||
const Node = @import("node.zig").Node;
|
const Node = @import("node.zig").Node;
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
const std = @import("std");
|
|
||||||
|
|
||||||
const parser = @import("../netsurf.zig");
|
const parser = @import("../netsurf.zig");
|
||||||
const SessionState = @import("../env.zig").SessionState;
|
const SessionState = @import("../env.zig").SessionState;
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ const iterator = @import("../iterator/iterator.zig");
|
|||||||
|
|
||||||
const Callback = @import("../env.zig").Callback;
|
const Callback = @import("../env.zig").Callback;
|
||||||
const JsObject = @import("../env.zig").JsObject;
|
const JsObject = @import("../env.zig").JsObject;
|
||||||
const SessionState = @import("../env.zig").SessionState;
|
|
||||||
const DOMException = @import("exceptions.zig").DOMException;
|
const DOMException = @import("exceptions.zig").DOMException;
|
||||||
|
|
||||||
const log = std.log.scoped(.token_list);
|
const log = std.log.scoped(.token_list);
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
const std = @import("std");
|
|
||||||
|
|
||||||
const parser = @import("../netsurf.zig");
|
const parser = @import("../netsurf.zig");
|
||||||
|
|
||||||
pub const Walker = union(enum) {
|
pub const Walker = union(enum) {
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const File = std.fs.File;
|
|
||||||
|
|
||||||
const parser = @import("netsurf.zig");
|
const parser = @import("netsurf.zig");
|
||||||
const Walker = @import("dom/walker.zig").WalkerChildren;
|
const Walker = @import("dom/walker.zig").WalkerChildren;
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
const std = @import("std");
|
|
||||||
|
|
||||||
const parser = @import("../netsurf.zig");
|
const parser = @import("../netsurf.zig");
|
||||||
const Event = @import("event.zig").Event;
|
const Event = @import("event.zig").Event;
|
||||||
const JsObject = @import("../env.zig").JsObject;
|
const JsObject = @import("../env.zig").JsObject;
|
||||||
|
|||||||
@@ -21,10 +21,8 @@ const std = @import("std");
|
|||||||
const parser = @import("../netsurf.zig");
|
const parser = @import("../netsurf.zig");
|
||||||
const SessionState = @import("../env.zig").SessionState;
|
const SessionState = @import("../env.zig").SessionState;
|
||||||
|
|
||||||
const Node = @import("../dom/node.zig").Node;
|
|
||||||
const Document = @import("../dom/document.zig").Document;
|
const Document = @import("../dom/document.zig").Document;
|
||||||
const NodeList = @import("../dom/nodelist.zig").NodeList;
|
const NodeList = @import("../dom/nodelist.zig").NodeList;
|
||||||
const HTMLElem = @import("elements.zig");
|
|
||||||
const Location = @import("location.zig").Location;
|
const Location = @import("location.zig").Location;
|
||||||
|
|
||||||
const collection = @import("../dom/html_collection.zig");
|
const collection = @import("../dom/html_collection.zig");
|
||||||
|
|||||||
@@ -18,8 +18,6 @@
|
|||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
const builtin = @import("builtin");
|
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#the-history-interface
|
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#the-history-interface
|
||||||
pub const History = struct {
|
pub const History = struct {
|
||||||
const ScrollRestorationMode = enum {
|
const ScrollRestorationMode = enum {
|
||||||
|
|||||||
@@ -16,12 +16,8 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
const std = @import("std");
|
|
||||||
|
|
||||||
const SessionState = @import("../env.zig").SessionState;
|
const SessionState = @import("../env.zig").SessionState;
|
||||||
|
|
||||||
const builtin = @import("builtin");
|
|
||||||
|
|
||||||
const URL = @import("../url/url.zig").URL;
|
const URL = @import("../url/url.zig").URL;
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#the-location-interface
|
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#the-location-interface
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
const std = @import("std");
|
|
||||||
|
|
||||||
pub const Interfaces = .{
|
pub const Interfaces = .{
|
||||||
U32Iterator,
|
U32Iterator,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
// We replace the libdom default usage of allocations with mimalloc heap
|
// We replace the libdom default usage of allocations with mimalloc heap
|
||||||
// allocation to be able to free all memory used at once, like an arena usage.
|
// allocation to be able to free all memory used at once, like an arena usage.
|
||||||
|
|
||||||
const std = @import("std");
|
|
||||||
const c = @cImport({
|
const c = @cImport({
|
||||||
@cInclude("mimalloc.h");
|
@cInclude("mimalloc.h");
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
const std = @import("std");
|
|
||||||
// fetch.js code comes from
|
// fetch.js code comes from
|
||||||
// https://github.com/JakeChampion/fetch/blob/main/fetch.js
|
// https://github.com/JakeChampion/fetch/blob/main/fetch.js
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
const std = @import("std");
|
|
||||||
|
|
||||||
const parser = @import("../netsurf.zig");
|
const parser = @import("../netsurf.zig");
|
||||||
const Event = @import("../events/event.zig").Event;
|
const Event = @import("../events/event.zig").Event;
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ const SessionState = @import("../env.zig").SessionState;
|
|||||||
|
|
||||||
const dump = @import("../dump.zig");
|
const dump = @import("../dump.zig");
|
||||||
const parser = @import("../netsurf.zig");
|
const parser = @import("../netsurf.zig");
|
||||||
const DOMError = parser.DOMError;
|
|
||||||
|
|
||||||
pub const Interfaces = .{
|
pub const Interfaces = .{
|
||||||
XMLSerializer,
|
XMLSerializer,
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Runtime = @import("runtime.zig");
|
|
||||||
|
|
||||||
pub fn processMessage(cmd: anytype) !void {
|
pub fn processMessage(cmd: anytype) !void {
|
||||||
const action = std.meta.stringToEnum(enum {
|
const action = std.meta.stringToEnum(enum {
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const runtime = @import("runtime.zig");
|
|
||||||
const URL = @import("../../url.zig").URL;
|
const URL = @import("../../url.zig").URL;
|
||||||
const Notification = @import("../../notification.zig").Notification;
|
const Notification = @import("../../notification.zig").Notification;
|
||||||
const Page = @import("../../browser/browser.zig").Page;
|
const Page = @import("../../browser/browser.zig").Page;
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ const ArenaAllocator = std.heap.ArenaAllocator;
|
|||||||
const Testing = @This();
|
const Testing = @This();
|
||||||
|
|
||||||
const main = @import("cdp.zig");
|
const main = @import("cdp.zig");
|
||||||
const URL = @import("../url.zig").URL;
|
|
||||||
const App = @import("../app.zig").App;
|
const App = @import("../app.zig").App;
|
||||||
const parser = @import("../browser/netsurf.zig");
|
const parser = @import("../browser/netsurf.zig");
|
||||||
|
|
||||||
|
|||||||
10
src/id.zig
10
src/id.zig
@@ -88,16 +88,6 @@ pub fn uuidv4(hex: []u8) void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const hex_to_nibble = [_]u8{0xff} ** 48 ++ [_]u8{
|
|
||||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
|
||||||
0x08, 0x09, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
|
||||||
0xff, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0xff,
|
|
||||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
|
||||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
|
||||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
|
||||||
0xff, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0xff,
|
|
||||||
} ++ [_]u8{0xff} ** 152;
|
|
||||||
|
|
||||||
const testing = std.testing;
|
const testing = std.testing;
|
||||||
test "id: Incrementing.next" {
|
test "id: Incrementing.next" {
|
||||||
var id = Incrementing(u16, "IDX"){};
|
var id = Incrementing(u16, "IDX"){};
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
const std = @import("std");
|
|
||||||
|
|
||||||
// TODO: use functions instead of "fake" struct once we handle function API generation
|
// TODO: use functions instead of "fake" struct once we handle function API generation
|
||||||
const Primitives = struct {
|
const Primitives = struct {
|
||||||
pub fn constructor() Primitives {
|
pub fn constructor() Primitives {
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ const Completion = IO.Completion;
|
|||||||
const AcceptError = IO.AcceptError;
|
const AcceptError = IO.AcceptError;
|
||||||
const RecvError = IO.RecvError;
|
const RecvError = IO.RecvError;
|
||||||
const SendError = IO.SendError;
|
const SendError = IO.SendError;
|
||||||
const CloseError = IO.CloseError;
|
|
||||||
const CancelError = IO.CancelOneError;
|
|
||||||
const TimeoutError = IO.TimeoutError;
|
const TimeoutError = IO.TimeoutError;
|
||||||
const Loop = @import("runtime/loop.zig").Loop;
|
const Loop = @import("runtime/loop.zig").Loop;
|
||||||
|
|
||||||
@@ -947,10 +945,6 @@ const OpCode = enum(u8) {
|
|||||||
pong = 128 | 10,
|
pong = 128 | 10,
|
||||||
};
|
};
|
||||||
|
|
||||||
const CloseCode = enum {
|
|
||||||
timeout,
|
|
||||||
};
|
|
||||||
|
|
||||||
fn fillWebsocketHeader(buf: std.ArrayListUnmanaged(u8)) []const u8 {
|
fn fillWebsocketHeader(buf: std.ArrayListUnmanaged(u8)) []const u8 {
|
||||||
// can't use buf[0..10] here, because the header length
|
// can't use buf[0..10] here, because the header length
|
||||||
// is variable. If it's just 2 bytes, for example, we need the
|
// is variable. If it's just 2 bytes, for example, we need the
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ pub const LightPanda = struct {
|
|||||||
|
|
||||||
const List = std.DoublyLinkedList(LightPandaEvent);
|
const List = std.DoublyLinkedList(LightPandaEvent);
|
||||||
|
|
||||||
pub fn init(app: *App) !LightPanda {
|
pub fn init(app: *App) LightPanda {
|
||||||
const allocator = app.allocator;
|
const allocator = app.allocator;
|
||||||
return .{
|
return .{
|
||||||
.cond = .{},
|
.cond = .{},
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ const builtin = @import("builtin");
|
|||||||
const Allocator = std.mem.Allocator;
|
const Allocator = std.mem.Allocator;
|
||||||
|
|
||||||
const App = @import("../app.zig").App;
|
const App = @import("../app.zig").App;
|
||||||
const Loop = @import("jsruntime").Loop;
|
|
||||||
const Notification = @import("../notification.zig").Notification;
|
const Notification = @import("../notification.zig").Notification;
|
||||||
|
|
||||||
const uuidv4 = @import("../id.zig").uuidv4;
|
const uuidv4 = @import("../id.zig").uuidv4;
|
||||||
@@ -39,7 +38,7 @@ fn TelemetryT(comptime P: type) type {
|
|||||||
return .{
|
return .{
|
||||||
.disabled = disabled,
|
.disabled = disabled,
|
||||||
.run_mode = run_mode,
|
.run_mode = run_mode,
|
||||||
.provider = try P.init(app),
|
.provider = P.init(app),
|
||||||
.iid = if (disabled) null else getOrCreateId(app.app_dir_path),
|
.iid = if (disabled) null else getOrCreateId(app.app_dir_path),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -135,7 +134,7 @@ pub const Event = union(enum) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const NoopProvider = struct {
|
const NoopProvider = struct {
|
||||||
fn init(_: *App) !NoopProvider {
|
fn init(_: *App) NoopProvider {
|
||||||
return .{};
|
return .{};
|
||||||
}
|
}
|
||||||
fn deinit(_: NoopProvider) void {}
|
fn deinit(_: NoopProvider) void {}
|
||||||
@@ -151,7 +150,7 @@ test "telemetry: disabled by environment" {
|
|||||||
defer _ = unsetenv(@constCast("LIGHTPANDA_DISABLE_TELEMETRY"));
|
defer _ = unsetenv(@constCast("LIGHTPANDA_DISABLE_TELEMETRY"));
|
||||||
|
|
||||||
const FailingProvider = struct {
|
const FailingProvider = struct {
|
||||||
fn init(_: *App) !@This() {
|
fn init(_: *App) @This() {
|
||||||
return .{};
|
return .{};
|
||||||
}
|
}
|
||||||
fn deinit(_: @This()) void {}
|
fn deinit(_: @This()) void {}
|
||||||
@@ -207,7 +206,7 @@ const MockProvider = struct {
|
|||||||
allocator: Allocator,
|
allocator: Allocator,
|
||||||
events: std.ArrayListUnmanaged(Event),
|
events: std.ArrayListUnmanaged(Event),
|
||||||
|
|
||||||
fn init(app: *App) !@This() {
|
fn init(app: *App) @This() {
|
||||||
return .{
|
return .{
|
||||||
.iid = null,
|
.iid = null,
|
||||||
.run_mode = null,
|
.run_mode = null,
|
||||||
|
|||||||
Reference in New Issue
Block a user