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

Issue 2476543003: Create and use BlinkInterfaceProvider WeakPtrs on the same thread (Closed)

Created:
4 years, 1 month ago by Peter Beverloo
Modified:
4 years, 1 month ago
CC:
chromium-reviews, mlamouri+watch-content_chromium.org, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, jam, yzshen+watch_chromium.org, abarth-chromium, Aaron Boodman, darin-cc_chromium.org, darin (slow to review), dcheng, Wez, danakj
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Create and use BlinkInterfaceProvider WeakPtrs on the same thread A race condition seems to be occurring where the reference to WeakReference::Flag in WeakReferenceOwner is in process of being destroyed while a new reference is being added. This happens when a document having Web Workers is being destroyed (due to a reload) while, on the thread specific to a worker, an API is used that binds to a Mojo Interface Provider. Creating the weak pointers on arbitrary threads, even though they consistently get dereferenced on the main thread, seems to be unsafe in this situation. Instead, create a single WeakPtr<> on the main thread during construction, a copy of which can be made on the worker threads. This will increase the reference count of the WeakReference::Flag, which is a thread-safe ref counted object. BUG=649645 Committed: https://crrev.com/c6f247ed04bc2e28157968a9f7e8f195012ae614 Cr-Commit-Position: refs/heads/master@{#430663}

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+7 lines, -3 lines) Patch
M content/renderer/mojo/blink_interface_provider_impl.h View 1 chunk +3 lines, -0 lines 0 comments Download
M content/renderer/mojo/blink_interface_provider_impl.cc View 2 chunks +4 lines, -3 lines 0 comments Download

Messages

Total messages: 15 (7 generated)
Peter Beverloo
+nasko, alexclarke -- are either of you the right person to review this, or would ...
4 years, 1 month ago (2016-11-03 19:35:05 UTC) #3
alex clarke (OOO till 29th)
LGTM This should be safer since the inner Flag is RefCountedThreadSafe +Daniel who is more ...
4 years, 1 month ago (2016-11-04 10:07:01 UTC) #4
Peter Beverloo
+avi for //content since Nasko may still be out?
4 years, 1 month ago (2016-11-07 21:27:34 UTC) #6
Avi (use Gerrit)
LGTM stamp for when all the detail people are happy.
4 years, 1 month ago (2016-11-07 21:39:03 UTC) #7
dcheng
LGTM +wez, danakj: I've noticed this come up in several places. It seems a bit ...
4 years, 1 month ago (2016-11-07 22:12:32 UTC) #9
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/2476543003/1
4 years, 1 month ago (2016-11-08 17:06:51 UTC) #11
commit-bot: I haz the power
Committed patchset #1 (id:1)
4 years, 1 month ago (2016-11-08 18:31:07 UTC) #13
commit-bot: I haz the power
4 years, 1 month ago (2016-11-08 18:38:53 UTC) #15
Message was sent while issue was closed.
Patchset 1 (id:??) landed as
https://crrev.com/c6f247ed04bc2e28157968a9f7e8f195012ae614
Cr-Commit-Position: refs/heads/master@{#430663}

Powered by Google App Engine
This is Rietveld 408576698