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

Issue 2712603002: Destroy bound callback to BindToCurrentLoop on the target task runner (2) (Closed)

Created:
3 years, 10 months ago by tzik
Modified:
3 years, 9 months ago
Reviewers:
johnme, danakj, xhwang
CC:
chromium-reviews, feature-media-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Destroy bound callback to BindToCurrentLoop on the target task runner A callback object bound by BindToCurrentLoop runs on the target thread, but the callback itself was not necessarily destroyed on the target thread. That causes a data race when a non-thread-safe RefCounted objects is bound to the callback. (E.g. a BindToCurrentLoop call for PPB_Buffer in content::ContentDecryptorDelegate::DeliverFrame().) This CL refactors BindToCurrentLoop and adds a clean up task to mitigate the racy usage. BUG=688072 Review-Url: https://codereview.chromium.org/2712603002 Cr-Commit-Position: refs/heads/master@{#454212} Committed: https://chromium.googlesource.com/chromium/src/+/2b817313110d51783e803320cd2d102c51166742

Patch Set 1 #

Patch Set 2 : rebase on callback_holder CL #

Total comments: 2

Patch Set 3 : +test #

Total comments: 2

Patch Set 4 : const-ref -> value #

Total comments: 2

Patch Set 5 : +inline #

Unified diffs Side-by-side diffs Delta from patch set Stats (+104 lines, -41 lines) Patch
M media/base/bind_to_current_loop.h View 1 2 3 4 2 chunks +53 lines, -41 lines 0 comments Download
M media/base/bind_to_current_loop_unittest.cc View 1 2 3 chunks +51 lines, -0 lines 0 comments Download

Messages

Total messages: 42 (30 generated)
tzik
PTAL
3 years, 10 months ago (2017-02-22 06:17:44 UTC) #11
xhwang
Add johnme and danakj, who were involved in similar discussion before. You can see the ...
3 years, 10 months ago (2017-02-23 04:52:06 UTC) #20
xhwang
The change looks good to me. Can you add a unit test for the case ...
3 years, 10 months ago (2017-02-23 05:45:49 UTC) #21
danakj
https://codereview.chromium.org/2712603002/diff/20001/media/base/bind_to_current_loop.h File media/base/bind_to_current_loop.h (right): https://codereview.chromium.org/2712603002/diff/20001/media/base/bind_to_current_loop.h#newcode55 media/base/bind_to_current_loop.h:55: std::move(callback_))); Isn't this thread-racey? The last reference in the ...
3 years, 10 months ago (2017-02-23 21:29:06 UTC) #22
tzik
https://codereview.chromium.org/2712603002/diff/20001/media/base/bind_to_current_loop.h File media/base/bind_to_current_loop.h (right): https://codereview.chromium.org/2712603002/diff/20001/media/base/bind_to_current_loop.h#newcode55 media/base/bind_to_current_loop.h:55: std::move(callback_))); On 2017/02/23 21:29:06, danakj wrote: > Isn't this ...
3 years, 9 months ago (2017-02-27 06:28:04 UTC) #25
danakj
https://codereview.chromium.org/2712603002/diff/40001/media/base/bind_to_current_loop.h File media/base/bind_to_current_loop.h (right): https://codereview.chromium.org/2712603002/diff/40001/media/base/bind_to_current_loop.h#newcode59 media/base/bind_to_current_loop.h:59: static void ClearCallbackOnTargetTaskRunner(const CallbackType&) {} This should receive by ...
3 years, 9 months ago (2017-02-28 18:28:04 UTC) #28
tzik
https://codereview.chromium.org/2712603002/diff/40001/media/base/bind_to_current_loop.h File media/base/bind_to_current_loop.h (right): https://codereview.chromium.org/2712603002/diff/40001/media/base/bind_to_current_loop.h#newcode59 media/base/bind_to_current_loop.h:59: static void ClearCallbackOnTargetTaskRunner(const CallbackType&) {} On 2017/02/28 18:28:04, danakj_OOO ...
3 years, 9 months ago (2017-03-01 05:51:49 UTC) #31
danakj
LGTM https://codereview.chromium.org/2712603002/diff/60001/media/base/bind_to_current_loop.h File media/base/bind_to_current_loop.h (right): https://codereview.chromium.org/2712603002/diff/60001/media/base/bind_to_current_loop.h#newcode85 media/base/bind_to_current_loop.h:85: base::Callback<T> BindToCurrentLoop(base::Callback<T> cb) { should this be marked ...
3 years, 9 months ago (2017-03-01 17:10:42 UTC) #34
xhwang
lgtm, thanks!
3 years, 9 months ago (2017-03-01 17:23:23 UTC) #35
tzik
https://codereview.chromium.org/2712603002/diff/60001/media/base/bind_to_current_loop.h File media/base/bind_to_current_loop.h (right): https://codereview.chromium.org/2712603002/diff/60001/media/base/bind_to_current_loop.h#newcode85 media/base/bind_to_current_loop.h:85: base::Callback<T> BindToCurrentLoop(base::Callback<T> cb) { On 2017/03/01 17:10:42, danakj wrote: ...
3 years, 9 months ago (2017-03-02 06:49:28 UTC) #36
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/2712603002/80001
3 years, 9 months ago (2017-03-02 06:50:29 UTC) #39
commit-bot: I haz the power
3 years, 9 months ago (2017-03-02 08:30:01 UTC) #42
Message was sent while issue was closed.
Committed patchset #5 (id:80001) as
https://chromium.googlesource.com/chromium/src/+/2b817313110d51783e803320cd2d...

Powered by Google App Engine
This is Rietveld 408576698