Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Issue 2718583002: Refactor WebBluetoothServiceClient in the web_bluetooth.mojom (Closed)

Created:
3 years, 10 months ago by juncai
Modified:
3 years, 8 months ago
Reviewers:
haraken, scheib, ortuno, dcheng
CC:
Aaron Boodman, abarth-chromium, blink-reviews, blink-reviews-api_chromium.org, chromium-reviews, darin (slow to review), darin-cc_chromium.org, dglazkov+blink, haraken, jam, ortuno+watch_chromium.org, qsr+mojo_chromium.org, scheib+watch_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Refactor WebBluetoothServiceClient in the web_bluetooth.mojom This CL changes the WebBluetoothServiceClient in the web_bluetooth.mojom into two clients: WebBluetoothCharacteristicClient WebBluetoothServerClient BUG=682050 Review-Url: https://codereview.chromium.org/2718583002 Cr-Commit-Position: refs/heads/master@{#459224} Committed: https://chromium.googlesource.com/chromium/src/+/5fbf7e618bca38528d65a5f673b030fb0b2cd684

Patch Set 1 : refactor WebBluetoothServiceClient in the web_bluetooth.mojom #

Patch Set 2 : fix content unit tests #

Total comments: 18

Patch Set 3 : address comments #

Total comments: 42

Patch Set 4 : address more comments #

Total comments: 22

Patch Set 5 : address more comments #

Total comments: 8

Patch Set 6 : address more comments #

Patch Set 7 : added new layout test #

Total comments: 4

Patch Set 8 : address dcheng@'s comments #

Patch Set 9 : merge master and resolve conflicts #

Patch Set 10 : pass interface pointer to the Bluetooth service implementation #

Patch Set 11 : address comments from: https://codereview.chromium.org/2751293002/ #

Total comments: 18

Patch Set 12 : address dcheng@'s comments #

Patch Set 13 : address scheib@'s comment #

Patch Set 14 : rebase #

Patch Set 15 : rebase #

Patch Set 16 : address dcheng@'s comment #

Total comments: 2

Patch Set 17 : use AssociatedBindingSet #

Patch Set 18 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+408 lines, -269 lines) Patch
M content/browser/bluetooth/frame_connected_bluetooth_devices.h View 1 2 3 4 5 6 7 4 chunks +5 lines, -2 lines 0 comments Download
M content/browser/bluetooth/frame_connected_bluetooth_devices.cc View 1 2 3 4 5 6 7 6 chunks +25 lines, -5 lines 0 comments Download
M content/browser/bluetooth/frame_connected_bluetooth_devices_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 19 chunks +75 lines, -34 lines 0 comments Download
M content/browser/bluetooth/web_bluetooth_service_impl.h View 1 2 3 4 5 6 7 8 9 6 chunks +6 lines, -6 lines 0 comments Download
M content/browser/bluetooth/web_bluetooth_service_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 chunks +48 lines, -19 lines 0 comments Download
A third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/concurrent-starts-and-receive-notification.html View 1 2 3 4 5 6 10 11 12 13 14 15 1 chunk +32 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/bluetooth/server/connect/connect-twice.html View 1 2 3 4 5 6 10 11 12 13 14 15 1 chunk +26 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/bluetooth/server/connect/same-gatt-server-both-receive-disconnect-event.html View 1 2 3 4 5 6 10 11 12 13 14 15 1 chunk +25 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/bluetooth/server/disconnect/disconnect-after-request-disconnection.html View 1 2 3 4 5 6 1 chunk +32 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/bluetooth/Bluetooth.h View 1 2 3 4 5 6 7 8 3 chunks +2 lines, -39 lines 0 comments Download
M third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +1 line, -59 lines 0 comments Download
M third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h View 1 2 3 4 5 6 7 8 2 chunks +1 line, -17 lines 0 comments Download
M third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.cpp View 1 2 3 4 5 6 7 8 3 chunks +2 lines, -30 lines 0 comments Download
M third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 5 chunks +8 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 7 chunks +10 lines, -19 lines 0 comments Download
M third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 4 chunks +36 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 5 chunks +56 lines, -9 lines 0 comments Download
M third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.mojom View 1 2 3 4 5 6 7 8 9 10 4 chunks +18 lines, -17 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 120 (82 generated)
juncai
Please take a look.
3 years, 10 months ago (2017-02-23 23:54:12 UTC) #8
ortuno
https://codereview.chromium.org/2718583002/diff/20001/content/browser/bluetooth/frame_connected_bluetooth_devices.cc File content/browser/bluetooth/frame_connected_bluetooth_devices.cc (right): https://codereview.chromium.org/2718583002/diff/20001/content/browser/bluetooth/frame_connected_bluetooth_devices.cc#newcode40 content/browser/bluetooth/frame_connected_bluetooth_devices.cc:40: if (device_id_to_connection_map_.find(device_id) != This is another place where we ...
3 years, 10 months ago (2017-02-24 03:28:52 UTC) #11
juncai
https://codereview.chromium.org/2718583002/diff/20001/content/browser/bluetooth/frame_connected_bluetooth_devices.cc File content/browser/bluetooth/frame_connected_bluetooth_devices.cc (right): https://codereview.chromium.org/2718583002/diff/20001/content/browser/bluetooth/frame_connected_bluetooth_devices.cc#newcode40 content/browser/bluetooth/frame_connected_bluetooth_devices.cc:40: if (device_id_to_connection_map_.find(device_id) != On 2017/02/24 03:28:52, ortuno wrote: > ...
3 years, 9 months ago (2017-03-01 02:04:12 UTC) #16
ortuno
https://codereview.chromium.org/2718583002/diff/40001/content/browser/bluetooth/frame_connected_bluetooth_devices.cc File content/browser/bluetooth/frame_connected_bluetooth_devices.cc (right): https://codereview.chromium.org/2718583002/diff/40001/content/browser/bluetooth/frame_connected_bluetooth_devices.cc#newcode81 content/browser/bluetooth/frame_connected_bluetooth_devices.cc:81: if (device_id_iter->second.second) { When would a device have a ...
3 years, 9 months ago (2017-03-01 04:52:06 UTC) #17
juncai
https://codereview.chromium.org/2718583002/diff/20001/content/browser/bluetooth/web_bluetooth_service_impl.cc File content/browser/bluetooth/web_bluetooth_service_impl.cc (right): https://codereview.chromium.org/2718583002/diff/20001/content/browser/bluetooth/web_bluetooth_service_impl.cc#newcode956 content/browser/bluetooth/web_bluetooth_service_impl.cc:956: std::move(client)); On 2017/03/01 02:04:12, juncai wrote: > On 2017/02/24 ...
3 years, 9 months ago (2017-03-02 03:23:50 UTC) #20
ortuno
https://codereview.chromium.org/2718583002/diff/40001/content/browser/bluetooth/frame_connected_bluetooth_devices.cc File content/browser/bluetooth/frame_connected_bluetooth_devices.cc (right): https://codereview.chromium.org/2718583002/diff/40001/content/browser/bluetooth/frame_connected_bluetooth_devices.cc#newcode81 content/browser/bluetooth/frame_connected_bluetooth_devices.cc:81: if (device_id_iter->second.second) { On 2017/03/02 at 03:23:38, juncai wrote: ...
3 years, 9 months ago (2017-03-06 11:31:20 UTC) #23
juncai
https://codereview.chromium.org/2718583002/diff/40001/content/browser/bluetooth/frame_connected_bluetooth_devices.cc File content/browser/bluetooth/frame_connected_bluetooth_devices.cc (right): https://codereview.chromium.org/2718583002/diff/40001/content/browser/bluetooth/frame_connected_bluetooth_devices.cc#newcode81 content/browser/bluetooth/frame_connected_bluetooth_devices.cc:81: if (device_id_iter->second.second) { On 2017/03/06 11:31:20, ortuno wrote: > ...
3 years, 9 months ago (2017-03-09 07:30:57 UTC) #28
ortuno
lgtm! https://codereview.chromium.org/2718583002/diff/80001/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h File third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h (right): https://codereview.chromium.org/2718583002/diff/80001/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h#newcode34 third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h:34: public ContextLifecycleObserver { Does BluetoothDevice still need to ...
3 years, 9 months ago (2017-03-09 23:16:38 UTC) #29
juncai
https://codereview.chromium.org/2718583002/diff/80001/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h File third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h (right): https://codereview.chromium.org/2718583002/diff/80001/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h#newcode34 third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h:34: public ContextLifecycleObserver { On 2017/03/09 23:16:38, ortuno wrote: > ...
3 years, 9 months ago (2017-03-10 03:57:02 UTC) #34
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2718583002/100001
3 years, 9 months ago (2017-03-10 03:57:44 UTC) #37
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/382641)
3 years, 9 months ago (2017-03-10 04:05:23 UTC) #39
juncai
dcheng@chromium.org: Please review changes in //third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.mojom
3 years, 9 months ago (2017-03-10 04:10:58 UTC) #41
ortuno
https://codereview.chromium.org/2718583002/diff/80001/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp File third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp (right): https://codereview.chromium.org/2718583002/diff/80001/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp#newcode130 third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp:130: cleanupDisconnectedDeviceAndFireEvent(); On 2017/03/10 at 03:57:02, juncai wrote: > On ...
3 years, 9 months ago (2017-03-10 04:37:09 UTC) #42
juncai
https://codereview.chromium.org/2718583002/diff/80001/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp File third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp (right): https://codereview.chromium.org/2718583002/diff/80001/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp#newcode130 third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.cpp:130: cleanupDisconnectedDeviceAndFireEvent(); On 2017/03/10 04:37:09, ortuno wrote: > On 2017/03/10 ...
3 years, 9 months ago (2017-03-10 22:31:34 UTC) #47
dcheng
It feels unusual to pass back an interface request rather than just passing an interface ...
3 years, 9 months ago (2017-03-13 07:15:57 UTC) #48
juncai
On 2017/03/13 07:15:57, dcheng wrote: > It feels unusual to pass back an interface request ...
3 years, 9 months ago (2017-03-13 20:00:07 UTC) #51
juncai
https://codereview.chromium.org/2718583002/diff/120001/content/browser/bluetooth/frame_connected_bluetooth_devices.h File content/browser/bluetooth/frame_connected_bluetooth_devices.h (right): https://codereview.chromium.org/2718583002/diff/120001/content/browser/bluetooth/frame_connected_bluetooth_devices.h#newcode75 content/browser/bluetooth/frame_connected_bluetooth_devices.h:75: blink::mojom::WebBluetoothServerClientAssociatedPtr>, On 2017/03/13 07:15:57, dcheng wrote: > Nit: I'd ...
3 years, 9 months ago (2017-03-13 20:00:17 UTC) #52
juncai
On 2017/03/13 07:15:57, dcheng wrote: > It feels unusual to pass back an interface request ...
3 years, 9 months ago (2017-03-16 01:27:09 UTC) #59
juncai
3 years, 9 months ago (2017-03-16 18:07:40 UTC) #63
juncai
I created a new patch in this CL which passes an interface pointer to the ...
3 years, 9 months ago (2017-03-16 18:10:53 UTC) #64
scheib
lgtm
3 years, 9 months ago (2017-03-16 18:14:21 UTC) #65
dcheng
Sorry for the review delay. Mostly nits and one question to help me understand how ...
3 years, 9 months ago (2017-03-16 22:20:30 UTC) #68
juncai
scheib@, I answered the question in the comment. Can you correct it if the answer ...
3 years, 9 months ago (2017-03-17 00:53:57 UTC) #71
scheib
https://codereview.chromium.org/2718583002/diff/200001/content/browser/bluetooth/web_bluetooth_service_impl.cc File content/browser/bluetooth/web_bluetooth_service_impl.cc (right): https://codereview.chromium.org/2718583002/diff/200001/content/browser/bluetooth/web_bluetooth_service_impl.cc#newcode1020 content/browser/bluetooth/web_bluetooth_service_impl.cc:1020: iter->second->gatt_notify_session->IsActive()) { On 2017/03/17 00:53:56, juncai wrote: > On ...
3 years, 9 months ago (2017-03-17 01:25:15 UTC) #72
juncai
https://codereview.chromium.org/2718583002/diff/200001/content/browser/bluetooth/web_bluetooth_service_impl.cc File content/browser/bluetooth/web_bluetooth_service_impl.cc (right): https://codereview.chromium.org/2718583002/diff/200001/content/browser/bluetooth/web_bluetooth_service_impl.cc#newcode1020 content/browser/bluetooth/web_bluetooth_service_impl.cc:1020: iter->second->gatt_notify_session->IsActive()) { On 2017/03/17 01:25:15, scheib wrote: > On ...
3 years, 9 months ago (2017-03-17 17:52:59 UTC) #77
ortuno
Do we remove sessions from the map if a device disconnects? On Sat, Mar 18, ...
3 years, 9 months ago (2017-03-17 20:58:14 UTC) #80
ortuno
Do we remove sessions from the map if a device disconnects? On Sat, Mar 18, ...
3 years, 9 months ago (2017-03-17 20:58:15 UTC) #81
juncai
On 2017/03/17 20:58:15, ortuno wrote: > Do we remove sessions from the map if a ...
3 years, 9 months ago (2017-03-17 21:12:07 UTC) #82
juncai
ping, :).
3 years, 9 months ago (2017-03-22 01:31:48 UTC) #93
dcheng
Sorry for the review delay. I've been thinking about this, and I feel like I ...
3 years, 9 months ago (2017-03-22 10:25:22 UTC) #96
juncai
On 2017/03/22 10:25:22, dcheng wrote: > Sorry for the review delay. > > I've been ...
3 years, 9 months ago (2017-03-22 22:04:29 UTC) #101
dcheng
(talked with juncai@ about the semantics, which are basically 'last one to connect / request ...
3 years, 9 months ago (2017-03-23 00:16:57 UTC) #102
juncai
https://codereview.chromium.org/2718583002/diff/300001/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.h File third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.h (right): https://codereview.chromium.org/2718583002/diff/300001/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.h#newcode140 third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.h:140: mojo::AssociatedBinding<mojom::blink::WebBluetoothCharacteristicClient>>> On 2017/03/23 00:16:57, dcheng wrote: > Can this ...
3 years, 9 months ago (2017-03-23 05:34:19 UTC) #107
dcheng
LGTM Honestly, I'm not actually sure that we need to keep the set of bindings ...
3 years, 9 months ago (2017-03-23 05:42:13 UTC) #108
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2718583002/340001
3 years, 9 months ago (2017-03-23 20:23:30 UTC) #115
commit-bot: I haz the power
Committed patchset #18 (id:340001) as https://chromium.googlesource.com/chromium/src/+/5fbf7e618bca38528d65a5f673b030fb0b2cd684
3 years, 9 months ago (2017-03-23 21:22:55 UTC) #118
ortuno
fwiw I think we should change to the original approach and keep returning the client ...
3 years, 9 months ago (2017-03-28 09:34:29 UTC) #119
juncai
3 years, 8 months ago (2017-03-29 17:31:14 UTC) #120
Message was sent while issue was closed.
On 2017/03/28 09:34:29, ortuno wrote:
> fwiw I think we should change to the original approach and keep returning the
> client from the browser. I see a couple of problems with this approach:
> 
> 1. Both CreateGattConnection and StartNotifySession are async calls which
means
> that it's possible to send events i.e. notifications and disconnection events
> before callbacks are run and promises resolve.
> 2. We are holding a set of mostly obsolete clients which I think is
unnecessary
> and wasteful.
> 3. Even when CreateGattConnection/StartNotifySession fail we end up with a
bound
> client.
> 
> We could obviously add logic to fix all of these issues i.e. close bindings
when
> connection/notifications fail, add logic to remove obsolete clients, etc. but
I
> think the other approach results in less code and avoids subtle race
conditions.

For the binding set that was added in this CL, the following CL changes it back:
https://codereview.chromium.org/2752663002/

Powered by Google App Engine
This is Rietveld 408576698