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 upWebdriver - SetWindowSize/Close #8774
Conversation
|
Refactoring would be great. Feel free to file an issue or just make a PR for it :) |
|
r? @jgraham |
|
This is not related to the PR, more related to the refactoring suggesting: The cleanest way I see to maybe do this would be to place the IpcSender on the WebDriverCommandMsg::ScriptCommand instead, but the way to do that would require the use of HKT. The "best" available way to refactor this, (probably not worth it) would be to change from let pipeline_id = try!(self.root_pipeline());
let (sender, receiver) = ipc::channel().unwrap();
let cmd_msg = WebDriverCommandMsg::ScriptCommand(pipeline_id,
WebDriverScriptCommand::GetWindowSize(sender));
self.constellation_chan.send(ConstellationMsg::WebDriverCommand(cmd_msg)).unwrap();
match receiver.recv().unwrap() {}to let (sender, receiver) = ipc::channel().unwrap();
let command = WebDriverScriptCommand::GetWindowSize(sender);
match new_method(command, receiver) {}
fn new_method(command: WebDriverScriptCommand, receiver: IpcReceiver) -> Result {
let pipeline_id = try!(self.root_pipeline());
let cmd_msg = WebDriverCommandMsg::ScriptCommand(pipeline_id, command);
self.constellation_chan.send(ConstellationMsg::WebDriverCommand(cmd_msg)).unwrap();
receiver.recv().unwrap()
}
|
|
Reviewed 4 of 4 files at r1. components/script/webdriver_handlers.rs, line 256 [r1] (raw file): components/script/webdriver_handlers.rs, line 262 [r1] (raw file): components/script/webdriver_handlers.rs, line 267 [r1] (raw file): components/webdriver_server/lib.rs, line 380 [r1] (raw file): components/webdriver_server/lib.rs, line 381 [r1] (raw file): components/webdriver_server/lib.rs, line 395 [r1] (raw file): components/webdriver_server/lib.rs, line 396 [r1] (raw file): Comments from the review on Reviewable.io |
|
@jgraham Thank you for reviewing this. When I have time, I will make the appropriate changes. |
|
Review status: all files reviewed at latest revision, 7 unresolved discussions. components/script/webdriver_handlers.rs, line 256 [r1] (raw file): Comments from the review on Reviewable.io |
|
Review status: all files reviewed at latest revision, 2 unresolved discussions. components/script/webdriver_handlers.rs, line 256 [r1] (raw file): components/webdriver_server/lib.rs, line 395 [r1] (raw file): Comments from the review on Reviewable.io |
|
@craftytrickster Why'd you close this? |
|
I was unsure how to do several things here in the code, and I felt that the PR was not really in a good state to be merged. If you'd like I can reopen it. |
craftytrickster commentedDec 2, 2015
#8623
Please let me know if any changes are needed. Additionally, I noticed that many of the methods in
lib.rsuse the same code repetition in several places.Please let me know if I should refactor this bit of logic into a function in order to avoid code duplication.
Thanks.