Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webbluetooth Async behaviour #13909

Merged
merged 1 commit into from Nov 8, 2016
Merged

Webbluetooth Async behaviour #13909

merged 1 commit into from Nov 8, 2016

Conversation

@dati91
Copy link
Contributor

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

highfive commented Oct 24, 2016

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
@dati91
Copy link
Contributor Author

dati91 commented Oct 24, 2016

@jdm r?

Copy link
Member

jdm left a comment

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(),

This comment has been minimized.

@jdm

jdm Nov 1, 2016

Member

Remove this.

self.get_bluetooth_thread().send(BluetoothMethodMsg::RequestDevice(option, sender)).unwrap();
}
}

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

This comment has been minimized.

@jdm

jdm Nov 1, 2016

Member

Remove this.

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

This comment has been minimized.

@jdm

jdm Nov 1, 2016

Member

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),

This comment has been minimized.

@jdm

jdm Nov 1, 2016

Member

Can we remove this?

@@ -85,20 +85,19 @@ pub enum BluetoothRequest {

#[derive(Deserialize, Serialize)]
pub enum BluetoothResponse {
RequestDevice(BluetoothDeviceMsg),
GATTServerConnect(bool),
RequestDevice(BluetoothResult<BluetoothDeviceMsg>),

This comment has been minimized.

@jdm

jdm Nov 1, 2016

Member

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
Copy link
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.

@dati91
Copy link
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
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.

@dati91 dati91 force-pushed the dati91:promise-queue branch from 629ab62 to d9e1cf3 Nov 7, 2016
@dati91 dati91 changed the title [WIP] WebBluetooth async behaviour Webbluetooth Async behaviour Nov 7, 2016
@dati91
Copy link
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
Copy link
Member

jdm commented Nov 7, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Nov 7, 2016

📌 Commit d9e1cf3 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Nov 7, 2016

Testing commit d9e1cf3 with merge 5770105...

bors-servo added 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
Contributor

bors-servo commented Nov 7, 2016

💔 Test failed - linux-dev

@dati91
Copy link
Contributor Author

dati91 commented Nov 7, 2016

oh.. i forget the ports.. :/

@dati91 dati91 force-pushed the dati91:promise-queue branch from d9e1cf3 to a18490b Nov 7, 2016
@jdm
Copy link
Member

jdm commented Nov 7, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Nov 7, 2016

📌 Commit a18490b has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Nov 7, 2016

🔒 Merge conflict

@bors-servo
Copy link
Contributor

bors-servo commented Nov 7, 2016

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

@dati91 dati91 force-pushed the dati91:promise-queue branch from a18490b to e7e7c74 Nov 8, 2016
@jdm
Copy link
Member

jdm commented Nov 8, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Nov 8, 2016

📌 Commit e7e7c74 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Nov 8, 2016

Testing commit e7e7c74 with merge 1153ca9...

bors-servo added 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
Contributor

bors-servo commented Nov 8, 2016

@bors-servo bors-servo merged commit e7e7c74 into servo:master Nov 8, 2016
2 of 3 checks passed
2 of 3 checks passed
continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.