Chromium Code Reviews
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 #Messages
Total messages: 11 (0 generated)
|