mirror of
https://github.com/denoland/deno.git
synced 2024-11-22 15:06:54 -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,
|
&self,
|
||||||
session_sender: UnboundedSender<InspectorSessionProxy>,
|
session_sender: UnboundedSender<InspectorSessionProxy>,
|
||||||
deregister_rx: oneshot::Receiver<()>,
|
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();
|
self.register_inspector_tx.unbounded_send(info).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -333,6 +335,7 @@ pub struct InspectorInfo {
|
||||||
pub thread_name: Option<String>,
|
pub thread_name: Option<String>,
|
||||||
pub new_session_tx: UnboundedSender<InspectorSessionProxy>,
|
pub new_session_tx: UnboundedSender<InspectorSessionProxy>,
|
||||||
pub deregister_rx: oneshot::Receiver<()>,
|
pub deregister_rx: oneshot::Receiver<()>,
|
||||||
|
pub url: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InspectorInfo {
|
impl InspectorInfo {
|
||||||
|
@ -340,6 +343,7 @@ impl InspectorInfo {
|
||||||
host: SocketAddr,
|
host: SocketAddr,
|
||||||
new_session_tx: mpsc::UnboundedSender<InspectorSessionProxy>,
|
new_session_tx: mpsc::UnboundedSender<InspectorSessionProxy>,
|
||||||
deregister_rx: oneshot::Receiver<()>,
|
deregister_rx: oneshot::Receiver<()>,
|
||||||
|
url: String,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
host,
|
host,
|
||||||
|
@ -347,6 +351,7 @@ impl InspectorInfo {
|
||||||
thread_name: thread::current().name().map(|n| n.to_owned()),
|
thread_name: thread::current().name().map(|n| n.to_owned()),
|
||||||
new_session_tx,
|
new_session_tx,
|
||||||
deregister_rx,
|
deregister_rx,
|
||||||
|
url,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,7 +363,7 @@ impl InspectorInfo {
|
||||||
"id": self.uuid.to_string(),
|
"id": self.uuid.to_string(),
|
||||||
"title": self.get_title(),
|
"title": self.get_title(),
|
||||||
"type": "node",
|
"type": "node",
|
||||||
// TODO(ry): "url": "file://",
|
"url": self.url.to_string(),
|
||||||
"webSocketDebuggerUrl": self.get_websocket_debugger_url(),
|
"webSocketDebuggerUrl": self.get_websocket_debugger_url(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -376,13 +381,13 @@ impl InspectorInfo {
|
||||||
|
|
||||||
fn get_title(&self) -> String {
|
fn get_title(&self) -> String {
|
||||||
format!(
|
format!(
|
||||||
"[{}] deno{}",
|
"deno{} [pid: {}]",
|
||||||
process::id(),
|
|
||||||
self
|
self
|
||||||
.thread_name
|
.thread_name
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|n| format!(" - {}", n))
|
.map(|n| format!(" - {}", n))
|
||||||
.unwrap_or_default()
|
.unwrap_or_default(),
|
||||||
|
process::id(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -360,7 +360,11 @@ impl WebWorker {
|
||||||
let inspector = js_runtime.inspector();
|
let inspector = js_runtime.inspector();
|
||||||
let session_sender = inspector.get_session_sender();
|
let session_sender = inspector.get_session_sender();
|
||||||
let deregister_rx = inspector.add_deregister_handler();
|
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) = {
|
let (internal_handle, external_handle) = {
|
||||||
|
|
|
@ -115,7 +115,7 @@ impl MainWorker {
|
||||||
// Metrics
|
// Metrics
|
||||||
metrics::init(),
|
metrics::init(),
|
||||||
// Runtime ops
|
// Runtime ops
|
||||||
ops::runtime::init(main_module),
|
ops::runtime::init(main_module.clone()),
|
||||||
ops::worker_host::init(options.create_web_worker_cb.clone()),
|
ops::worker_host::init(options.create_web_worker_cb.clone()),
|
||||||
ops::fs_events::init(),
|
ops::fs_events::init(),
|
||||||
ops::fs::init(),
|
ops::fs::init(),
|
||||||
|
@ -145,7 +145,11 @@ impl MainWorker {
|
||||||
let inspector = js_runtime.inspector();
|
let inspector = js_runtime.inspector();
|
||||||
let session_sender = inspector.get_session_sender();
|
let session_sender = inspector.get_session_sender();
|
||||||
let deregister_rx = inspector.add_deregister_handler();
|
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 {
|
Self {
|
||||||
|
|
Loading…
Reference in a new issue