This CL makes it possible to run Sky apps offline by introducing new
DartLibraryProvider subclasses, specifically one that can load directly from
the file system. A future CL will expand this functionality to work with asset
bundles as well.
Currently, the only platform that uses this functionality is Linux, which can
now load a simple Sky app without even loading a network stack. Making this
work on other platforms is work for future CLs.
TBR=eseidel@chromium.org
Review URL: https://codereview.chromium.org/1203143004.
This CL factors the network interactions out of DartLoader into a
DartLibraryProvider interface, paving the way for other library providers
(e.g., offline).
As part of this CL, I've renamed DartLoader to DartLibraryLoader and moved the
class into tonic, where it can't have any direct network dependencies.
R=eseidel@chromium.org
Review URL: https://codereview.chromium.org/1202283004.
This CL adds the ability to load Dart snapshot files created by sky_packager in
Sky. Using a snapshot lets us transmit all the code for an app in a single blob
and should improve startup time. Later CLs will make this codepath easier to
use and evaluate performance.
R=eseidel@chromium.org
Review URL: https://codereview.chromium.org/1197133004.
- Bump Dart and Observatory DEPS to 45576 and 45565 respectively.
- Include 'dart:io' in snapshot
- Add 'dart:io' native bindings to sky bindings.
- Initialize 'dart:io' in sky dart_controller.
- Include Observatory and service isolate resources in build.
- Bring up service isolate.
- Start handle watcher isolate from service isolate (hides handle watcher isolate from debugger and Observatory).
- Hook up debugger.
R=eseidel@chromium.org
Review URL: https://codereview.chromium.org/1107803002
The bindings, core, and application libraries are now referred to as, e.g.:
package:mojo/public/dart/core.dart
Since the handle watcher remains in the snapshot, it no
longer refers to types defined in core.dart. References to types defined
in core.dart are also removed from mojo_natives.cc.
In Dart packaged apps, the SDK is zipped up under mojo/public/dart.
For embedder tests, the SDK is copied into the generated source output directory.
A base_dir parameter is added to the 'dart_package' and 'mojom' GN macros so that
consumers of the Mojo SDK can all import using the same URIs regardless of where
the SDK lives in their source trees.
BUG=
R=erg@chromium.org
Review URL: https://codereview.chromium.org/1027603002
Dart actually expects package: to work. This CL makes package:foo
map to /packages/foo, similar to how Dartium or bin/dart would expect.
This also means overlaying the /gen directory over the actual package
outputs (as consumers of an SDK would expect) as well as adding
an additional /lib indirection for the actual package source as
the Dart pub tool will expect.
This is far from perfect, but it unlocks us actually producing a
sky SDK.
I expect there may be some fallout from this change as I'm sure I
missed some package: uses. We also don't have a general solution
for all /foo/bar/baz includes which randomly included parts
of mojo's source directory. Those will need to be updated to use
a package: and deploy_sdk.py taught how to build a package for them.
R=abarth@chromium.org
Review URL: https://codereview.chromium.org/990493002
However WebView::close() no longer crashes. close() is never called
in MojoShell since mojo can't shutdown yet.
I tried closing the existing WebView and replacing it
but somehow that caused it to only draw red. After a while
of looking at this with abarth we decided to just load into
the same WebView for now.
Eventually we should do something smarter where we start the
provisional load and only replace the webview once the new one is
ready, but that's a later CL.
R=abarth@chromium.org
BUG=
Review URL: https://codereview.chromium.org/952273003
This patch adds utility functions which provide a single choke point for calling into sky application code. For now this is only serving the purpose of having a common trace event for calls into app code.
R=abarth@chromium.org, abarth
BUG=
Review URL: https://codereview.chromium.org/941153003
After this CL, you can use <sky-element> to describe custom elements. The
current iteration is very basic and is hardcoded to "example", but its a start.
This CL renames the |init| function to |_init| to prevent importers from
calling it directly. Also, we now pass the <script> element to |_init| to give
some context.
R=ojan@chromium.org, eseidel@chromium.org
Review URL: https://codereview.chromium.org/950493003
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=
Review URL: https://codereview.chromium.org/938623005
Because we dump dart errors to LOG(ERROR) (stderr) instead
of console.log / stdout, tests with dart errors just "pass"
and we don't notice they're not running.
This was the case with canvas-rounded-corners.sky.
I don't think this test actually passes yet, despite it
claiming to, but I at least have made it run and not crash.
Required me commenting out a ton of CanvasRenderingContext2D, but
that's fine, it wasn't actually working and it's better to have
it be compiling valid dart.
R=abarth@chromium.org, ojan@chromium.org
BUG=
Review URL: https://codereview.chromium.org/936563002