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

Unified Diff: pkg/observe/lib/src/path_observer.dart

Issue 335943003: merge to trunk all changes from 36817 until 37378 under the packages: polymer, (Closed) Base URL: http://dart.googlecode.com/svn/trunk/dart/
Patch Set: Created 6 years, 6 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 | « pkg/observe/lib/src/bindable.dart ('k') | pkg/observe/lib/transformer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/observe/lib/src/path_observer.dart
===================================================================
--- pkg/observe/lib/src/path_observer.dart (revision 37373)
+++ pkg/observe/lib/src/path_observer.dart (working copy)
@@ -41,6 +41,7 @@
/// Sets the value at this path.
void set value(Object newValue) {
if (_path != null) _path.setValueFrom(_object, newValue);
+ _discardChanges();
}
int get _reportArgumentCount => 2;
@@ -431,7 +432,7 @@
throw new StateError('Cannot add observers once started.');
}
- observer.open(_deliver);
+ observer.open((_) => deliver());
_observed..add(_observerSentinel)..add(observer);
}
@@ -532,10 +533,7 @@
return _value;
}
- get value {
- _check(skipChanges: true);
- return _value;
- }
+ get value => _discardChanges();
void close() {
if (!_isOpen) return;
@@ -545,10 +543,13 @@
_notifyCallback = null;
}
- void _deliver(_) {
- if (_isOpen) _dirtyCheck();
+ _discardChanges() {
+ _check(skipChanges: true);
+ return _value;
}
+ bool deliver() => _isOpen ? _dirtyCheck() : false;
+
bool _dirtyCheck() {
var cycles = 0;
while (cycles < _MAX_DIRTY_CHECK_CYCLES && _check()) {
« no previous file with comments | « pkg/observe/lib/src/bindable.dart ('k') | pkg/observe/lib/transformer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698