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

Issue 735143002: Fix race when calling GetWeakPtr() from multiple threads. (Closed)

Created:
6 years, 1 month ago by no sievers
Modified:
6 years, 1 month ago
Reviewers:
DaleCurtis, Wez
CC:
chromium-reviews, feature-media-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Fix race when calling GetWeakPtr() from multiple threads. WeakReferenceOwner allows moving ownership to a different thread by checking if all WeakPtr instances have gone away and recreating that flag if that is the case. However the entirety of this operation is not atomic, and therefore a race exists if the last WeakPtr instance goes away one one thread while GetWeakPtr() is called on another thread. Avoid this by keeping a persistent reference to the flag. BUG=356540 Committed: https://crrev.com/4727025e0b53a0613eb5c90d6ddcba39643476d1 Cr-Commit-Position: refs/heads/master@{#304681}

Patch Set 1 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+7 lines, -1 line) Patch
M media/blink/buffered_data_source.h View 1 chunk +5 lines, -0 lines 3 comments Download
M media/blink/buffered_data_source.cc View 1 chunk +2 lines, -1 line 1 comment Download

Messages

Total messages: 17 (3 generated)
no sievers
ptal
6 years, 1 month ago (2014-11-18 20:58:23 UTC) #2
DaleCurtis
Nice fix. I thought you would use the new WeakPtr everywhere but now I see ...
6 years, 1 month ago (2014-11-18 21:15:07 UTC) #3
no sievers
On 2014/11/18 21:15:07, DaleCurtis wrote: > Nice fix. I thought you would use the new ...
6 years, 1 month ago (2014-11-18 21:17:06 UTC) #4
DaleCurtis
Ah, yeah, I just played with it for a bit and the !HasOneRef() requirement makes ...
6 years, 1 month ago (2014-11-18 21:33:53 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/735143002/1
6 years, 1 month ago (2014-11-18 21:34:56 UTC) #7
commit-bot: I haz the power
Committed patchset #1 (id:1)
6 years, 1 month ago (2014-11-18 22:24:08 UTC) #8
commit-bot: I haz the power
Patchset 1 (id:??) landed as https://crrev.com/4727025e0b53a0613eb5c90d6ddcba39643476d1 Cr-Commit-Position: refs/heads/master@{#304681}
6 years, 1 month ago (2014-11-18 22:24:44 UTC) #9
Wez
https://codereview.chromium.org/735143002/diff/1/media/blink/buffered_data_source.cc File media/blink/buffered_data_source.cc (right): https://codereview.chromium.org/735143002/diff/1/media/blink/buffered_data_source.cc#newcode105 media/blink/buffered_data_source.cc:105: weak_ptr_(weak_factory_.GetWeakPtr()) { You don't seem to be actually referring ...
6 years, 1 month ago (2014-11-18 23:28:10 UTC) #11
Wez
not LGTM, incidentally.
6 years, 1 month ago (2014-11-18 23:28:57 UTC) #12
no sievers
https://codereview.chromium.org/735143002/diff/1/media/blink/buffered_data_source.h File media/blink/buffered_data_source.h (right): https://codereview.chromium.org/735143002/diff/1/media/blink/buffered_data_source.h#newcode46 media/blink/buffered_data_source.h:46: // before being passed to other threads. It may ...
6 years, 1 month ago (2014-11-18 23:32:19 UTC) #13
DaleCurtis
The BufferedDataSource is created and destroyed on the render thread (see WebMediaPlayerImpl's main_task_runner_) it does ...
6 years, 1 month ago (2014-11-18 23:46:41 UTC) #14
DaleCurtis
https://codereview.chromium.org/735143002/diff/1/media/blink/buffered_data_source.h File media/blink/buffered_data_source.h (right): https://codereview.chromium.org/735143002/diff/1/media/blink/buffered_data_source.h#newcode46 media/blink/buffered_data_source.h:46: // before being passed to other threads. It may ...
6 years, 1 month ago (2014-11-18 23:47:46 UTC) #15
Wez
On 2014/11/18 23:47:46, DaleCurtis wrote: [snip] > I don't think these docs are true anymore, ...
6 years, 1 month ago (2014-11-19 18:46:59 UTC) #16
DaleCurtis
6 years, 1 month ago (2014-11-19 18:49:44 UTC) #17
Message was sent while issue was closed.
Yeah that's a good idea. sievers@ is welcome to it in a followup CL or can
assign the bug to me and I'll change them / find someone to do so.

Powered by Google App Engine
This is Rietveld 408576698