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

Side by Side Diff: client/observable/observable.dart

Issue 8666012: Partial fix to client breakage (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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('observable'); 5 #library('observable');
6 6
7 #import('dart:coreimpl'); 7 #import('dart:coreimpl');
8 8
9 #source('ChangeEvent.dart'); 9 #source('ChangeEvent.dart');
10 #source('EventBatch.dart'); 10 #source('EventBatch.dart');
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 /** Whether this object is currently observed by listeners or propagators. */ 53 /** Whether this object is currently observed by listeners or propagators. */
54 bool get isObserved() { 54 bool get isObserved() {
55 for (Observable obj = this; obj != null; obj = obj.parent) { 55 for (Observable obj = this; obj != null; obj = obj.parent) {
56 if (listeners.length > 0) { 56 if (listeners.length > 0) {
57 return true; 57 return true;
58 } 58 }
59 } 59 }
60 return false; 60 return false;
61 } 61 }
62 62
63 AbstractObservable([Observable this.parent = null]) 63 AbstractObservable([Observable parent = null])
64 : uid = EventBatch.genUid(), 64 : this.parent = parent,
65 uid = EventBatch.genUid(),
65 listeners = new List<ChangeListener>(); 66 listeners = new List<ChangeListener>();
66 67
67 bool addChangeListener(ChangeListener listener) { 68 bool addChangeListener(ChangeListener listener) {
68 if (listeners.indexOf(listener, 0) == -1) { 69 if (listeners.indexOf(listener, 0) == -1) {
69 listeners.add(listener); 70 listeners.add(listener);
70 return true; 71 return true;
71 } 72 }
72 73
73 return false; 74 return false;
74 } 75 }
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 // equality check should be done? 290 // equality check should be done?
290 if (newValue !== _value) { 291 if (newValue !== _value) {
291 final oldValue = _value; 292 final oldValue = _value;
292 _value = newValue; 293 _value = newValue;
293 recordPropertyUpdate("value", newValue, oldValue); 294 recordPropertyUpdate("value", newValue, oldValue);
294 } 295 }
295 } 296 }
296 297
297 T _value; 298 T _value;
298 } 299 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698