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

Unified Diff: mojo/dart/embedder/vmservice/main.dart

Issue 1480243004: Dart: Lazy observatory asset loading. Option to disable the observatory. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/dart/embedder/dart_controller.cc ('k') | mojo/tools/data/benchmarks » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/dart/embedder/vmservice/main.dart
diff --git a/mojo/dart/embedder/vmservice/main.dart b/mojo/dart/embedder/vmservice/main.dart
index 1e360d79ccf59368cfb32907df411de684c4e1d0..608d34cfb52ad3df2b4c9e6ea12969c383272623 100644
--- a/mojo/dart/embedder/vmservice/main.dart
+++ b/mojo/dart/embedder/vmservice/main.dart
@@ -21,7 +21,17 @@ bool _autoStart;
// HTTP server.
Server server;
-Map<String, Asset> assets;
+Map<String, Asset> _assets;
+Map<String, Asset> get assets {
+ if (_assets == null) {
+ try {
+ _assets = Asset.request();
+ } catch (e) {
+ print('Could not load Observatory assets: $e');
+ }
+ }
+ return _assets;
+}
_onShutdown() {
if (server != null) {
@@ -34,11 +44,6 @@ _onShutdown() {
}
void _bootServer() {
- try {
- assets = Asset.request();
- } catch (e) {
- print('Could not load Observatory assets: $e');
- }
// Lazily create service.
var service = new VMService();
service.onShutdown = _onShutdown;
@@ -52,11 +57,11 @@ main() {
if (server != null) {
server.startup();
}
+ // It's just here to push an event on the event loop so that we invoke the
+ // scheduled microtasks.
+ Timer.run(() {});
}
scriptLoadPort.handler = _processLoadRequest;
- // It's just here to push an event on the event loop so that we invoke the
- // scheduled microtasks.
- Timer.run(() {});
return scriptLoadPort;
}
« no previous file with comments | « mojo/dart/embedder/dart_controller.cc ('k') | mojo/tools/data/benchmarks » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698