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

Issue 938623005: Allow multiple dart <script> tags in .sky files (Closed)

Created:
5 years, 10 months ago by eseidel
Modified:
5 years, 10 months ago
Reviewers:
abarth-chromium
CC:
abarth-chromium, esprehn, mojo-reviews_chromium.org, ojan, qsr+mojo_chromium.org, rmacnak, zra
Base URL:
git@github.com:domokit/mojo.git@master
Target Ref:
refs/heads/master
Project:
mojo
Visibility:
Public.

Description

Allow multiple dart <script> tags in .sky files This does several things: 1. Teaches sky about asynchronous script execution. Previously once all imports were loaded and the script text was available, we executed a script and assumed it completed synchronously. We left the parser loop to do so, but that was fine as the next chunk from the background thread would resume the parser. In this change scripts now load and execute separately. The "load" step may trigger further dart import loads which may cause the execution to happen asynchronously which required teaching both the DartController and the HTMLScriptRunner to take callbacks to allow HTMLDocumentParser to know to continue parsing after the Dart script has resolved its imports and executed. This required re-working some of how the parser executes scripts and I re-purposed isWaitingForScripts to include "is the parser blocked" where as before it was limited only to "does the treebuilder have a script", even though the imports system may have had pending scripts as well. I made HTMLScriptRunner live only as long as the script it was executing since it only contained per-script state at this point. 2. Fixed an error reporting bug whereby we would not show errors when "init" failed to execute, only "main". This required using the dart_mirrors_api.h which required adding an include path to the core build. :( 3. Made it possible for a single sky file to contain multiple dart <script> tags. Each <script> is a separate library and executes as soon as </script> is seen. main or init is called for each. This required mangling "urls" for these script blocks since Dart unique's libraries by urls. Before this change it may have been possible to do <import 'foo.sky'> and then <script>import 'foo.sky'</script> and have it work!? R=abarth@chromium.org BUG= Committed: https://chromium.googlesource.com/external/mojo/+/010f28fac7de290d277995132699111184834516

Patch Set 1 #

Patch Set 2 : Seems to render fine, but all tests time out #

Patch Set 3 : Half the tests pass #

Patch Set 4 : multiple-scripts.sky now works #

Patch Set 5 : Everything passes except modules/dart-imports-loader-interaction.sky #

Patch Set 6 : Run git cl format #

Patch Set 7 : All works! #

Total comments: 8

Patch Set 8 : More tests #

Patch Set 9 : Update test results #

Unified diffs Side-by-side diffs Delta from patch set Stats (+406 lines, -92 lines) Patch
M sky/engine/core/BUILD.gn View 1 2 3 4 5 6 1 chunk +5 lines, -0 lines 0 comments Download
M sky/engine/core/app/AbstractModule.h View 1 2 3 4 5 6 7 3 chunks +17 lines, -3 lines 0 comments Download
M sky/engine/core/app/AbstractModule.cpp View 1 2 3 4 5 6 1 chunk +14 lines, -0 lines 0 comments Download
M sky/engine/core/html/parser/HTMLDocumentParser.h View 1 2 3 4 5 3 chunks +5 lines, -2 lines 0 comments Download
M sky/engine/core/html/parser/HTMLDocumentParser.cpp View 1 2 3 4 5 6 7 9 chunks +40 lines, -12 lines 0 comments Download
M sky/engine/core/html/parser/HTMLScriptRunner.h View 1 2 3 4 5 1 chunk +45 lines, -6 lines 0 comments Download
M sky/engine/core/html/parser/HTMLScriptRunner.cpp View 1 2 3 4 5 2 chunks +91 lines, -15 lines 0 comments Download
M sky/engine/core/script/dart_controller.h View 1 2 3 4 5 3 chunks +16 lines, -8 lines 0 comments Download
M sky/engine/core/script/dart_controller.cc View 1 2 3 4 5 6 7 2 chunks +74 lines, -48 lines 0 comments Download
M sky/engine/core/script/dart_loader.cc View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
A sky/tests/modules/dart-imports-loader-interaction.sky View 1 2 3 4 1 chunk +12 lines, -0 lines 0 comments Download
A + sky/tests/modules/dart-imports-loader-interaction-expected.txt View 1 2 3 4 5 6 0 chunks +-1 lines, --1 lines 0 comments Download
A sky/tests/modules/multiple-scripts.sky View 1 2 3 4 1 chunk +19 lines, -0 lines 0 comments Download
A + sky/tests/modules/multiple-scripts-expected.txt View 1 2 3 4 0 chunks +-1 lines, --1 lines 0 comments Download
A sky/tests/modules/multiple-scripts-import.sky View 1 2 3 4 5 6 7 1 chunk +28 lines, -0 lines 0 comments Download
A sky/tests/modules/multiple-scripts-import-expected.txt View 1 2 3 4 5 6 7 8 1 chunk +8 lines, -0 lines 0 comments Download
A sky/tests/modules/resources/dart-import.dart View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
A sky/tests/modules/resources/multiple-scripts-child.sky View 1 2 3 4 5 6 7 1 chunk +18 lines, -0 lines 0 comments Download
A sky/tests/modules/resources/with-dart-import.sky View 1 2 3 4 5 6 1 chunk +12 lines, -0 lines 0 comments Download

Messages

Total messages: 6 (1 generated)
eseidel
5 years, 10 months ago (2015-02-18 21:10:42 UTC) #1
eseidel
I think this is ready to start reviews. Everything works except modules/dart-imports-loader-interaction.sky which hits an ...
5 years, 10 months ago (2015-02-19 01:15:40 UTC) #2
eseidel
ptal
5 years, 10 months ago (2015-02-19 02:14:30 UTC) #3
abarth-chromium
LGTM You'll probably want to add some more tests. https://codereview.chromium.org/938623005/diff/120001/sky/engine/core/app/AbstractModule.cpp File sky/engine/core/app/AbstractModule.cpp (right): https://codereview.chromium.org/938623005/diff/120001/sky/engine/core/app/AbstractModule.cpp#newcode31 sky/engine/core/app/AbstractModule.cpp:31: ...
5 years, 10 months ago (2015-02-19 02:51:40 UTC) #4
eseidel
5 years, 10 months ago (2015-02-20 19:08:32 UTC) #6
Message was sent while issue was closed.
Committed patchset #9 (id:160001) manually as
010f28fac7de290d277995132699111184834516 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698