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

Unified Diff: client/html/release/htmlimpl.dart

Side-by-side diff isn't available for this file because of its large size.
Issue 9283003: Don't use _toList on FrozenElementList. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 11 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:
Download patch
« no previous file with comments | « no previous file | client/html/src/ElementWrappingImplementation.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/html/release/htmlimpl.dart
diff --git a/client/html/release/htmlimpl.dart b/client/html/release/htmlimpl.dart
index e631aec33dc42be33362c861aa088477707c3a88..c703c50e8a9ed2d05346d3731bce83b1757fb212 100644
--- a/client/html/release/htmlimpl.dart
+++ b/client/html/release/htmlimpl.dart
@@ -22467,29 +22467,34 @@ class _ChildrenElementList implements ElementList {
class FrozenElementList implements ElementList {
final _ptr;
- List<Element> _list;
FrozenElementList._wrap(this._ptr);
- List<Element> _toList() {
- if (_list == null) {
- _list = new List(_ptr.length);
- for (int i = 0, len = _ptr.length; i < len; i++) {
- _list[i] = LevelDom.wrapElement(_ptr[i]);
- }
- }
- return _list;
- }
-
Element get first() {
return this[0];
}
- void forEach(void f(Element element)) => _toList().forEach(f);
+ void forEach(void f(Element element)) {
+ for (Element el in this) {
+ f(el);
+ }
+ }
- Collection map(f(Element element)) => _toList().map(f);
+ Collection map(f(Element element)) {
+ var out = [];
Jacob 2012/01/26 01:56:27 var --> final here and elsewhere in this file
nweiz 2012/01/26 23:18:09 Done.
+ for (Element el in this) {
+ out.add(f(el));
+ }
+ return out;
+ }
- Collection<Element> filter(bool f(Element element)) => _toList().filter(f);
+ Collection<Element> filter(bool f(Element element)) {
+ var out = [];
Jacob 2012/01/26 01:56:27 [] --> <Element>[]
nweiz 2012/01/26 23:18:09 This became an ElementList later on anyway.
+ for (Element el in this) {
+ if (f(el)) out.add(el);
+ }
+ return out;
+ }
bool every(bool f(Element element)) {
for(Element element in this) {
« no previous file with comments | « no previous file | client/html/src/ElementWrappingImplementation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698