mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
feat(inspector): improve inspector prompt in Chrome Devtools (#11187)
This commit improves how Deno inspector presents itself in Chrome Devtools.
This commit is contained in:
parent
622f9c6889
commit
3e21ffc935
3 changed files with 21 additions and 8 deletions
|
@ -64,8 +64,10 @@ impl InspectorServer {
|
|||
&self,
|
||||
session_sender: UnboundedSender<InspectorSessionProxy>,
|
||||
deregister_rx: oneshot::Receiver<()>,
|
||||
module_url: String,
|
||||
) {
|
||||
let info = InspectorInfo::new(self.host, session_sender, deregister_rx);
|
||||
let info =
|
||||
InspectorInfo::new(self.host, session_sender, deregister_rx, module_url);
|
||||
self.register_inspector_tx.unbounded_send(info).unwrap();
|
||||
}
|
||||
}
|
||||
|
@ -333,6 +335,7 @@ pub struct InspectorInfo {
|
|||
pub thread_name: Option<String>,
|
||||
pub new_session_tx: UnboundedSender<InspectorSessionProxy>,
|
||||
pub deregister_rx: oneshot::Receiver<()>,
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
impl InspectorInfo {
|
||||
|
@ -340,6 +343,7 @@ impl InspectorInfo {
|
|||
host: SocketAddr,
|
||||
new_session_tx: mpsc::UnboundedSender<InspectorSessionProxy>,
|
||||
deregister_rx: oneshot::Receiver<()>,
|
||||
url: String,
|
||||
) -> Self {
|
||||
Self {
|
||||
host,
|
||||
|
@ -347,6 +351,7 @@ impl InspectorInfo {
|
|||
thread_name: thread::current().name().map(|n| n.to_owned()),
|
||||
new_session_tx,
|
||||
deregister_rx,
|
||||
url,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -358,7 +363,7 @@ impl InspectorInfo {
|
|||
"id": self.uuid.to_string(),
|
||||
"title": self.get_title(),
|
||||
"type": "node",
|
||||
// TODO(ry): "url": "file://",
|
||||
"url": self.url.to_string(),
|
||||
"webSocketDebuggerUrl": self.get_websocket_debugger_url(),
|
||||
})
|
||||
}
|
||||
|
@ -376,13 +381,13 @@ impl InspectorInfo {
|
|||
|
||||
fn get_title(&self) -> String {
|
||||
format!(
|
||||
"[{}] deno{}",
|
||||
process::id(),
|
||||
"deno{} [pid: {}]",
|
||||
self
|
||||
.thread_name
|
||||
.as_ref()
|
||||
.map(|n| format!(" - {}", n))
|
||||
.unwrap_or_default()
|
||||
.unwrap_or_default(),
|
||||
process::id(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -360,7 +360,11 @@ impl WebWorker {
|
|||
let inspector = js_runtime.inspector();
|
||||
let session_sender = inspector.get_session_sender();
|
||||
let deregister_rx = inspector.add_deregister_handler();
|
||||
server.register_inspector(session_sender, deregister_rx);
|
||||
server.register_inspector(
|
||||
session_sender,
|
||||
deregister_rx,
|
||||
main_module.to_string(),
|
||||
);
|
||||
}
|
||||
|
||||
let (internal_handle, external_handle) = {
|
||||
|
|
|
@ -115,7 +115,7 @@ impl MainWorker {
|
|||
// Metrics
|
||||
metrics::init(),
|
||||
// Runtime ops
|
||||
ops::runtime::init(main_module),
|
||||
ops::runtime::init(main_module.clone()),
|
||||
ops::worker_host::init(options.create_web_worker_cb.clone()),
|
||||
ops::fs_events::init(),
|
||||
ops::fs::init(),
|
||||
|
@ -145,7 +145,11 @@ impl MainWorker {
|
|||
let inspector = js_runtime.inspector();
|
||||
let session_sender = inspector.get_session_sender();
|
||||
let deregister_rx = inspector.add_deregister_handler();
|
||||
server.register_inspector(session_sender, deregister_rx);
|
||||
server.register_inspector(
|
||||
session_sender,
|
||||
deregister_rx,
|
||||
main_module.to_string(),
|
||||
);
|
||||
}
|
||||
|
||||
Self {
|
||||
|
|
Loading…
Reference in a new issue