Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(ext/webstorage): use object wrap for Storage #26931

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

@littledivy littledivy added the ci-draft Run the CI on draft PRs. label Nov 19, 2024
@littledivy littledivy changed the title chore(ext/webstorage): rewrite Storage in op2 object wrap chore(ext/webstorage): use object wrap for Storage Nov 23, 2024
@littledivy littledivy changed the title chore(ext/webstorage): use object wrap for Storage chore(ext/webstorage): use object wrap for Storage Nov 23, 2024
@littledivy littledivy changed the title chore(ext/webstorage): use object wrap for Storage perf(ext/webstorage): use object wrap for Storage Nov 23, 2024
Comment on lines +228 to +243
#[method]
#[serde]
fn iterate_keys(
&self,
state: &mut OpState,
) -> Result<Vec<String>, WebStorageError> {
let conn = get_webstorage(state, self.persistent)?;

let mut stmt = conn.prepare_cached("SELECT key FROM data")?;
let keys = stmt
.query_map(params![], |row| row.get::<_, String>(0))?
.map(|r| r.unwrap())
.collect();

Ok(keys)
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: make this private or keep it as a normal op

@@ -9789,7 +9789,7 @@
"event_constructor.window.html": false,
"event_initstorageevent.window.html": false,
"missing_arguments.window.html": true,
"storage_builtins.window.html": true,
"storage_builtins.window.html": false,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test checks if

Storage.prototype.setItem == localStorage.setItem

but our Proxy needs to create a new instance via .bind because receiver holds cppgc object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-draft Run the CI on draft PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant