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 upWebbluetooth Async behaviour #13909
Webbluetooth Async behaviour #13909
Conversation
highfive
commented
Oct 24, 2016
|
Heads up! This PR modifies the following files:
|
|
@jdm r? |
|
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.
This comment has been minimized.
| 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.
This comment has been minimized.
| 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.
This comment has been minimized.
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.
This comment has been minimized.
| @@ -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.
This comment has been minimized.
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.
|
The changes in e550880 are a good improvement. There are still a couple unaddressed comments from my last review, too. |
|
The last thing on my list is to remove the
any idea how should i do it? |
|
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. |
|
Note: There was a commit which moved bluetooth to a new folder, and |
|
@bors-servo: r+ |
|
|
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 -->
|
|
|
oh.. i forget the ports.. :/ |
|
@bors-servo: r+ |
|
|
|
|
|
|
|
@bors-servo: r+ |
|
|
|
|
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 -->
|
|
dati91 commentedOct 24, 2016
•
edited by larsbergstrom
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 -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is