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

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

Issue 336013003: Version 1.5.0-dev.4.14 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
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 | « dart/pkg/observe/lib/src/bindable.dart ('k') | dart/pkg/observe/lib/transformer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/pkg/observe/lib/src/path_observer.dart
===================================================================
--- dart/pkg/observe/lib/src/path_observer.dart (revision 37358)
+++ dart/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 | « dart/pkg/observe/lib/src/bindable.dart ('k') | dart/pkg/observe/lib/transformer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698