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

Issue 141143006: [import] Cleanup: get rid of ad-hoc state machine. (Closed)

Created:
6 years, 11 months ago by Hajime Morrita
Modified:
6 years, 11 months ago
CC:
blink-reviews, dglazkov+blink, sof, eae+blinkwatch, adamk+blink_chromium.org, Inactive
Visibility:
Public.

Description

[import] Get rid of ad-hoc state machine. This change removes its error-prone state transition logic from HTMLImport. Instead, it introduces invalidate-and-recalc state model like style calculation. In this model, * Possible state change is notified by HTMLImport::stateWillChange(), which schedules tree-wide state recalculation, that is done by HTMLImport::recalcTreeState() static member function. * HTMLImport::recalcTreeState() traverses the import tree and recomputes the state of each import through recalcState(). * If the state of an import has changed, it gets stateDidChange() notification. This single notification replaces old didXxx() notification functions. * Per-import state calculation is extracted as HTMLImportStateResolver class. This class does compute the state based on the loader status and the state of other imports whose states should be already updated. Although this doesn't stop maintaining the explicit state for performance reasons, this recalc model is much more easy to reason thus less error prone than original state machine model. As a bonus, crbug.com/336646 is gone. A crash reported there happened due to incorrect m_state value and this change fixes it by giving correct state value. On import-events-inline.html: The change happened to reveal a timing problem (crbug.com/336113). It should be fixed in coming changes TEST=import-events-inline.html, import-shared-crash.html R=dglazkov, dominicc BUG=336646 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=165624

Patch Set 1 #

Patch Set 2 : Updated to ToT #

Patch Set 3 : Updated #

Patch Set 4 : Added a test #

Total comments: 3

Patch Set 5 : Fixed a bug that caused the flakiness #

Patch Set 6 : Landing. #

Patch Set 7 : Updated to ToT #

Unified diffs Side-by-side diffs Delta from patch set Stats (+223 lines, -283 lines) Patch
M LayoutTests/fast/html/imports/import-events-inline.html View 1 2 3 4 1 chunk +1 line, -2 lines 0 comments Download
A + LayoutTests/fast/html/imports/import-shared-crash.html View 1 2 3 1 chunk +2 lines, -4 lines 0 comments Download
A + LayoutTests/fast/html/imports/import-shared-crash-expected.txt View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
A LayoutTests/fast/html/imports/resources/shared-crash-child.html View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
A + LayoutTests/fast/html/imports/resources/shared-crash-dup.html View 1 2 3 1 chunk +0 lines, -1 line 0 comments Download
A LayoutTests/fast/html/imports/resources/shared-crash-grandchild.html View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
A LayoutTests/fast/html/imports/resources/shared-crash-root.html View 1 2 3 1 chunk +3 lines, -0 lines 0 comments Download
M Source/core/core.gypi View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M Source/core/dom/Document.cpp View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M Source/core/html/HTMLImport.h View 1 2 3 4 5 6 3 chunks +42 lines, -66 lines 0 comments Download
M Source/core/html/HTMLImport.cpp View 1 2 3 4 5 2 chunks +60 lines, -118 lines 0 comments Download
M Source/core/html/HTMLImportChild.h View 1 2 3 4 5 6 1 chunk +5 lines, -2 lines 0 comments Download
M Source/core/html/HTMLImportChild.cpp View 1 2 3 4 8 chunks +28 lines, -19 lines 0 comments Download
A + Source/core/html/HTMLImportStateResolver.h View 1 2 3 4 5 6 1 chunk +20 lines, -9 lines 0 comments Download
A + Source/core/html/HTMLImportStateResolver.cpp View 1 1 chunk +31 lines, -36 lines 0 comments Download
M Source/core/html/HTMLImportsController.h View 2 chunks +3 lines, -5 lines 0 comments Download
M Source/core/html/HTMLImportsController.cpp View 1 2 3 4 4 chunks +10 lines, -18 lines 0 comments Download
M Source/core/html/HTMLLinkElement.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/html/HTMLLinkElement.cpp View 1 2 3 4 1 chunk +5 lines, -0 lines 0 comments Download
M Source/core/html/LinkImport.cpp View 1 2 3 4 1 chunk +3 lines, -1 line 0 comments Download

Messages

Total messages: 11 (0 generated)
Hajime Morrita
LGTM? I'm sorry for that this is rather a big rewrite than incremental change. It's ...
6 years, 11 months ago (2014-01-17 12:08:17 UTC) #1
Hajime Morrita
@dominicc PTAL?
6 years, 11 months ago (2014-01-22 05:12:32 UTC) #2
dglazkov
lgtm https://codereview.chromium.org/141143006/diff/110001/Source/core/html/HTMLImport.h File Source/core/html/HTMLImport.h (right): https://codereview.chromium.org/141143006/diff/110001/Source/core/html/HTMLImport.h#newcode113 Source/core/html/HTMLImport.h:113: bool isStateBlockedFromRunningScript() const { return state() <= BlockedFromRunningScript; ...
6 years, 11 months ago (2014-01-22 17:45:54 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/morrita@chromium.org/141143006/110001
6 years, 11 months ago (2014-01-22 20:31:28 UTC) #4
commit-bot: I haz the power
Retried try job too often on linux_blink_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_blink_rel&number=18647
6 years, 11 months ago (2014-01-22 22:40:56 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/morrita@chromium.org/141143006/420001
6 years, 11 months ago (2014-01-23 00:54:41 UTC) #6
commit-bot: I haz the power
Retried try job too often on linux_blink_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_blink_rel&number=18685
6 years, 11 months ago (2014-01-23 03:34:27 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/morrita@chromium.org/141143006/150002
6 years, 11 months ago (2014-01-23 04:55:25 UTC) #8
commit-bot: I haz the power
Failed to apply patch for Source/core/html/HTMLImport.h: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file ...
6 years, 11 months ago (2014-01-23 04:55:40 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/morrita@chromium.org/141143006/560001
6 years, 11 months ago (2014-01-23 06:19:03 UTC) #10
commit-bot: I haz the power
6 years, 11 months ago (2014-01-23 09:47:48 UTC) #11
Message was sent while issue was closed.
Change committed as 165624

Powered by Google App Engine
This is Rietveld 408576698