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 upImplement GetAvailability for Bluetooth #15368
Conversation
highfive
commented
Feb 3, 2017
|
|
| let sender = response_async(&p, self); | ||
| self.get_bluetooth_thread().send( | ||
| BluetoothRequest::GetAvailability(sender)).unwrap(); | ||
| return p; |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| @@ -443,6 +443,18 @@ impl BluetoothMethods for Bluetooth { | |||
| return p; | |||
| } | |||
|
|
|||
| #[allow(unrooted_must_root)] | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
nox
Feb 8, 2017
Member
@jdm That sounds very weird, why does Rc<Promise> need unrooted_must_root be allowed?
This comment has been minimized.
This comment has been minimized.
jdm
Feb 8, 2017
Member
Because our rooting lint doesn't understand that Rc<Promise> is safe. I thought there was an issue about it, but I can't find it.
This comment has been minimized.
This comment has been minimized.
| @@ -924,4 +927,12 @@ impl BluetoothManager { | |||
| // TODO: Implement this when supported in lower level | |||
| return Err(BluetoothError::NotSupported); | |||
| } | |||
|
|
|||
| // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-getavailability | |||
| fn get_availability(&mut self) -> BluetoothResponseResult { | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
dati91
Feb 8, 2017
Author
Contributor
This is called via an async promise and the handle function requires a result, because usually a promise could fail, but this will only resolve. Step 2 - 3.
This comment has been minimized.
This comment has been minimized.
| match self.get_adapter() { | ||
| Ok(_) => Ok(BluetoothResponse::GetAvailability(true)), | ||
| Err(_) => Ok(BluetoothResponse::GetAvailability(false)), | ||
| } |
This comment has been minimized.
This comment has been minimized.
|
|
|
Please squash and remove that superfluous |
| @@ -443,6 +443,18 @@ impl BluetoothMethods for Bluetooth { | |||
| return p; | |||
| } | |||
|
|
|||
| #[allow(unrooted_must_root)] | |||
This comment has been minimized.
This comment has been minimized.
| let sender = response_async(&p, self); | ||
| self.get_bluetooth_thread().send( | ||
| BluetoothRequest::GetAvailability(sender)).unwrap(); | ||
| return p; |
This comment has been minimized.
This comment has been minimized.
|
@bors-servo r+ |
|
|
Implement GetAvailability for Bluetooth <!-- Please describe your changes on the following line: --> This implements the [getAvailability](https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-getavailability) function 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 - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- 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/15368) <!-- Reviewable:end -->
|
|
dati91 commentedFeb 3, 2017
•
edited by larsbergstrom
This implements the getAvailability function from the spec.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is