-
Notifications
You must be signed in to change notification settings - Fork 131
feat(BREAKING): Make LocalInspectorSession
synchronous
#1193
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
Conversation
Open to bike-shedding on the name - I'm also fine just renaming the struct and stripping it out of its async API. This is a first in the series of PRs that are simplifying inspector implementation - see #1192 for next steps |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1193 +/- ##
==========================================
- Coverage 81.43% 79.57% -1.86%
==========================================
Files 97 100 +3
Lines 23877 25841 +1964
==========================================
+ Hits 19445 20564 +1119
- Misses 4432 5277 +845 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
.borrow() | ||
.create_local_session(session_options); | ||
let inspector = runtime.inspector(); | ||
let (tx, rx) = std::sync::mpsc::channel(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should probably be oneshot
?
core/inspector.rs
Outdated
notification_rx: Option<UnboundedReceiver<Value>>, | ||
/// | ||
/// Does not provide any abstraction over CDP messages. | ||
pub struct LocalSyncInspectorSession { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think you could keep this being named LocalInspectorSession
LocalSyncInspectorSession
and remove LocalInspectorSession
LocalInspectorSession
synchronous
Fixing some of the fall out from #1193. Testing in CLI it turned out that there's a double RefCell borrow panic occuring, when running the REPL - when the exception was raised when evaluating an expression - and said expression was evaluated as part of dispatching an inspector message - the `op_dispatch_exception` op was called that tries to mutable borrow the inspector instance. This is now avoided by storing `SessionContainer` in the `LocalInspectorSession`, instead of `JsRuntimeInspector`. This will be further simplified in follow up PRs like #1192.
Based on denoland/deno_core#1193. This commit rewrites 3 parts of the system to use a new "sync" V8 inspector API exposed by `deno_core`: - REPL - coverage collection - hot module replacement Turns out the async abstraction over V8 inspector was unnecessary and actually greatly complicated usage of the inspector. Towards #13572 Towards #13206
Based on denoland/deno_core#1193. This commit rewrites 3 parts of the system to use a new "sync" V8 inspector API exposed by `deno_core`: - REPL - coverage collection - hot module replacement Turns out the async abstraction over V8 inspector was unnecessary and actually greatly complicated usage of the inspector. Towards denoland#13572 Towards denoland#13206
Required for denoland/deno#30743
This commit changes
LocalInspectorSession
to only provide async API.
While it might feel counterintuitive, as it is now the callers responsibility
to handle request/response cycles, this change actually greatly
simplifies inspector implementation and gives granular control
over behavior of inspector. The main change is that sync sessions, no
longer require event loop ticks to make progress - ie. sending a message
is fully synchronous - because there no channels involved. This leads
to the fact that "responses" (which are actually callbacks) are most
often produces when the message is sent and returned.
Thanks to this change, it's now possible to easily implement interactions
with V8 coverage collection and profiler inspector domains.