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

Unified Diff: runtime/bin/vmservice/vmservice_io.dart

Issue 1500073003: Load Observatory assets lazily (Closed) Base URL: git@github.com:dart-lang/sdk.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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/vmservice/vmservice_io.dart
diff --git a/runtime/bin/vmservice/vmservice_io.dart b/runtime/bin/vmservice/vmservice_io.dart
index 987af55d7939b7f9be91129e3e2f9ef36b93c344..3816aa2f940224a3f941e35f6a4a73a3da70a112 100644
--- a/runtime/bin/vmservice/vmservice_io.dart
+++ b/runtime/bin/vmservice/vmservice_io.dart
@@ -28,7 +28,17 @@ var _signalSubscription;
// HTTP server.
Server server;
Future<Server> serverFuture;
-HashMap<String, Asset> assets;
+HashMap<String, Asset> _assets;
+HashMap<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) {
@@ -43,11 +53,6 @@ _onShutdown() {
}
_bootServer() {
- try {
- assets = Asset.request();
- } catch (e) {
- print('Could not load Observatory assets: $e');
- }
// Lazily create service.
var service = new VMService();
service.onShutdown = _onShutdown;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698