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

Side by Side Diff: mojo/public/dart/src/event_stream.dart

Issue 959993002: Dart: Removes name conflicts from generated bindings. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 part of core; 5 part of core;
6 6
7 class MojoEventStream extends Stream<int> { 7 class MojoEventStream extends Stream<List<int>> {
8 // The underlying Mojo handle. 8 // The underlying Mojo handle.
9 MojoHandle _handle; 9 MojoHandle _handle;
10 10
11 // Providing our own stream controller allows us to take custom actions when 11 // Providing our own stream controller allows us to take custom actions when
12 // listeners pause/resume/etc. their StreamSubscription. 12 // listeners pause/resume/etc. their StreamSubscription.
13 StreamController _controller; 13 StreamController _controller;
14 14
15 // The send port that we give to the handle watcher to notify us of handle 15 // The send port that we give to the handle watcher to notify us of handle
16 // events. 16 // events.
17 SendPort _sendPort; 17 SendPort _sendPort;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 111 }
112 } 112 }
113 } 113 }
114 114
115 bool get readyRead => _handle.readyRead; 115 bool get readyRead => _handle.readyRead;
116 bool get readyWrite => _handle.readyWrite; 116 bool get readyWrite => _handle.readyWrite;
117 117
118 String toString() => "$_handle"; 118 String toString() => "$_handle";
119 } 119 }
120 120
121 abstract class Listener { 121 class MojoEventStreamListener {
122 StreamSubscription<List<int>> listen();
123 }
124
125 class MojoEventStreamListener implements Listener {
126 MojoMessagePipeEndpoint _endpoint; 122 MojoMessagePipeEndpoint _endpoint;
127 MojoEventStream _eventStream; 123 MojoEventStream _eventStream;
128 bool _isOpen = false; 124 bool _isOpen = false;
129 bool _isInHandler = false; 125 bool _isInHandler = false;
130 126
131 MojoEventStreamListener(MojoMessagePipeEndpoint endpoint) : 127 MojoEventStreamListener(MojoMessagePipeEndpoint endpoint) :
132 _endpoint = endpoint, 128 _endpoint = endpoint,
133 _eventStream = new MojoEventStream(endpoint.handle), 129 _eventStream = new MojoEventStream(endpoint.handle),
134 _isOpen = false; 130 _isOpen = false;
135 131
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 199 }
204 200
205 MojoHandleSignals enableSignals(MojoHandleSignals watched, 201 MojoHandleSignals enableSignals(MojoHandleSignals watched,
206 MojoHandleSignals received) => watched; 202 MojoHandleSignals received) => watched;
207 203
208 MojoMessagePipeEndpoint get endpoint => _endpoint; 204 MojoMessagePipeEndpoint get endpoint => _endpoint;
209 bool get isOpen => _isOpen; 205 bool get isOpen => _isOpen;
210 bool get isInHandler => _isInHandler; 206 bool get isInHandler => _isInHandler;
211 bool get isBound => _endpoint != null; 207 bool get isBound => _endpoint != null;
212 } 208 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698