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

Unified Diff: runtime/vm/isolate.cc

Issue 1527793004: Provide list of service protocol extensions in isolate and emit an event when one is registered (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 | « runtime/observatory/tests/service/developer_extension_test.dart ('k') | runtime/vm/service/service.md » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/isolate.cc
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index fe5289180a6a853a853c82ff35c8e883cfc0c9fe..0199af5eb21eb108465de362ca5823c4e32a7cbc 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -1859,6 +1859,19 @@ void Isolate::PrintJSON(JSONStream* stream, bool ref) {
JSONObject jssettings(&jsobj, "_debuggerSettings");
debugger()->PrintSettingsToJSONObject(&jssettings);
}
+
+ {
+ GrowableObjectArray& handlers =
+ GrowableObjectArray::Handle(registered_service_extension_handlers());
+ if (!handlers.IsNull()) {
+ JSONArray extensions(&jsobj, "extensionRPCs");
+ String& handler_name = String::Handle();
+ for (intptr_t i = 0; i < handlers.Length(); i += kRegisteredEntrySize) {
+ handler_name ^= handlers.At(i + kRegisteredNameIndex);
+ extensions.AddValue(handler_name.ToCString());
+ }
+ }
+ }
}
@@ -2042,6 +2055,12 @@ void Isolate::RegisterServiceExtensionHandler(const String& name,
handlers.Add(name, Heap::kOld);
ASSERT(kRegisteredHandlerIndex == 1);
handlers.Add(closure, Heap::kOld);
+ {
+ // Fire off an event.
+ ServiceEvent event(this, ServiceEvent::kServiceExtensionAdded);
+ event.set_extension_rpc(&name);
+ Service::HandleEvent(&event);
+ }
}
« no previous file with comments | « runtime/observatory/tests/service/developer_extension_test.dart ('k') | runtime/vm/service/service.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698