Chromium Code Reviews

Unified Diff: sdk/lib/mdv_observe_impl/mdv_observe_impl.dart

Issue 15989006: Revert until Windows crash is debugged. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « sdk/lib/io/mime_multipart_parser.dart ('k') | sdk/lib/utf/utf_stream.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/mdv_observe_impl/mdv_observe_impl.dart
diff --git a/sdk/lib/mdv_observe_impl/mdv_observe_impl.dart b/sdk/lib/mdv_observe_impl/mdv_observe_impl.dart
index ed42d62ef2453b0aa663e286f361c9ea0e1546f1..e56554bce82d3cbac789836e9b70d9b126b372f3 100644
--- a/sdk/lib/mdv_observe_impl/mdv_observe_impl.dart
+++ b/sdk/lib/mdv_observe_impl/mdv_observe_impl.dart
@@ -63,15 +63,16 @@ typedef ObservableBase = Object with ObservableMixin;
* call [notifyPropertyChange]. See that method for an example.
*/
abstract class ObservableMixin implements Observable {
- StreamController _multiplexController;
+ StreamController<List<ChangeRecord>> _observers;
+ Stream<List<ChangeRecord>> _stream;
List<ChangeRecord> _changes;
Stream<List<ChangeRecord>> get changes {
- if (_multiplexController == null) {
- _multiplexController =
- new StreamController<List<ChangeRecord>>.multiplex();
+ if (_observers == null) {
+ _observers = new StreamController<List<ChangeRecord>>();
+ _stream = _observers.stream.asBroadcastStream();
}
- return _multiplexController.stream;
+ return _stream;
}
void _deliverChanges() {
@@ -79,7 +80,7 @@ abstract class ObservableMixin implements Observable {
_changes = null;
if (hasObservers && changes != null) {
// TODO(jmesserly): make "changes" immutable
- _multiplexController.add(changes);
+ _observers.add(changes);
}
}
@@ -87,8 +88,7 @@ abstract class ObservableMixin implements Observable {
* True if this object has any observers, and should call
* [notifyPropertyChange] for changes.
*/
- bool get hasObservers => _multiplexController != null &&
- _multiplexController.hasListener;
+ bool get hasObservers => _observers != null && _observers.hasListener;
/**
* Notify that the field [name] of this object has been changed.
« no previous file with comments | « sdk/lib/io/mime_multipart_parser.dart ('k') | sdk/lib/utf/utf_stream.dart » ('j') | no next file with comments »

Powered by Google App Engine