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

Issue 669603002: Reland: Refactor Script(Loader|Runner): don't access Resources all over the place... (Closed)

Created:
6 years, 2 months ago by marja
Modified:
6 years, 2 months ago
CC:
arv+blink, blink-reviews, blink-reviews-bindings_chromium.org, blink-reviews-dom_chromium.org, dglazkov+blink, eae+blinkwatch, rwlbuis, sof
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Project:
blink
Visibility:
Public.

Description

Reland: Refactor Script(Loader|Runner): don't access Resources all over the place... ... but use proper layering instead. PendingScript holds a Resource, and many places in the code are using both the PendingScript and the underlying Resource. For example, ScriptRunner holds a collection of PendingScripts, and ScriptLoaders then listen to the underlying Resources. This is confusing and error prone. The Resource - ScriptLoader - PendingScript - Element love quadrangle is messy in general. Both ScriptLoader and PendingScript refer to the Resource. The way to get ScriptLoader from PendingScript is via Element which PendingScript also holds. But there's no way to get PendingScript from ScriptLoader. This CL makes ScriptRunner access the ScriptLoaders directly and moves the PendingScript to ScriptLoader. In addition, it makes ScriptRunner not access the Resource of the ScriptLoader directly. This CL also cancels the hack from https://bugs.webkit.org/show_bug.cgi?id=92211 (r139942) where it was speculated that a crash can be caused by ScriptLoader getting the notifyFinished notification twice because it doesn't unsubscribe yet when it gets the first one. The speculative fix was to made it nullify ScriptLoader::m_resource and check for the nullity later. This is pretty surprising, since the obvious solution would've been to just unsubscribe early enough (which is done by this CL). Note a behavioral change: It's OK to call Resource::addClient even if the Resource is finished, and in that case, the client will be notified immediately. But PendingScript used to ASSERT that the Resource is not finished. This CL removes that restriction (the underlying Resource already handles adding clients to finished resources + made ScriptStreamer handle it too). First version: https://codereview.chromium.org/656113002/ Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=183984

Patch Set 1 #

Patch Set 2 : fixes #

Patch Set 3 : another tiny fix: stopWatching no longer cancels, HTMLScriptRunner::detach must #

Patch Set 4 : test update #

Unified diffs Side-by-side diffs Delta from patch set Stats (+75 lines, -67 lines) Patch
M Source/bindings/core/v8/ScriptStreamer.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/bindings/core/v8/ScriptStreamerTest.cpp View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/dom/PendingScript.cpp View 1 3 chunks +8 lines, -7 lines 0 comments Download
M Source/core/dom/ScriptLoader.h View 1 5 chunks +9 lines, -2 lines 0 comments Download
M Source/core/dom/ScriptLoader.cpp View 1 6 chunks +26 lines, -27 lines 0 comments Download
M Source/core/dom/ScriptRunner.h View 3 chunks +5 lines, -8 lines 0 comments Download
M Source/core/dom/ScriptRunner.cpp View 1 6 chunks +23 lines, -22 lines 0 comments Download
M Source/core/html/parser/HTMLScriptRunner.cpp View 1 2 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 17 (8 generated)
marja
jochen, ptal at this fixed version. (haraken@, FYI) This is a reincarnation of https://codereview.chromium.org/656113002/ To ...
6 years, 2 months ago (2014-10-20 11:54:51 UTC) #3
jochen (gone - plz use gerrit)
lgtm
6 years, 2 months ago (2014-10-20 11:59:18 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/669603002/20001
6 years, 2 months ago (2014-10-20 12:01:08 UTC) #7
marja
(I added a tiny fix: since PendingScript::stopWatchingForLoad no longer cancels the streaming, I made HTMLScriptRunner::detach() ...
6 years, 2 months ago (2014-10-20 12:16:00 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/669603002/40001
6 years, 2 months ago (2014-10-20 12:16:57 UTC) #11
commit-bot: I haz the power
Try jobs failed on following builders: linux_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/29951)
6 years, 2 months ago (2014-10-20 12:55:11 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/669603002/60001
6 years, 2 months ago (2014-10-20 13:06:38 UTC) #15
haraken
LGTM
6 years, 2 months ago (2014-10-20 13:52:31 UTC) #16
commit-bot: I haz the power
6 years, 2 months ago (2014-10-20 14:24:03 UTC) #17
Message was sent while issue was closed.
Committed patchset #4 (id:60001) as 183984

Powered by Google App Engine
This is Rietveld 408576698