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

Unified Diff: runtime/vm/json_stream.cc

Issue 2662333002: Start adding vm/cc tests for rewind functionality. (Closed)
Patch Set: code review Created 3 years, 11 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/debugger_test.cc ('k') | runtime/vm/service.cc » ('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 f098998dd1642b3e05d87986cef481144d79e2c0..0f041174a8d574d2e06fb2f0adaf0bdb012bd097 100644
--- a/runtime/vm/json_stream.cc
+++ b/runtime/vm/json_stream.cc
@@ -210,10 +210,9 @@ static void Finalizer(void* isolate_callback_data,
void JSONStream::PostReply() {
+ ASSERT(seq_ != NULL);
Dart_Port port = reply_port();
- ASSERT(port != ILLEGAL_PORT);
set_reply_port(ILLEGAL_PORT); // Prevent double replies.
- ASSERT(seq_ != NULL);
if (seq_->IsString()) {
const String& str = String::Cast(*seq_);
PrintProperty("id", str.ToCString());
@@ -224,12 +223,22 @@ void JSONStream::PostReply() {
const Double& dbl = Double::Cast(*seq_);
PrintProperty("id", dbl.value());
} else if (seq_->IsNull()) {
+ if (port == ILLEGAL_PORT) {
+ // This path is only used in tests.
+ buffer_.AddChar('}'); // Finish our message.
+ char* cstr;
+ intptr_t length;
+ Steal(&cstr, &length);
+ OS::PrintErr("-----\nDropping reply:\n%s\n-----\n", cstr);
+ free(cstr);
+ }
// JSON-RPC 2.0 says that a request with a null ID shouldn't get a reply.
PostNullReply(port);
return;
}
- buffer_.AddChar('}');
+ ASSERT(port != ILLEGAL_PORT);
+ buffer_.AddChar('}'); // Finish our message.
char* cstr;
intptr_t length;
Steal(&cstr, &length);
« no previous file with comments | « runtime/vm/debugger_test.cc ('k') | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698