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

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

Issue 2438613002: Provide an API to dart:developer to control the web server hosting the Service Protocol (Closed)
Patch Set: CHANGELOG.md merge and fatal error Created 4 years, 1 month 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 | « runtime/bin/vmservice/server.dart ('k') | runtime/bin/vmservice_dartium.h » ('j') | 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 7ae65d480de9187bb17947987b00054397544afd..a883a73cf31165f9d60774c484c3f7f776c1628f 100644
--- a/runtime/bin/vmservice/vmservice_io.dart
+++ b/runtime/bin/vmservice/vmservice_io.dart
@@ -162,6 +162,27 @@ Future<List<Map<String,String>>> listFilesCallback(Uri dirPath) async {
return result;
}
+Future<Uri> serverInformationCallback() async {
+ _lazyServerBoot();
+ return server.serverAddress;
+}
+
+Future<Uri> webServerControlCallback(bool enable) async {
+ _lazyServerBoot();
+ if (server.running == enable) {
+ // No change.
+ return server.serverAddress;
+ }
+
+ if (enable) {
+ await server.startup();
+ return server.serverAddress;
+ } else {
+ await server.shutdown(true);
+ return server.serverAddress;
+ }
+}
+
_clearFuture(_) {
serverFuture = null;
}
@@ -204,6 +225,8 @@ main() {
VMServiceEmbedderHooks.writeStreamFile = writeStreamFileCallback;
VMServiceEmbedderHooks.readFile = readFileCallback;
VMServiceEmbedderHooks.listFiles = listFilesCallback;
+ VMServiceEmbedderHooks.serverInformation = serverInformationCallback;
+ VMServiceEmbedderHooks.webServerControl = webServerControlCallback;
// Always instantiate the vmservice object so that the exit message
// can be delivered and waiting loaders can be cancelled.
var service = new VMService();
« no previous file with comments | « runtime/bin/vmservice/server.dart ('k') | runtime/bin/vmservice_dartium.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698