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

Issue 185313002: restructure client api to use streams (Closed)

Created:
6 years, 9 months ago by danrubel
Modified:
6 years, 9 months ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

restructure client api to use streams + restructure client api to use streams for notifications and responses + client waits for server shutdown response + cleanup channel tests R=brianwilkerson@google.com Committed: https://code.google.com/p/dart/source/detail?r=33330

Patch Set 1 #

Total comments: 4

Patch Set 2 : fix mock stream to more closely match websocket #

Patch Set 3 : fix mock stream to more closely match websocket #

Total comments: 52

Patch Set 4 : address comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+285 lines, -163 lines) Patch
M pkg/analysis_server/lib/src/analysis_manager.dart View 1 2 3 2 chunks +15 lines, -10 lines 0 comments Download
M pkg/analysis_server/lib/src/channel.dart View 1 2 3 7 chunks +108 lines, -60 lines 0 comments Download
M pkg/analysis_server/lib/src/protocol.dart View 1 2 3 1 chunk +4 lines, -2 lines 0 comments Download
M pkg/analysis_server/test/channel_test.dart View 1 2 3 1 chunk +121 lines, -69 lines 0 comments Download
M pkg/analysis_server/test/mocks.dart View 1 2 3 1 chunk +37 lines, -22 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
danrubel
6 years, 9 months ago (2014-03-01 13:20:11 UTC) #1
Brian Wilkerson
LGTM, but I don't understand very much about streams yet. Might be good to find ...
6 years, 9 months ago (2014-03-01 17:16:37 UTC) #2
danrubel
https://codereview.chromium.org/185313002/diff/1/pkg/analysis_server/lib/src/channel.dart File pkg/analysis_server/lib/src/channel.dart (right): https://codereview.chromium.org/185313002/diff/1/pkg/analysis_server/lib/src/channel.dart#newcode89 pkg/analysis_server/lib/src/channel.dart:89: Stream jsonStream = _socket On 2014/03/01 17:16:37, Brian Wilkerson ...
6 years, 9 months ago (2014-03-03 16:52:19 UTC) #3
Bob Nystrom
I think the semantics here are OK, but I'm not an expert on streams. Added ...
6 years, 9 months ago (2014-03-04 01:03:44 UTC) #4
danrubel
On 2014/03/04 01:03:44, Bob Nystrom wrote: > I think the semantics here are OK, but ...
6 years, 9 months ago (2014-03-05 15:32:04 UTC) #5
danrubel
Committed patchset #4 manually as r33330 (presubmit successful).
6 years, 9 months ago (2014-03-05 15:41:12 UTC) #6
nweiz
https://codereview.chromium.org/185313002/diff/40001/pkg/analysis_server/lib/src/analysis_manager.dart File pkg/analysis_server/lib/src/analysis_manager.dart (right): https://codereview.chromium.org/185313002/diff/40001/pkg/analysis_server/lib/src/analysis_manager.dart#newcode121 pkg/analysis_server/lib/src/analysis_manager.dart:121: channel.close(); On 2014/03/04 01:03:45, Bob Nystrom wrote: > This ...
6 years, 9 months ago (2014-03-05 20:16:38 UTC) #7
Bob Nystrom
https://codereview.chromium.org/185313002/diff/40001/pkg/analysis_server/test/channel_test.dart File pkg/analysis_server/test/channel_test.dart (right): https://codereview.chromium.org/185313002/diff/40001/pkg/analysis_server/test/channel_test.dart#newcode123 pkg/analysis_server/test/channel_test.dart:123: expect(requestsReceived.first.runtimeType, equals(Request)); On 2014/03/05 15:32:04, danrubel wrote: > On ...
6 years, 9 months ago (2014-03-05 21:01:03 UTC) #8
danrubel
6 years, 9 months ago (2014-03-11 19:06:09 UTC) #9
Message was sent while issue was closed.
Sorry for the delay Nathan and thanks for the comments.
I'm finally having time to get back to this.

https://codereview.chromium.org/185313002/diff/40001/pkg/analysis_server/lib/...
File pkg/analysis_server/lib/src/analysis_manager.dart (right):

https://codereview.chromium.org/185313002/diff/40001/pkg/analysis_server/lib/...
pkg/analysis_server/lib/src/analysis_manager.dart:121: channel.close();
On 2014/03/05 20:16:39, nweiz wrote:
> On 2014/03/04 01:03:45, Bob Nystrom wrote:
> > This should probably be async too:
> > 
> > return channel.close().then((_) => false);
> 
> Also below.

Done.

https://codereview.chromium.org/185313002/diff/40001/pkg/analysis_server/lib/...
File pkg/analysis_server/lib/src/channel.dart (right):

https://codereview.chromium.org/185313002/diff/40001/pkg/analysis_server/lib/...
pkg/analysis_server/lib/src/channel.dart:92: .transform(new _JsonConverter())
On 2014/03/05 20:16:39, nweiz wrote:
> On 2014/03/05 15:32:04, danrubel wrote:
> > On 2014/03/04 01:03:45, Bob Nystrom wrote:
> > > Interesting. Is this so you can handle JSON objects that span multiple
> > > "messages" from the socket? I didn't think about needing to consider that
> > case.
> > > :-/
> > 
> > It allows the stream to decide what characters in the stream comprise a
chunk
> of
> > JSON.
> 
> This seems strange to me. I believe web sockets guarantee that message
> boundaries will be preserved, so it seems like it would make for a much
simpler
> protocol overall to just guarantee that each message is an individually valid
> JSON object.

Good to know. Perhaps misunderstanding on my part.

https://codereview.chromium.org/185313002/diff/40001/pkg/analysis_server/test...
File pkg/analysis_server/test/channel_test.dart (right):

https://codereview.chromium.org/185313002/diff/40001/pkg/analysis_server/test...
pkg/analysis_server/test/channel_test.dart:29: class ChannelTest {
On 2014/03/05 20:16:39, nweiz wrote:
> On 2014/03/05 15:32:04, danrubel wrote:
> > On 2014/03/04 01:03:45, Bob Nystrom wrote:
> > > Why make a class for this?
> > 
> > It groups the tests. We will have more tests for this library but focused on
> > other classes.
> 
> You're already using [group] for this. If you need coarser-grained grouping, I
> find it's cleaner to use multiple test libraries.

Good point.

https://codereview.chromium.org/185313002/diff/40001/pkg/analysis_server/test...
pkg/analysis_server/test/channel_test.dart:64: });
On 2014/03/05 20:16:39, nweiz wrote:
> On 2014/03/04 01:03:45, Bob Nystrom wrote:
> > This might do the right thing because responseStream is broadcast, but I've
> run
> > into problems using .first on a stream in tests. Nathan would know more
here.
> 
> With broadcast streams, it's important that you subscribe to them
synchronously
> as soon as they're created, since otherwise they can drop events on the floor.
> In this case you do so, so you should be fine.

Good point. https://codereview.chromium.org/195463004

Powered by Google App Engine
This is Rietveld 408576698