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

Side by Side Diff: pkg/observe/lib/src/compound_path_observer.dart

Issue 61793008: Fix in compound path observer: this fixes the error we saw in our manual testing (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library observe.src.compound_path_observer; 5 library observe.src.compound_path_observer;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'package:observe/observe.dart'; 8 import 'package:observe/observe.dart';
9 9
10 /** 10 /**
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // TODO(rafaelw): Consider having a seperate ChangeSummary for 78 // TODO(rafaelw): Consider having a seperate ChangeSummary for
79 // CompoundBindings so to excess dirtyChecks. 79 // CompoundBindings so to excess dirtyChecks.
80 void _scheduleResolve(_) { 80 void _scheduleResolve(_) {
81 if (_scheduled) return; 81 if (_scheduled) return;
82 _scheduled = true; 82 _scheduled = true;
83 scheduleMicrotask(_resolve); 83 scheduleMicrotask(_resolve);
84 } 84 }
85 85
86 void _resolve() { 86 void _resolve() {
87 _scheduled = false; 87 _scheduled = false;
88 if (_observers.isEmpty) return;
Siggi Cherem (dart-lang) 2013/11/08 18:37:00 turns out that the schedule happens when there wer
88 var newValue = _observers.map((o) => o.value).toList(); 89 var newValue = _observers.map((o) => o.value).toList();
89 if (_computeValue != null) newValue = _computeValue(newValue); 90 if (_computeValue != null) newValue = _computeValue(newValue);
90 _value = notifyPropertyChange(#value, _value, newValue); 91 _value = notifyPropertyChange(#value, _value, newValue);
91 } 92 }
92 93
93 /** 94 /**
94 * Closes the observer. 95 * Closes the observer.
95 * 96 *
96 * This happens automatically if the [value] property is no longer observed, 97 * This happens automatically if the [value] property is no longer observed,
97 * but this can also be called explicitly. 98 * but this can also be called explicitly.
98 */ 99 */
99 void close() { 100 void close() {
100 if (_observers.isEmpty) return; 101 if (_observers.isEmpty) return;
101 102
102 if (_started) { 103 if (_started) {
103 for (StreamSubscription sub in _subs) { 104 for (StreamSubscription sub in _subs) {
104 sub.cancel(); 105 sub.cancel();
105 } 106 }
106 } 107 }
107 _observers.clear(); 108 _observers.clear();
108 _subs.clear(); 109 _subs.clear();
109 _value = null; 110 _value = null;
110 } 111 }
111 112
112 observed() => start(); 113 observed() => start();
113 unobserved() => close(); 114 unobserved() => close();
114 } 115 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698