Skip to content

Webbluetooth Async behaviour#13909

Merged
bors-servo merged 1 commit intoservo:masterfrom
dati91:promise-queue
Nov 8, 2016
Merged

Webbluetooth Async behaviour#13909
bors-servo merged 1 commit intoservo:masterfrom
dati91:promise-queue

Conversation

@dati91
Copy link
Copy Markdown
Contributor

@dati91 dati91 commented Oct 24, 2016

Note: depends on #13612

The current WBT communication is synchronous. With this, it should work properly (except the disconnect function, which will need some more work, because the current implementation differ from the spec).

  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • There are tests for these changes

This change is Reviewable

@highfive
Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @asajeffrey: components/constellation/constellation.rs, components/constellation/pipeline.rs
  • @fitzgen: components/script_traits/lib.rs, components/script_traits/lib.rs, components/script/script_thread.rs, components/script/dom/mod.rs, components/script/dom/webidls/Window.webidl, components/script/dom/window.rs, components/script/dom/bluetoothremotegattserver.rs, components/script/dom/bluetoothremotegattservice.rs, components/script/dom/webidls/TestRunner.webidl, components/script/network_listener.rs, components/script/dom/testrunner.rs, components/script/dom/bluetooth.rs, components/script/dom/bluetoothremotegattdescriptor.rs, components/script/dom/bluetoothremotegattcharacteristic.rs
  • @KiChjang: components/script_traits/lib.rs, components/script_traits/lib.rs, components/script/script_thread.rs, components/net/lib.rs, components/script/dom/mod.rs, components/script/dom/webidls/Window.webidl, components/net/bluetooth_thread.rs, components/script/dom/window.rs, components/script/dom/bluetoothremotegattserver.rs, components/net/bluetooth_test.rs, components/script/dom/bluetoothremotegattservice.rs, components/net_traits/bluetooth_thread.rs, components/net_traits/bluetooth_thread.rs, components/script/dom/webidls/TestRunner.webidl, components/script/network_listener.rs, components/script/dom/testrunner.rs, components/script/dom/bluetooth.rs, components/script/dom/bluetoothremotegattdescriptor.rs, components/script/dom/bluetoothremotegattcharacteristic.rs, components/net/Cargo.toml

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Oct 24, 2016
@dati91
Copy link
Copy Markdown
Contributor Author

dati91 commented Oct 24, 2016

@jdm r?

Copy link
Copy Markdown
Member

@jdm jdm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! It's exciting to see all of this synchronous code become asynchronous.

}));
let listener = NetworkListener {
context: context,
//script_chan: receiver.root().global().r().networking_task_source(),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this.

}

pub fn response_async<T: AsyncBluetoothListener + Reflectable + 'static>(
//chan: Box<ScriptChan + Send>,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this.

pub fn response_async<T: AsyncBluetoothListener + Reflectable + 'static>(
//chan: Box<ScriptChan + Send>,
promise: &Rc<Promise>,
receiver: Trusted<T>) -> IpcSender<BluetoothResponseMsg> {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would make more sense to take a &T argument and store the result of Trusted::new(receiver) instead.

RequestDevice(BluetoothDeviceMsg),
GATTServerConnect(bool),
GATTServerDisconnect(bool),
//GATTServerDisconnect(bool),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this?

pub enum BluetoothResponse {
RequestDevice(BluetoothDeviceMsg),
GATTServerConnect(bool),
RequestDevice(BluetoothResult<BluetoothDeviceMsg>),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that every response includes a result value, it probably makes more sense to use BluetoothResult<BluetoothResponse> instead. This will mean less code duplication for handling errors in places like bluetoothremotegattcharacteristic.rs. It could even be handled inside BluetoothResponseListener::response, so none of the rest of the implementations of AsyncBluetoothListener need to care about errors.

@jdm jdm added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. S-needs-rebase There are merge conflict errors. and removed S-awaiting-review There is new code that needs to be reviewed. labels Nov 1, 2016
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Nov 2, 2016
@jdm jdm added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Nov 2, 2016
@jdm
Copy link
Copy Markdown
Member

jdm commented Nov 2, 2016

The changes in e550880 are a good improvement. There are still a couple unaddressed comments from my last review, too.

@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Nov 2, 2016
@dati91
Copy link
Copy Markdown
Contributor Author

dati91 commented Nov 2, 2016

The last thing on my list is to remove the Option from Option<TrustedPromise>
But i having trouble with accessing it

let promise = self.promise.root();
              ^^^^ cannot move out of borrowed content

any idea how should i do it?

@jdm
Copy link
Copy Markdown
Member

jdm commented Nov 2, 2016

You're right, I looked at the code and I don't see a way to make that change right now. It's fine as-is.

@jdm jdm added S-blocked-on-external Something, somewhere else, needs to happen before this PR can be merged. and removed S-awaiting-review There is new code that needs to be reviewed. labels Nov 2, 2016
@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Nov 7, 2016
@dati91 dati91 changed the title [WIP] WebBluetooth async behaviour Webbluetooth Async behaviour Nov 7, 2016
@dati91
Copy link
Copy Markdown
Contributor Author

dati91 commented Nov 7, 2016

Note: There was a commit which moved bluetooth to a new folder, and Action can be implemented in its own crate, so i moved the impl to net_traits. Everything else should be the same.

@jdm jdm removed the S-blocked-on-external Something, somewhere else, needs to happen before this PR can be merged. label Nov 7, 2016
@jdm
Copy link
Copy Markdown
Member

jdm commented Nov 7, 2016

@bors-servo: r+

@bors-servo
Copy link
Copy Markdown
Contributor

📌 Commit d9e1cf3 has been approved by jdm

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. S-needs-rebase There are merge conflict errors. labels Nov 7, 2016
@bors-servo
Copy link
Copy Markdown
Contributor

⌛ Testing commit d9e1cf3 with merge 5770105...

bors-servo pushed a commit that referenced this pull request Nov 7, 2016
Webbluetooth Async behaviour

<!-- Please describe your changes on the following line: -->

Note: depends on #13612

The current WBT communication is synchronous. With this, it should work properly (except the disconnect function, which will need some more work, because the current implementation differ from the spec).

<!-- 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

<!-- Either: -->
- [X] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---

This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13909)

<!-- Reviewable:end -->
@bors-servo
Copy link
Copy Markdown
Contributor

💔 Test failed - linux-dev

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Nov 7, 2016
@dati91
Copy link
Copy Markdown
Contributor Author

dati91 commented Nov 7, 2016

oh.. i forget the ports.. :/

@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Nov 7, 2016
@jdm
Copy link
Copy Markdown
Member

jdm commented Nov 7, 2016

@bors-servo: r+

@bors-servo
Copy link
Copy Markdown
Contributor

📌 Commit a18490b has been approved by jdm

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Nov 7, 2016
@bors-servo
Copy link
Copy Markdown
Contributor

🔒 Merge conflict

@bors-servo
Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #13918) made this pull request unmergeable. Please resolve the merge conflicts.

@highfive highfive added S-needs-rebase There are merge conflict errors. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Nov 7, 2016
@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Nov 8, 2016
@jdm
Copy link
Copy Markdown
Member

jdm commented Nov 8, 2016

@bors-servo: r+

@bors-servo
Copy link
Copy Markdown
Contributor

📌 Commit e7e7c74 has been approved by jdm

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. S-needs-rebase There are merge conflict errors. labels Nov 8, 2016
@bors-servo
Copy link
Copy Markdown
Contributor

⌛ Testing commit e7e7c74 with merge 1153ca9...

bors-servo pushed a commit that referenced this pull request Nov 8, 2016
Webbluetooth Async behaviour

<!-- Please describe your changes on the following line: -->

Note: depends on #13612

The current WBT communication is synchronous. With this, it should work properly (except the disconnect function, which will need some more work, because the current implementation differ from the spec).

<!-- 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

<!-- Either: -->
- [X] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---

This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13909)

<!-- Reviewable:end -->
@bors-servo
Copy link
Copy Markdown
Contributor

@bors-servo bors-servo merged commit e7e7c74 into servo:master Nov 8, 2016
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants