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

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

Issue 26967004: add @MirrorsUsed to observe/polymer/polymer_exprs pkgs (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix typo in comment Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
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 part of observe; 5 part of observe;
6 6
7 // Inspired by ArrayReduction at: 7 // Inspired by ArrayReduction at:
8 // https://raw.github.com/rafaelw/ChangeSummary/master/util/array_reduction.js 8 // https://raw.github.com/rafaelw/ChangeSummary/master/util/array_reduction.js
9 // The main difference is we support anything on the rich Dart Iterable API. 9 // The main difference is we support anything on the rich Dart Iterable API.
10 10
(...skipping 18 matching lines...) Expand all
29 _observeItems(record.addedCount - record.removedCount); 29 _observeItems(record.addedCount - record.removedCount);
30 } 30 }
31 } 31 }
32 _scheduleReduce(null); 32 _scheduleReduce(null);
33 }); 33 });
34 34
35 _observeItems(list.length); 35 _observeItems(list.length);
36 _reduce(); 36 _reduce();
37 } 37 }
38 38
39 Iterable<P> get value => _value; 39 @reflectable Iterable<P> get value => _value;
40 40
41 void dispose() { 41 void dispose() {
42 if (_sub != null) _sub.cancel(); 42 if (_sub != null) _sub.cancel();
43 _subs.forEach((s) => s.cancel()); 43 _subs.forEach((s) => s.cancel());
44 _subs.clear(); 44 _subs.clear();
45 } 45 }
46 46
47 void _reduce() { 47 void _reduce() {
48 _scheduled = false; 48 _scheduled = false;
49 _value = _observers.map((o) => o.value); 49 _value = _observers.map((o) => o.value);
(...skipping 16 matching lines...) Expand all
66 } 66 }
67 } else if (lengthAdjust < 0) { 67 } else if (lengthAdjust < 0) {
68 for (int i = 0; i < -lengthAdjust; i++) { 68 for (int i = 0; i < -lengthAdjust; i++) {
69 _subs.removeLast().cancel(); 69 _subs.removeLast().cancel();
70 } 70 }
71 int len = _observers.length; 71 int len = _observers.length;
72 _observers.removeRange(len + lengthAdjust, len); 72 _observers.removeRange(len + lengthAdjust, len);
73 } 73 }
74 } 74 }
75 } 75 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698