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 upBluetooth manager cleanup #14604
Bluetooth manager cleanup #14604
Conversation
|
r? @jdm |
351d8d9
to
735edb0
|
This is a great improvement! I only have a couple small style changes that would improve it. |
| @@ -332,6 +314,18 @@ impl BluetoothManager { | |||
| self.adapter.clone() | |||
| } | |||
|
|
|||
| fn get_adapter_or_return_error(&mut self) -> BluetoothResult<BluetoothAdapter> { | |||
This comment has been minimized.
This comment has been minimized.
jdm
Dec 15, 2016
Member
Let's call this get_adapter, since it's now just a fallible method like many others that return errors.
| // Step 12: Missing, because it is optional. | ||
| } | ||
|
|
||
| // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-connect | ||
| fn gatt_server_connect(&mut self, device_id: String, sender: IpcSender<BluetoothResponseResult>) { | ||
| fn gatt_server_connect(&mut self, device_id: String) | ||
| -> BluetoothResponseResult { |
This comment has been minimized.
This comment has been minimized.
| fn gatt_server_disconnect(&mut self, device_id: String, sender: IpcSender<BluetoothResult<bool>>) { | ||
| let mut adapter = get_adapter_or_return_error!(self, sender); | ||
| fn gatt_server_disconnect(&mut self, device_id: String) | ||
| -> BluetoothResult<bool> { |
This comment has been minimized.
This comment has been minimized.
| }, | ||
| BluetoothRequest::EnableNotification(id, enable, sender) => { | ||
| self.enable_notification(id, enable, sender) | ||
| let _ = sender.send(self.enable_notification(id, enable)); | ||
| }, | ||
| BluetoothRequest::WatchAdvertisements(id, sender) => { | ||
| self.watch_advertisements(id, sender) |
This comment has been minimized.
This comment has been minimized.
|
If you squash the commits into one, I'll merge them! |
97f58db
to
85119eb
|
@bors-servo: r+ |
|
|
Bluetooth manager cleanup <!-- Please describe your changes on the following line: --> --- <!-- 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 - [x] These changes fix #14590 <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because it's a cleanup <!-- 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/14604) <!-- Reviewable:end -->
|
|
|
@bors-servo: retry |
|
|
|
|
impowski commentedDec 15, 2016
•
edited
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is