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

Unified Diff: tools/dom/templates/html/impl/impl_Node.darttemplate

Issue 14018022: Fix model-tree-observer in html. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 | « tools/dom/src/ModelTreeObserver.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/templates/html/impl/impl_Node.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_Node.darttemplate b/tools/dom/templates/html/impl/impl_Node.darttemplate
index ea94c128aecabcae966b135305252facbf4e8cf9..af1644763a7f2b71f4ede4194513b671918cbfbe 100644
--- a/tools/dom/templates/html/impl/impl_Node.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Node.darttemplate
@@ -299,7 +299,7 @@ $endif
@Experimental
get model {
// If we have a change handler then we've cached the model locally.
- if (!_modelChangedStreams.isEmpty) {
+ if (_modelChangedStreams != null && !_modelChangedStreams.isEmpty) {
return _model;
}
// Otherwise start looking up the tree.
@@ -319,7 +319,7 @@ $endif
_ModelTreeObserver.initialize();
if (changed) {
- if (!_modelChangedStreams.isEmpty) {
+ if (_modelChangedStreams != null && !_modelChangedStreams.isEmpty) {
_modelChangedStreams.toList().forEach((stream) => stream.add(this));
}
// Propagate new model to all descendants.
@@ -349,11 +349,14 @@ $endif
* Get a stream of models, whenever the model changes.
*/
Stream<Node> get onModelChanged {
- var result;
- result = new StreamController(
- onListen: () { _modelChangedStreams.add(result); },
- onCancel: () { _modelChangedStreams.remove(result); });
- return result;
+ if (_modelChangedStreams == null) {
+ _modelChangedStreams = new Set<StreamController<Node>>();
+ }
+ var controller;
+ controller = new StreamController(
+ onListen: () { _modelChangedStreams.add(controller); },
+ onCancel: () { _modelChangedStreams.remove(controller); });
+ return controller.stream;
}
/**
« no previous file with comments | « tools/dom/src/ModelTreeObserver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698