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

Bluetooth manager cleanup #14604

Merged
merged 1 commit into from Dec 15, 2016
Merged

Conversation

@impowski
Copy link
Contributor

impowski commented Dec 15, 2016


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #14590
  • There are tests for these changes OR
  • These changes do not require tests because it's a cleanup

This change is Reviewable

@impowski
Copy link
Contributor Author

impowski commented Dec 15, 2016

r? @jdm

@highfive highfive assigned jdm and unassigned emilio Dec 15, 2016
@impowski impowski force-pushed the impowski:bluetooth_manager_cleanup branch from 351d8d9 to 735edb0 Dec 15, 2016
Copy link
Member

jdm left a comment

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.

@jdm

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.

@jdm

jdm Dec 15, 2016

Member

Let's leave the return type on the previous line.

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.

@jdm

jdm Dec 15, 2016

Member

nit: move the return type to the previous line.

},
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.

@jdm

jdm Dec 15, 2016

Member

What about this one?

@jdm
jdm approved these changes Dec 15, 2016
@jdm
Copy link
Member

jdm commented Dec 15, 2016

If you squash the commits into one, I'll merge them!

@impowski impowski force-pushed the impowski:bluetooth_manager_cleanup branch from 97f58db to 85119eb Dec 15, 2016
@jdm
Copy link
Member

jdm commented Dec 15, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Dec 15, 2016

📌 Commit 85119eb has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Dec 15, 2016

Testing commit 85119eb with merge 1fba5f7...

bors-servo added a commit that referenced this pull request Dec 15, 2016
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
Copy link
Contributor

bors-servo commented Dec 15, 2016

💔 Test failed - linux-rel-css

@jdm
Copy link
Member

jdm commented Dec 15, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Dec 15, 2016

Previous build results for android, arm32, arm64, linux-dev, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-dev are reusable. Rebuilding only linux-rel-css...

@bors-servo
Copy link
Contributor

bors-servo commented Dec 15, 2016

@bors-servo bors-servo mentioned this pull request Dec 15, 2016
3 of 3 tasks complete
@bors-servo bors-servo merged commit 85119eb into servo:master Dec 15, 2016
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@impowski impowski deleted the impowski:bluetooth_manager_cleanup branch Dec 15, 2016
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.

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