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

Issue 2091713002: Specialize base::IsWeakReceiver for Blink weak pointers to support base::Bind (1/5) (Closed)

Created:
4 years, 6 months ago by tzik
Modified:
4 years, 5 months ago
CC:
chromium-reviews, webcomponents-bugzilla_chromium.org, eae+blinkwatch, dominicc+watchlist_chromium.org, blink-reviews-wtf_chromium.org, rwlbuis, Yoav Weiss, blink-reviews-dom_chromium.org, dglazkov+blink, gavinp+loader_chromium.org, blink-reviews, Mads Ager (chromium), Peter Beverloo, timvolodine, loading-reviews+fetch_chromium.org, Nate Chapin, tyoshino+watch_chromium.org, mlamouri+watch-blink_chromium.org, scheduler-bugs_chromium.org, mvanouwerkerk+watch_chromium.org, oilpan-reviews, kouhei+heap_chromium.org, Mikhail
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Specialize base::IsWeakReceiver for Blink weak pointers to support base::Bind * Specialize base::IsWeakReceiver for Blink weak pointers, so that base::Bind can handle them as weak pointers. * Unify method invocation forms in WTF::FunctionWrapper using base::IsWeakReceiver. * Add wrapWeakPersistent() and wrapCrossThreadWeakPersistent(). * Remove WeakPersistentThisPointer and CrossThreadWeakPersistentThisPointer, which are no longer needed. BUG=597856 CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_optional_gpu_tests_rel;tryserver.chromium.mac:mac_optional_gpu_tests_rel Committed: https://crrev.com/4b2899d40575fd381ba861b4a711a20ab39bc1d3 Cr-Commit-Position: refs/heads/master@{#401878}

Patch Set 1 #

Total comments: 2

Patch Set 2 : s/WeakPersistent/CrossThreadWeakPersistent/ in WebGLRenderingContextBase #

Patch Set 3 : s/CrossThread//. addNewMailboxCallback(nullptr) @ destroyContext() #

Patch Set 4 : +test. rebase for WTF::unretained(). #

Total comments: 6

Patch Set 5 : +test #

Patch Set 6 : +PersistentTest.cpp #

Patch Set 7 : +#include for build fix #

Unified diffs Side-by-side diffs Delta from patch set Stats (+160 lines, -104 lines) Patch
M third_party/WebKit/Source/core/dom/ElementVisibilityObserver.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/MessagePort.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/ScriptRunner.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskRunQueue.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/fetch/ImageResource.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/geolocation/Geolocation.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/nfc/NFC.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/notifications/Notification.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/notifications/NotificationResourcesLoader.cpp View 1 chunk +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/payments/PaymentRequest.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h View 1 chunk +0 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp View 1 2 3 4 chunks +5 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/modules/webusb/USB.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/webusb/USBDevice.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/CrossThreadCopier.h View 1 2 3 1 chunk +0 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/platform/heap/Member.h View 1 2 3 4 5 6 2 chunks +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/heap/Persistent.h View 1 2 3 4 5 6 4 chunks +21 lines, -55 lines 0 comments Download
A third_party/WebKit/Source/platform/heap/PersistentTest.cpp View 1 2 3 4 5 1 chunk +61 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/heap/blink_heap.gypi View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/platform/scheduler/CancellableTaskFactory.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/wtf/Functional.h View 1 2 3 2 chunks +14 lines, -17 lines 0 comments Download
M third_party/WebKit/Source/wtf/FunctionalTest.cpp View 1 2 3 3 chunks +37 lines, -0 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 32 (9 generated)
tzik
PTAL
4 years, 6 months ago (2016-06-23 09:47:46 UTC) #6
hiroshige
Basically looks good, great! https://codereview.chromium.org/2091713002/diff/1/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactory.h File third_party/WebKit/Source/platform/scheduler/CancellableTaskFactory.h (right): https://codereview.chromium.org/2091713002/diff/1/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactory.h#newcode42 third_party/WebKit/Source/platform/scheduler/CancellableTaskFactory.h:42: return wrapUnique(new CancellableTaskFactory(WTF::bind(method, wrapCrossThreadWeakPersistent(thisObject)))); This ...
4 years, 6 months ago (2016-06-23 09:56:18 UTC) #7
sof
some offscreencanvas/ImageBitmap failures reported by the bots.
4 years, 6 months ago (2016-06-23 11:07:48 UTC) #8
tzik
On 2016/06/23 11:07:48, sof wrote: > some offscreencanvas/ImageBitmap failures reported by the bots. That's due ...
4 years, 6 months ago (2016-06-23 11:47:49 UTC) #9
tzik
https://codereview.chromium.org/2091713002/diff/1/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactory.h File third_party/WebKit/Source/platform/scheduler/CancellableTaskFactory.h (right): https://codereview.chromium.org/2091713002/diff/1/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactory.h#newcode42 third_party/WebKit/Source/platform/scheduler/CancellableTaskFactory.h:42: return wrapUnique(new CancellableTaskFactory(WTF::bind(method, wrapCrossThreadWeakPersistent(thisObject)))); On 2016/06/23 09:56:18, hiroshige (slow) ...
4 years, 6 months ago (2016-06-23 11:48:01 UTC) #10
tzik
PTAL
4 years, 6 months ago (2016-06-24 05:15:36 UTC) #11
sof
lgtm, happy to see Weak*ThisPointer<> go. https://codereview.chromium.org/2091713002/diff/60001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp File third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp (right): https://codereview.chromium.org/2091713002/diff/60001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp#newcode1161 third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp:1161: drawingBuffer()->addNewMailboxCallback(nullptr); It makes ...
4 years, 6 months ago (2016-06-24 05:24:08 UTC) #12
haraken
LGTM
4 years, 6 months ago (2016-06-24 05:32:57 UTC) #13
tzik
https://codereview.chromium.org/2091713002/diff/60001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp File third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp (right): https://codereview.chromium.org/2091713002/diff/60001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp#newcode1161 third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp:1161: drawingBuffer()->addNewMailboxCallback(nullptr); On 2016/06/24 05:24:08, sof wrote: > It makes ...
4 years, 6 months ago (2016-06-24 05:57:06 UTC) #14
sof
https://codereview.chromium.org/2091713002/diff/60001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp File third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp (right): https://codereview.chromium.org/2091713002/diff/60001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp#newcode1161 third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp:1161: drawingBuffer()->addNewMailboxCallback(nullptr); On 2016/06/24 05:57:06, tzik wrote: > On 2016/06/24 ...
4 years, 6 months ago (2016-06-24 06:45:32 UTC) #15
tzik
https://codereview.chromium.org/2091713002/diff/60001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp File third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp (right): https://codereview.chromium.org/2091713002/diff/60001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp#newcode1161 third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp:1161: drawingBuffer()->addNewMailboxCallback(nullptr); On 2016/06/24 06:45:32, sof wrote: > On 2016/06/24 ...
4 years, 6 months ago (2016-06-24 07:04:58 UTC) #16
sof
On 2016/06/24 07:04:58, tzik wrote: > https://codereview.chromium.org/2091713002/diff/60001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp > File third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp > (right): > > https://codereview.chromium.org/2091713002/diff/60001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp#newcode1161 ...
4 years, 6 months ago (2016-06-24 07:07:48 UTC) #17
tzik
On 2016/06/24 07:07:48, sof wrote: > On 2016/06/24 07:04:58, tzik wrote: > > > https://codereview.chromium.org/2091713002/diff/60001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp ...
4 years, 6 months ago (2016-06-24 07:32:36 UTC) #18
sof
On 2016/06/24 07:32:36, tzik wrote: > On 2016/06/24 07:07:48, sof wrote: > > On 2016/06/24 ...
4 years, 6 months ago (2016-06-24 08:55:34 UTC) #19
sof
https://codereview.chromium.org/2091713002/diff/60001/third_party/WebKit/Source/platform/heap/Persistent.h File third_party/WebKit/Source/platform/heap/Persistent.h (right): https://codereview.chromium.org/2091713002/diff/60001/third_party/WebKit/Source/platform/heap/Persistent.h#newcode711 third_party/WebKit/Source/platform/heap/Persistent.h:711: struct IsWeakReceiver<blink::WeakPersistent<T>> : std::true_type {}; It would be good ...
4 years, 6 months ago (2016-06-24 08:56:02 UTC) #20
tzik
https://codereview.chromium.org/2091713002/diff/60001/third_party/WebKit/Source/platform/heap/Persistent.h File third_party/WebKit/Source/platform/heap/Persistent.h (right): https://codereview.chromium.org/2091713002/diff/60001/third_party/WebKit/Source/platform/heap/Persistent.h#newcode711 third_party/WebKit/Source/platform/heap/Persistent.h:711: struct IsWeakReceiver<blink::WeakPersistent<T>> : std::true_type {}; On 2016/06/24 08:56:02, sof ...
4 years, 6 months ago (2016-06-24 09:41:41 UTC) #21
sof
lgtm, thanks. (i'll follow up on the clearing of weak persistents.)
4 years, 6 months ago (2016-06-24 09:45:14 UTC) #22
tzik
haraken: Just in case, could you take another look to diff to PS4? I added ...
4 years, 6 months ago (2016-06-24 14:20:03 UTC) #23
haraken
LGTM
4 years, 6 months ago (2016-06-24 14:25:08 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2091713002/120001
4 years, 6 months ago (2016-06-24 14:26:23 UTC) #27
commit-bot: I haz the power
Committed patchset #7 (id:120001)
4 years, 6 months ago (2016-06-24 16:33:47 UTC) #29
commit-bot: I haz the power
Patchset 7 (id:??) landed as https://crrev.com/4b2899d40575fd381ba861b4a711a20ab39bc1d3 Cr-Commit-Position: refs/heads/master@{#401878}
4 years, 6 months ago (2016-06-24 16:37:12 UTC) #31
sof
4 years, 5 months ago (2016-06-27 08:53:17 UTC) #32
Message was sent while issue was closed.
On 2016/06/24 08:55:34, sof wrote:
> On 2016/06/24 07:32:36, tzik wrote:
> > On 2016/06/24 07:07:48, sof wrote:
> > > On 2016/06/24 07:04:58, tzik wrote:
> > > >
> > >
> >
>
https://codereview.chromium.org/2091713002/diff/60001/third_party/WebKit/Sour...
> > > > File
third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
> > > > (right):
> > > > 
> > > >
> > >
> >
>
https://codereview.chromium.org/2091713002/diff/60001/third_party/WebKit/Sour...
> > > >
> third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp:1161:
> > > > drawingBuffer()->addNewMailboxCallback(nullptr);
> > > > On 2016/06/24 06:45:32, sof wrote:
> > > > > On 2016/06/24 05:57:06, tzik wrote:
> > > > > > On 2016/06/24 05:24:08, sof wrote:
> > > > > > > It makes sense, but why is this needed now?
> > > > > > 
> > > > > > The error caught a Persistent leak after the termination GC.
> > > > > > That's due to DrawingBuffer holds a WeakPersintent of
> > > > WebGLRendingContextBase
> > > > > > through the WTF::Function, and probably lives after the heap
shutdown.
> > > > > > I don't know why the test didn't catch CrossThreadWeakPersistent...
> > > > > 
> > > > > CT(W)Ps are exempt from checking for leaks when running termination
GCs.
> > > > Makes sense.
> > > > 
> > > > > 
> > > > > But why would the main thread be running a termination GC?
> > > > 
> > > > The instance seems to be created on other thread than main according to
> line
> > > > 578.
> > > 
> > > ok, but then it ought to be a cross-thread weak persistent?
> > 
> > Once the instance is created, the instance will stick in the thread, as we
use
> > non-thread-safe bind and RefCounted around here.
> 
> I see what's happening now, this is for a worker thread creating offscreen
> canvases.
> 
> But WeakPersistent<>s are cleared during weak processing, but not deallocated,
> so the persistent (node) count won't decrease, causing the termination GC to
> assert about persistents leaking. I think we should fix that, but I'm fine
with
> doing the explicit reset of the callback as done here regardless.

ftr, https://codereview.chromium.org/2094973002/ addressed weak persistent nodes
not being freed & with it in scope confirmed not to require the clearing of the
mailbox callback here. (But it makes sense to do so regardless.)

Powered by Google App Engine
This is Rietveld 408576698