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

Issue 1848603002: Remove single observer assumption in WebUSBClient. (Closed)

Created:
4 years, 8 months ago by Reilly Grant (use Gerrit)
Modified:
4 years, 8 months ago
Reviewers:
haraken, oilpan-reviews, sof
CC:
blink-reviews, blink-reviews-api_chromium.org, chromium-reviews, darin-cc_chromium.org, dglazkov+blink, jam, mkwst+moarreviews-renderer_chromium.org, mlamouri+watch-content_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Remove single observer assumption in WebUSBClient. This patch removes the assumption in WebUSBClient that there will be a single instance of blink::USB active at once. Delayed garbage collection can mean that an old instance exists for some time after a new instance has added itself as an observer. With only a single observer slot the old instance could accidentally unregister the new instance when it was destroyed. BUG=598855 Committed: https://crrev.com/e0584330d7c9ddf1887547d58cc2a7e0cb92fe1b Cr-Commit-Position: refs/heads/master@{#384763}

Patch Set 1 #

Total comments: 5

Patch Set 2 : Add a pre-finalizer to USB. #

Total comments: 2

Patch Set 3 : Register pre-finalizer. #

Total comments: 1

Patch Set 4 : DCHECK that m_client has been cleared before destruction. #

Total comments: 2

Patch Set 5 : Use EAGERLY_FINALIZE() instead. #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+32 lines, -19 lines) Patch
M content/renderer/usb/web_usb_client_impl.h View 2 chunks +3 lines, -2 lines 0 comments Download
M content/renderer/usb/web_usb_client_impl.cc View 4 chunks +19 lines, -11 lines 1 comment Download
M third_party/WebKit/Source/modules/webusb/USB.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/webusb/USB.cpp View 1 2 3 4 3 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/public/platform/modules/webusb/WebUSBClient.h View 1 chunk +5 lines, -2 lines 0 comments Download

Messages

Total messages: 29 (9 generated)
Reilly Grant (use Gerrit)
haraken@, please take a look. I believed before investigating this that the WebUSBClient would not ...
4 years, 8 months ago (2016-03-30 22:16:51 UTC) #2
haraken
https://codereview.chromium.org/1848603002/diff/1/third_party/WebKit/Source/modules/webusb/USB.cpp File third_party/WebKit/Source/modules/webusb/USB.cpp (right): https://codereview.chromium.org/1848603002/diff/1/third_party/WebKit/Source/modules/webusb/USB.cpp#newcode88 third_party/WebKit/Source/modules/webusb/USB.cpp:88: m_client->removeObserver(this); Is it possible that USB's destructor is called ...
4 years, 8 months ago (2016-03-30 23:35:24 UTC) #4
Reilly Grant (use Gerrit)
https://codereview.chromium.org/1848603002/diff/1/third_party/WebKit/Source/modules/webusb/USB.cpp File third_party/WebKit/Source/modules/webusb/USB.cpp (right): https://codereview.chromium.org/1848603002/diff/1/third_party/WebKit/Source/modules/webusb/USB.cpp#newcode88 third_party/WebKit/Source/modules/webusb/USB.cpp:88: m_client->removeObserver(this); On 2016/03/30 at 23:35:23, haraken wrote: > Is ...
4 years, 8 months ago (2016-03-30 23:38:11 UTC) #5
haraken
https://codereview.chromium.org/1848603002/diff/1/third_party/WebKit/Source/modules/webusb/USB.cpp File third_party/WebKit/Source/modules/webusb/USB.cpp (right): https://codereview.chromium.org/1848603002/diff/1/third_party/WebKit/Source/modules/webusb/USB.cpp#newcode88 third_party/WebKit/Source/modules/webusb/USB.cpp:88: m_client->removeObserver(this); On 2016/03/30 23:38:10, Reilly Grant wrote: > On ...
4 years, 8 months ago (2016-03-30 23:44:05 UTC) #6
Reilly Grant (use Gerrit)
https://codereview.chromium.org/1848603002/diff/1/third_party/WebKit/Source/modules/webusb/USB.cpp File third_party/WebKit/Source/modules/webusb/USB.cpp (right): https://codereview.chromium.org/1848603002/diff/1/third_party/WebKit/Source/modules/webusb/USB.cpp#newcode88 third_party/WebKit/Source/modules/webusb/USB.cpp:88: m_client->removeObserver(this); On 2016/03/30 at 23:44:05, haraken wrote: > On ...
4 years, 8 months ago (2016-03-31 23:12:57 UTC) #7
haraken
On 2016/03/31 23:12:57, Reilly Grant wrote: > https://codereview.chromium.org/1848603002/diff/1/third_party/WebKit/Source/modules/webusb/USB.cpp > File third_party/WebKit/Source/modules/webusb/USB.cpp (right): > > https://codereview.chromium.org/1848603002/diff/1/third_party/WebKit/Source/modules/webusb/USB.cpp#newcode88 ...
4 years, 8 months ago (2016-03-31 23:48:06 UTC) #8
haraken
https://codereview.chromium.org/1848603002/diff/1/third_party/WebKit/Source/modules/webusb/USB.cpp File third_party/WebKit/Source/modules/webusb/USB.cpp (right): https://codereview.chromium.org/1848603002/diff/1/third_party/WebKit/Source/modules/webusb/USB.cpp#newcode88 third_party/WebKit/Source/modules/webusb/USB.cpp:88: m_client->removeObserver(this); On 2016/03/31 23:12:57, Reilly Grant wrote: > On ...
4 years, 8 months ago (2016-03-31 23:48:16 UTC) #9
Reilly Grant (use Gerrit)
On 2016/03/31 at 23:48:16, haraken wrote: > https://codereview.chromium.org/1848603002/diff/1/third_party/WebKit/Source/modules/webusb/USB.cpp > File third_party/WebKit/Source/modules/webusb/USB.cpp (right): > > https://codereview.chromium.org/1848603002/diff/1/third_party/WebKit/Source/modules/webusb/USB.cpp#newcode88 ...
4 years, 8 months ago (2016-04-01 00:46:28 UTC) #10
haraken
https://codereview.chromium.org/1848603002/diff/20001/third_party/WebKit/Source/modules/webusb/USB.h File third_party/WebKit/Source/modules/webusb/USB.h (right): https://codereview.chromium.org/1848603002/diff/20001/third_party/WebKit/Source/modules/webusb/USB.h#newcode30 third_party/WebKit/Source/modules/webusb/USB.h:30: WILL_BE_USING_PRE_FINALIZER(USB, dispose); You need to register the pre-finalizer. Otherwise, ...
4 years, 8 months ago (2016-04-01 01:12:44 UTC) #11
Reilly Grant (use Gerrit)
https://codereview.chromium.org/1848603002/diff/20001/third_party/WebKit/Source/modules/webusb/USB.h File third_party/WebKit/Source/modules/webusb/USB.h (right): https://codereview.chromium.org/1848603002/diff/20001/third_party/WebKit/Source/modules/webusb/USB.h#newcode30 third_party/WebKit/Source/modules/webusb/USB.h:30: WILL_BE_USING_PRE_FINALIZER(USB, dispose); On 2016/04/01 at 01:12:44, haraken wrote: > ...
4 years, 8 months ago (2016-04-01 01:31:58 UTC) #12
haraken
LGTM https://codereview.chromium.org/1848603002/diff/40001/third_party/WebKit/Source/modules/webusb/USB.cpp File third_party/WebKit/Source/modules/webusb/USB.cpp (right): https://codereview.chromium.org/1848603002/diff/40001/third_party/WebKit/Source/modules/webusb/USB.cpp#newcode93 third_party/WebKit/Source/modules/webusb/USB.cpp:93: m_client->removeObserver(this); Shall we clear m_client here just in ...
4 years, 8 months ago (2016-04-01 01:36:06 UTC) #13
Reilly Grant (use Gerrit)
On 2016/04/01 at 01:36:06, haraken wrote: > LGTM > > https://codereview.chromium.org/1848603002/diff/40001/third_party/WebKit/Source/modules/webusb/USB.cpp > File third_party/WebKit/Source/modules/webusb/USB.cpp (right): ...
4 years, 8 months ago (2016-04-01 19:44:57 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1848603002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1848603002/60001
4 years, 8 months ago (2016-04-01 19:45:40 UTC) #17
sof
https://codereview.chromium.org/1848603002/diff/60001/third_party/WebKit/Source/modules/webusb/USB.h File third_party/WebKit/Source/modules/webusb/USB.h (right): https://codereview.chromium.org/1848603002/diff/60001/third_party/WebKit/Source/modules/webusb/USB.h#newcode13 third_party/WebKit/Source/modules/webusb/USB.h:13: #include "platform/heap/ThreadState.h" Not needed. https://codereview.chromium.org/1848603002/diff/60001/third_party/WebKit/Source/modules/webusb/USB.h#newcode30 third_party/WebKit/Source/modules/webusb/USB.h:30: USING_PRE_FINALIZER(USB, dispose); This ...
4 years, 8 months ago (2016-04-01 20:06:38 UTC) #19
Reilly Grant (use Gerrit)
On 2016/04/01 at 20:06:38, sigbjornf wrote: > https://codereview.chromium.org/1848603002/diff/60001/third_party/WebKit/Source/modules/webusb/USB.h > File third_party/WebKit/Source/modules/webusb/USB.h (right): > > https://codereview.chromium.org/1848603002/diff/60001/third_party/WebKit/Source/modules/webusb/USB.h#newcode13 ...
4 years, 8 months ago (2016-04-01 20:51:47 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1848603002/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1848603002/80001
4 years, 8 months ago (2016-04-01 20:53:05 UTC) #24
Reilly Grant (use Gerrit)
Note, this is a very temporary workaround as I will soon be removing the //content/renderer ...
4 years, 8 months ago (2016-04-01 20:53:54 UTC) #25
commit-bot: I haz the power
Committed patchset #5 (id:80001)
4 years, 8 months ago (2016-04-02 00:54:04 UTC) #26
commit-bot: I haz the power
Patchset 5 (id:??) landed as https://crrev.com/e0584330d7c9ddf1887547d58cc2a7e0cb92fe1b Cr-Commit-Position: refs/heads/master@{#384763}
4 years, 8 months ago (2016-04-02 00:55:24 UTC) #28
sof
4 years, 8 months ago (2016-04-02 07:02:17 UTC) #29
Message was sent while issue was closed.
lgtm, thanks.

https://codereview.chromium.org/1848603002/diff/80001/content/renderer/usb/we...
File content/renderer/usb/web_usb_client_impl.cc (right):

https://codereview.chromium.org/1848603002/diff/80001/content/renderer/usb/we...
content/renderer/usb/web_usb_client_impl.cc:136: observers_.insert(observer);
It sounds as if this code won't stay around for long, but.. would a DCHECK() on
non-membership be worthwhile?

Powered by Google App Engine
This is Rietveld 408576698