Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd support for launching devtools server on random port #25941
Conversation
|
r? @paulrouget |
|
Thanks a lot! Almost there. Let me know if you need help with testing the Windows implementation. |
|
For now, let's leave out the Windows/Hololens code. I will implement a proper UI notification in another PR. |
| debug!("Devtools Server running at {}", p); | ||
| (self.0.on_devtools_started)(p.into()) | ||
| }, | ||
| Err(()) => eprintln!("Error running devtools server"), |
This comment has been minimized.
This comment has been minimized.
paulrouget
Mar 13, 2020
Contributor
Error can't be lost here, we need to let the embedder know that something didn't work. Maybe the callback on_devtools_started can take 2 arguments. A result, and a port.
Look at CPromptResult for example.
#[repr(C)]
pub enum CDevtoolsServerState {
Started,
Error,
}|
I hope this is what you expected to see with |
|
Thank you! It looks good. Please address the 2 minor comments, and then I think it's good to go. |
| @@ -515,6 +515,12 @@ where | |||
| debug!("MediaSessionEvent received"); | |||
| // TODO(ferjm): MediaSession support for Glutin based browsers. | |||
| }, | |||
| EmbedderMsg::OnDevtoolsStarted(port) => { | |||
| match port { | |||
| Ok(p) => info!("Devtools Server running at {}", p), | |||
This comment has been minimized.
This comment has been minimized.
| @@ -229,6 +229,7 @@ pub struct CHostCallbacks { | |||
| default: *const c_char, | |||
| trusted: bool, | |||
| ) -> *const c_char, | |||
| pub on_devtools_started: extern "C" fn(port: c_uint, result: CDevtoolsServerState), | |||
This comment has been minimized.
This comment has been minimized.
|
Done! |
|
|
||
| fn on_devtools_started(&self, port: Result<u16, ()>) { | ||
| match port { | ||
| Ok(p) => info!("Devtools Server running at {}", p), |
This comment has been minimized.
This comment has been minimized.
| fn on_devtools_started(&self, port: Result<u16, ()>) { | ||
| match port { | ||
| Ok(p) => { | ||
| info!("Devtools Server running at {}", p); |
This comment has been minimized.
This comment has been minimized.
|
|
||
| fn on_devtools_started(&self, port: Result<u16, ()>) { | ||
| match port { | ||
| Ok(p) => info!("Devtools Server running at {}", p), |
This comment has been minimized.
This comment has been minimized.
|
Sorry, I should have made those changes with the previous one. |
|
@bors-servo r+ Once this lands, I will implement the UWP part. |
|
|
Add support for launching devtools server on random port In case the default port(6000) or the port specified by user for devtools server is already taken, random port will be assigned to it which is reported to the embedding layer for display to user. r?@jdm @paulrouget <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #25907 (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
|
|
|
Formatting issues: git apply this: diff --git a/support/hololens/ServoApp/ServoControl/Servo.cpp b/support/hololens/ServoApp/ServoControl/Servo.cpp
index ab48351248..d2d04c6fa3 100644
--- a/support/hololens/ServoApp/ServoControl/Servo.cpp
+++ b/support/hololens/ServoApp/ServoControl/Servo.cpp
@@ -87,7 +87,8 @@ const char *prompt_input(const char *message, const char *default,
}
}
-void on_devtools_started(Servo::DevtoolsServerState result, const unsigned int port) {
+void on_devtools_started(Servo::DevtoolsServerState result,
+ const unsigned int port) {
// FIXME
} |
Assign random port to devtools server in case user does not specify a port explicitly and report it to the embedding layer for display to user.
|
@bors-servo r+ |
|
|
Add support for launching devtools server on random port In case the default port(6000) or the port specified by user for devtools server is already taken, random port will be assigned to it which is reported to the embedding layer for display to user. r?@jdm @paulrouget <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #25907 (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
|
|
|
@bors-servo retry |
|
|
kunalmohan commentedMar 10, 2020
In case the default port(6000) or the port specified by user for
devtools server is already taken, random port will be assigned to
it which is reported to the embedding layer for display to user.
r?@jdm @paulrouget
./mach build -ddoes not report any errors./mach test-tidydoes not report any errors