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

Unified Diff: mojo/dart/packages/mojo/lib/src/event_stream.dart

Issue 1948003003: Dart: Wait to handle events on a Stub until it makes sense to do it. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Add test Created 4 years, 7 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 | « mojo/dart/packages/mojo/lib/src/codec.dart ('k') | mojo/dart/packages/mojo/lib/src/stub.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/dart/packages/mojo/lib/src/event_stream.dart
diff --git a/mojo/dart/packages/mojo/lib/src/event_stream.dart b/mojo/dart/packages/mojo/lib/src/event_stream.dart
index 51708259a3a9f98c9b83c237ebd95ebcd406e99e..ea3e5f513319dc1e91491e538736f8f29edf688f 100644
--- a/mojo/dart/packages/mojo/lib/src/event_stream.dart
+++ b/mojo/dart/packages/mojo/lib/src/event_stream.dart
@@ -149,16 +149,21 @@ class MojoEventHandler {
bool _isInHandler = false;
bool _isPeerClosed = false;
- MojoEventHandler.fromEndpoint(MojoMessagePipeEndpoint endpoint)
+ MojoEventHandler.fromEndpoint(MojoMessagePipeEndpoint endpoint,
+ {bool autoBegin: true})
: _endpoint = endpoint,
_eventSubscription = new MojoEventSubscription(endpoint.handle) {
- beginHandlingEvents();
+ if (autoBegin) {
+ beginHandlingEvents();
+ }
}
- MojoEventHandler.fromHandle(MojoHandle handle)
+ MojoEventHandler.fromHandle(MojoHandle handle, {bool autoBegin: true})
: _endpoint = new MojoMessagePipeEndpoint(handle),
_eventSubscription = new MojoEventSubscription(handle) {
- beginHandlingEvents();
+ if (autoBegin) {
+ beginHandlingEvents();
+ }
}
MojoEventHandler.unbound();
« no previous file with comments | « mojo/dart/packages/mojo/lib/src/codec.dart ('k') | mojo/dart/packages/mojo/lib/src/stub.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698