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

Unified Diff: runtime/vm/json_stream.cc

Issue 1285673003: When no service response is requested, send null back to the service isolate so it can cleanup (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 months 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/vm/json_stream.h ('k') | runtime/vm/service/message.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/json_stream.cc
diff --git a/runtime/vm/json_stream.cc b/runtime/vm/json_stream.cc
index a4e5ad21815bf2758d3cccf77de3b017e5e3bd34..9dcb3d5efd199f619d636476ebf5eb3fcfd39969 100644
--- a/runtime/vm/json_stream.cc
+++ b/runtime/vm/json_stream.cc
@@ -153,6 +153,20 @@ static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) {
}
+void JSONStream::PostNullReply(Dart_Port port) {
+ const Object& reply = Object::Handle(Object::null());
+ ASSERT(reply.IsNull());
+
+ uint8_t* data = NULL;
+ MessageWriter writer(&data, &allocator, false);
+ writer.WriteMessage(reply);
+ PortMap::PostMessage(new Message(port,
+ data,
+ writer.BytesWritten(),
+ Message::kNormalPriority));
+}
+
+
void JSONStream::PostReply() {
Dart_Port port = reply_port();
ASSERT(port != ILLEGAL_PORT);
@@ -173,6 +187,7 @@ void JSONStream::PostReply() {
PrintProperty("id", dbl.value());
} else if (seq_.IsNull()) {
// JSON-RPC 2.0 says that a request with a null ID shouldn't get a reply.
+ PostNullReply(port);
return;
}
buffer_.AddChar('}');
« no previous file with comments | « runtime/vm/json_stream.h ('k') | runtime/vm/service/message.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698