[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

Review URL: https://codereview.chromium.org/141143006

git-svn-id: svn://svn.chromium.org/blink/trunk@165624 bbb929c8-8fbe-4397-9dbb-9b2b20218538
IDL compiler: [PutForwards]

The code generation is v. simple.

The complexity of this feature is that we want to introspect another
interface.

The Perl code does this by the CG reading in the file (!!),
which of course makes a mess of dependencies.
(Interfaces *should* depend on the target of [PutForwards], but they don't.)

Instead, we handle this in the dependency resolution
(compute_dependencies and interface_dependency_resolver);
the only CG change is that we make interfaces available as a global
(it's the global context), so the CG can introspect these as necessary.

If we want to add introspection of other interfaces, it's now an easy
change: just add the interface name in compute_dependencies, and everything
else is handled automatically!

This also ensures that dependencies are correctly calculated, as all the
dependencies are calculated in one place, instead of randomly called in
the CG.

There's a little bit of plumbing and refactoring, but that's it.

BUG=239771
R=haraken

Review URL: https://codereview.chromium.org/143413006

git-svn-id: svn://svn.chromium.org/blink/trunk@165625 bbb929c8-8fbe-4397-9dbb-9b2b20218538