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

Issue 1093043004: Do not JSON encode the 'result' of a service rpc. (Closed)

Created:
5 years, 8 months ago by turnidge
Modified:
5 years, 8 months ago
Reviewers:
Cutch
CC:
reviews_dartlang.org, Cutch, vm-dev_dartlang.org, Chris Bracken
Target Ref:
refs/remotes/git-svn
Visibility:
Public.

Description

Do not JSON encode the 'result' of a service rpc. Before a response looked like this... { result:<string> id:* } ...where result was always a json encoded string. This meant that users of the service protocol had to json decode both the outer message and the result, which was silly. Now a response looks like this: { result:<map> id:* } This means that users of the service protocol only need to decode once. We have changed event formats as well. Previously, an event looked like this: { result:<string> } (Essentially a result without an id.) The result was json encoded, requiring the user to double-decode. Now an event looks like this: { event:<map> } This allows us to distinguish events from rpc results and avoids double-decoding. It also avoids having an id-less rpc result mistaken for an event. ------------ Some details and associated changes: - Unify GCEvent and ServiceEvent in the VM. - Move sequence number handling out of dart code and into JSONStream in the VM. Plumbing. I needed to do this to avoid double-encoding. Some of the dart code gets a bit simpler. - Update C++ tests to have a sequence number. - Change format of method/params used in Error responses to be more json-y. - Strip out double decoding in the service lib. - Improvements to tests. I was running into some races and other issues. - Fail fast when we run into a message decoding problem. Instead of returning a service exception, we now disconnect from the vm. - VMDisconnected => ConnectionClosed. - Add some support for a reason string when disconnecting from the vm in the service library. Committed: https://code.google.com/p/dart/source/detail?r=45378

Patch Set 1 #

Patch Set 2 : edits #

Total comments: 4

Patch Set 3 : fixes after merge #

Patch Set 4 : code review #

Unified diffs Side-by-side diffs Delta from patch set Stats (+307 lines, -260 lines) Patch
M runtime/bin/vmservice/server.dart View 2 chunks +3 lines, -11 lines 0 comments Download
M runtime/observatory/lib/service.dart View 1 chunk +0 lines, -1 line 0 comments Download
M runtime/observatory/lib/service_common.dart View 7 chunks +64 lines, -37 lines 0 comments Download
M runtime/observatory/lib/src/app/application.dart View 1 2 3 chunks +18 lines, -20 lines 0 comments Download
M runtime/observatory/lib/src/app/location_manager.dart View 1 2 1 chunk +3 lines, -1 line 0 comments Download
M runtime/observatory/lib/src/service/object.dart View 1 2 3 6 chunks +13 lines, -38 lines 0 comments Download
M runtime/observatory/tests/service/gc_test.dart View 1 chunk +5 lines, -2 lines 0 comments Download
M runtime/observatory/tests/service/isolate_lifecycle_test.dart View 1 2 chunks +50 lines, -21 lines 0 comments Download
M runtime/observatory/tests/service/malformed_test.dart View 1 2 3 1 chunk +18 lines, -15 lines 0 comments Download
M runtime/vm/heap.h View 2 chunks +2 lines, -11 lines 0 comments Download
M runtime/vm/heap.cc View 3 chunks +4 lines, -17 lines 0 comments Download
M runtime/vm/json_stream.h View 3 chunks +4 lines, -0 lines 0 comments Download
M runtime/vm/json_stream.cc View 4 chunks +12 lines, -0 lines 0 comments Download
M runtime/vm/service.h View 1 chunk +0 lines, -1 line 0 comments Download
M runtime/vm/service.cc View 6 chunks +30 lines, -33 lines 0 comments Download
M runtime/vm/service/client.dart View 1 chunk +3 lines, -3 lines 0 comments Download
M runtime/vm/service/message.dart View 5 chunks +27 lines, -19 lines 0 comments Download
M runtime/vm/service/vmservice.dart View 1 chunk +1 line, -1 line 0 comments Download
M runtime/vm/service_event.h View 4 chunks +13 lines, -1 line 0 comments Download
M runtime/vm/service_event.cc View 3 chunks +9 lines, -1 line 0 comments Download
M runtime/vm/service_test.cc View 14 chunks +28 lines, -27 lines 0 comments Download

Messages

Total messages: 5 (1 generated)
turnidge
John, this is the one I've been working on for a while... Chris, heads up...
5 years, 8 months ago (2015-04-21 21:15:52 UTC) #2
Cutch
LGTMwC https://codereview.chromium.org/1093043004/diff/20001/runtime/observatory/lib/src/service/object.dart File runtime/observatory/lib/src/service/object.dart (right): https://codereview.chromium.org/1093043004/diff/20001/runtime/observatory/lib/src/service/object.dart#newcode470 runtime/observatory/lib/src/service/object.dart:470: 'message': 'Top level service responses must be service ...
5 years, 8 months ago (2015-04-21 23:38:53 UTC) #3
turnidge
https://codereview.chromium.org/1093043004/diff/20001/runtime/observatory/lib/src/service/object.dart File runtime/observatory/lib/src/service/object.dart (right): https://codereview.chromium.org/1093043004/diff/20001/runtime/observatory/lib/src/service/object.dart#newcode470 runtime/observatory/lib/src/service/object.dart:470: 'message': 'Top level service responses must be service maps: ...
5 years, 8 months ago (2015-04-23 17:51:59 UTC) #4
turnidge
5 years, 8 months ago (2015-04-23 17:55:56 UTC) #5
Message was sent while issue was closed.
Committed patchset #4 (id:60001) manually as 45378 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698