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

Issue 1938313003: Move MainThreadTaskRunner off Oilpan heap to simplify posting. (Closed)

Created:
4 years, 7 months ago by sof
Modified:
4 years, 6 months ago
Reviewers:
oilpan-reviews, haraken
CC:
chromium-reviews, eae+blinkwatch, blink-reviews-dom_chromium.org, dglazkov+blink, blink-reviews, rwlbuis
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Move MainThreadTaskRunner off Oilpan heap to simplify posting. Having the Document's MainThreadTaskRunner on the Oilpan heap is preferable for three reasons: - Correctly accounts for the MainThreadTaskRunner::m_context back reference, by having it be traced Member<>. - The MainThreadTaskRunner must not perform tasks when it (and the Document) is in the process of being swept. By having the posted tasks keep a weak persistent reference to MainThreadTaskRunner, the Oilpan GC will ensure that the weak references will be cleared once MainThreadTaskRunner has been deemed garbage. - Similarly for the timer-initiated running of a MainThreadTaskRunner's pending tasks. The Timer<> abstraction takes care of not firing a timer if its owner is an Oilpan heap object that's about to be swept. But it is not without downsides: - A CrossThreadWeakPersistent<> has to be created for every task closure posted to the main thread, and copying that persistent reference around while creating the closure, something that is not without overhead. - Threads not attached to Oilpan needing to post tasks to the main thread will have to create these persistents also. Having that happen when a GC is in progress is hard to support, as it risks introducing and removing persistent heap references in ways that interfere with the GC processing the heap. The latter point is sufficient reason not to require the allocation of CrossThreadWeakPersistent<>s when posting main thread tasks, hence MainThreadTaskRunner is moved off the Oilpan heap. By doing so, the benefits above that the Oilpan GC infrastructure provided "for free" have to be taken care of manually. C'est la vie. R= BUG=610477 Committed: https://crrev.com/93ddd5fff7fbe018efc1df2be3fe907103314422 Cr-Commit-Position: refs/heads/master@{#396432}

Patch Set 1 #

Total comments: 2

Patch Set 2 : experiment: trigger assert on CrossThreadPersistentRegion access during GC #

Patch Set 3 : experiment: trigger assert on CrossThreadPersistentRegion access during GC, fix no-assert compilati… #

Patch Set 4 : revert experiment #

Patch Set 5 : rebased #

Patch Set 6 : compile fix #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+26 lines, -16 lines) Patch
M third_party/WebKit/Source/core/dom/Document.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/Document.cpp View 1 2 3 4 1 chunk +0 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/MainThreadTaskRunner.h View 1 2 3 4 2 chunks +10 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/core/dom/MainThreadTaskRunner.cpp View 1 2 3 4 5 4 chunks +12 lines, -6 lines 1 comment Download
M third_party/WebKit/Source/core/dom/MainThreadTaskRunnerTest.cpp View 3 chunks +3 lines, -3 lines 0 comments Download

Messages

Total messages: 42 (13 generated)
haraken
> Because posting will now involve creating a persistent (weak) reference, which entails accessing Oilpan ...
4 years, 7 months ago (2016-05-04 03:21:33 UTC) #2
sof
On 2016/05/04 03:21:33, haraken wrote: > > Because posting will now involve creating a persistent ...
4 years, 7 months ago (2016-05-04 05:17:25 UTC) #3
sof
https://codereview.chromium.org/1938313003/diff/1/third_party/WebKit/Source/core/dom/MainThreadTaskRunner.cpp File third_party/WebKit/Source/core/dom/MainThreadTaskRunner.cpp (right): https://codereview.chromium.org/1938313003/diff/1/third_party/WebKit/Source/core/dom/MainThreadTaskRunner.cpp#newcode75 third_party/WebKit/Source/core/dom/MainThreadTaskRunner.cpp:75: if (ThreadHeap::willObjectBeLazilySwept(m_context.get())) On 2016/05/04 03:21:33, haraken wrote: > > ...
4 years, 7 months ago (2016-05-04 05:17:39 UTC) #4
sof
On 2016/05/04 05:17:25, sof wrote: > On 2016/05/04 03:21:33, haraken wrote: > > > Because ...
4 years, 7 months ago (2016-05-04 11:39:23 UTC) #5
haraken
On 2016/05/04 11:39:23, sof wrote: > On 2016/05/04 05:17:25, sof wrote: > > On 2016/05/04 ...
4 years, 7 months ago (2016-05-04 14:25:36 UTC) #6
sof
On 2016/05/04 14:25:36, haraken wrote: > On 2016/05/04 11:39:23, sof wrote: > > On 2016/05/04 ...
4 years, 7 months ago (2016-05-04 14:31:33 UTC) #7
haraken
On 2016/05/04 14:31:33, sof wrote: > On 2016/05/04 14:25:36, haraken wrote: > > On 2016/05/04 ...
4 years, 7 months ago (2016-05-04 14:53:51 UTC) #8
sof
On 2016/05/04 14:53:51, haraken wrote: > On 2016/05/04 14:31:33, sof wrote: > > On 2016/05/04 ...
4 years, 7 months ago (2016-05-04 15:03:57 UTC) #9
sof
I'm trying to address the root cause here via https://codereview.chromium.org/1958583002/ - not sure if it ...
4 years, 7 months ago (2016-05-06 08:46:37 UTC) #10
sof
On 2016/05/06 08:46:37, sof wrote: > I'm trying to address the root cause here via ...
4 years, 7 months ago (2016-05-08 14:24:56 UTC) #11
sof
please take a look.
4 years, 7 months ago (2016-05-26 21:24:41 UTC) #16
haraken
This looks good. > Threads not attached to Oilpan needing to post tasks to > ...
4 years, 7 months ago (2016-05-26 22:04:11 UTC) #18
sof
On 2016/05/26 22:04:11, haraken wrote: > This looks good. > > > Threads not attached ...
4 years, 7 months ago (2016-05-27 05:15:36 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1938313003/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1938313003/100001
4 years, 7 months ago (2016-05-27 05:31:55 UTC) #21
commit-bot: I haz the power
No L-G-T-M from a valid reviewer yet. CQ run can only be started by full ...
4 years, 7 months ago (2016-05-27 05:31:57 UTC) #24
haraken
Let me ask a couple of questions: - Do we need this CL even after ...
4 years, 7 months ago (2016-05-27 07:58:35 UTC) #26
sof
On 2016/05/27 07:58:35, haraken wrote: > Let me ask a couple of questions: > > ...
4 years, 7 months ago (2016-05-27 08:05:20 UTC) #27
haraken
On 2016/05/27 08:05:20, sof wrote: > On 2016/05/27 07:58:35, haraken wrote: > > Let me ...
4 years, 7 months ago (2016-05-27 08:07:58 UTC) #28
sof
On 2016/05/27 08:07:58, haraken wrote: > On 2016/05/27 08:05:20, sof wrote: > > On 2016/05/27 ...
4 years, 7 months ago (2016-05-27 08:10:42 UTC) #29
haraken
On 2016/05/27 08:10:42, sof wrote: > On 2016/05/27 08:07:58, haraken wrote: > > On 2016/05/27 ...
4 years, 7 months ago (2016-05-27 08:23:15 UTC) #30
sof
On 2016/05/27 08:23:15, haraken wrote: > On 2016/05/27 08:10:42, sof wrote: > > On 2016/05/27 ...
4 years, 7 months ago (2016-05-27 08:25:48 UTC) #31
haraken
On 2016/05/27 08:25:48, sof wrote: > On 2016/05/27 08:23:15, haraken wrote: > > On 2016/05/27 ...
4 years, 7 months ago (2016-05-27 08:28:37 UTC) #32
sof
On 2016/05/27 08:28:37, haraken wrote: > On 2016/05/27 08:25:48, sof wrote: > > On 2016/05/27 ...
4 years, 7 months ago (2016-05-27 08:30:27 UTC) #33
haraken
On 2016/05/27 08:30:27, sof wrote: > On 2016/05/27 08:28:37, haraken wrote: > > On 2016/05/27 ...
4 years, 7 months ago (2016-05-27 08:31:53 UTC) #34
sof
On 2016/05/27 08:31:53, haraken wrote: > On 2016/05/27 08:30:27, sof wrote: > > On 2016/05/27 ...
4 years, 7 months ago (2016-05-27 08:33:12 UTC) #35
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1938313003/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1938313003/100001
4 years, 7 months ago (2016-05-27 08:33:39 UTC) #37
commit-bot: I haz the power
Committed patchset #6 (id:100001)
4 years, 7 months ago (2016-05-27 09:35:43 UTC) #39
commit-bot: I haz the power
Patchset 6 (id:??) landed as https://crrev.com/93ddd5fff7fbe018efc1df2be3fe907103314422 Cr-Commit-Position: refs/heads/master@{#396432}
4 years, 7 months ago (2016-05-27 09:37:46 UTC) #41
sof
4 years, 6 months ago (2016-05-27 11:14:08 UTC) #42
Message was sent while issue was closed.
On 2016/05/27 08:33:12, sof wrote:
> On 2016/05/27 08:31:53, haraken wrote:
> > On 2016/05/27 08:30:27, sof wrote:
...
> > > > 
> > > > If there is no other users (which you wrote in #27) and your plan is to
> > > disallow
> > > > it (which you wrote in #29), shouldn't we add assertions instead?
> > > 
> > > I _know_ of no other user currently, that's all.
> > 
> > Either way, disallowing it would be a right way to go, so this CL looks good
> to
> > me.
> 
> We don't know if that's a viable constraint to impose just yet, but a separate
> issue from this CL.

https://codereview.chromium.org/2019673002/ shows up audio thread usage of a CTP
(AudioParamTimeline::ParamEvent)

It looks like the background thread usage by CanvasAsyncBlobCreator could be
another case; I think it'd be too strict to not allow CTP usage - keeping a lock
while marking & weak processing would be a reasonable initial implementation,
imo.

Powered by Google App Engine
This is Rietveld 408576698