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

Unified Diff: sdk/lib/html/dartium/html_dartium.dart

Side-by-side diff isn't available for this file because of its large size.
Issue 11412086: Make 'where' lazy. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: FilteredIterable/Iterator -> WhereIterable/Iterator. Created 8 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:
Download patch
Index: sdk/lib/html/dartium/html_dartium.dart
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index 30234756445131eafecd7ff789c9e44c39eaf643..fef60014b75132578641a2e3d70c8a2e8c8af121 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -6966,8 +6966,7 @@ class DOMMimeTypeArray extends NativeFieldWrapperClass1 implements List<DOMMimeT
Iterable mappedBy(f(DOMMimeType element)) => new MappedIterable(this, f);
- Collection<DOMMimeType> where(bool f(DOMMimeType element)) =>
- _Collections.where(this, <DOMMimeType>[], f);
+ Iterable<DOMMimeType> where(bool f(DOMMimeType element)) => new FilteredIterable<DOMMimeType>(this, f);
bool every(bool f(DOMMimeType element)) => _Collections.every(this, f);
@@ -7127,8 +7126,7 @@ class DOMPluginArray extends NativeFieldWrapperClass1 implements List<DOMPlugin>
Iterable mappedBy(f(DOMPlugin element)) => new MappedIterable(this, f);
- Collection<DOMPlugin> where(bool f(DOMPlugin element)) =>
- _Collections.where(this, <DOMPlugin>[], f);
+ Iterable<DOMPlugin> where(bool f(DOMPlugin element)) => new FilteredIterable<DOMPlugin>(this, f);
bool every(bool f(DOMPlugin element)) => _Collections.every(this, f);
@@ -8775,15 +8773,8 @@ class _ChildrenElementList implements List {
}
}
- List<Element> where(bool f(Element element)) {
- final output = [];
- forEach((Element element) {
- if (f(element)) {
- output.add(element);
- }
- });
- return new _FrozenElementList._wrap(output);
- }
+ Iterable<Element> where(bool f(Element element))
+ => new FilteredIterable<Element>(this, f);
bool every(bool f(Element element)) {
for (Element element in this) {
@@ -8916,13 +8907,8 @@ class _FrozenElementList implements List {
Iterable mappedBy(f(Element element)) => new MappedIterable(this, f);
- List<Element> where(bool f(Element element)) {
- final out = [];
- for (Element el in this) {
- if (f(el)) out.add(el);
- }
- return out;
- }
+ Iterable<Element> where(bool f(Element element))
+ => new FilteredIterable<Element>(this, f);
bool every(bool f(Element element)) {
for(Element element in this) {
@@ -10967,8 +10953,7 @@ class Float32Array extends ArrayBufferView implements List<num> {
Iterable mappedBy(f(num element)) => new MappedIterable(this, f);
- Collection<num> where(bool f(num element)) =>
- _Collections.where(this, <num>[], f);
+ Iterable<num> where(bool f(num element)) => new FilteredIterable<num>(this, f);
bool every(bool f(num element)) => _Collections.every(this, f);
@@ -11098,8 +11083,7 @@ class Float64Array extends ArrayBufferView implements List<num> {
Iterable mappedBy(f(num element)) => new MappedIterable(this, f);
- Collection<num> where(bool f(num element)) =>
- _Collections.where(this, <num>[], f);
+ Iterable<num> where(bool f(num element)) => new FilteredIterable<num>(this, f);
bool every(bool f(num element)) => _Collections.every(this, f);
@@ -11675,8 +11659,7 @@ class HTMLAllCollection extends NativeFieldWrapperClass1 implements List<Node> {
Iterable mappedBy(f(Node element)) => new MappedIterable(this, f);
- Collection<Node> where(bool f(Node element)) =>
- _Collections.where(this, <Node>[], f);
+ Iterable<Node> where(bool f(Node element)) => new FilteredIterable<Node>(this, f);
bool every(bool f(Node element)) => _Collections.every(this, f);
@@ -11786,8 +11769,7 @@ class HTMLCollection extends NativeFieldWrapperClass1 implements List<Node> {
Iterable mappedBy(f(Node element)) => new MappedIterable(this, f);
- Collection<Node> where(bool f(Node element)) =>
- _Collections.where(this, <Node>[], f);
+ Iterable<Node> where(bool f(Node element)) => new FilteredIterable<Node>(this, f);
bool every(bool f(Node element)) => _Collections.every(this, f);
@@ -14029,8 +14011,7 @@ class Int16Array extends ArrayBufferView implements List<int> {
Iterable mappedBy(f(int element)) => new MappedIterable(this, f);
- Collection<int> where(bool f(int element)) =>
- _Collections.where(this, <int>[], f);
+ Iterable<int> where(bool f(int element)) => new FilteredIterable<int>(this, f);
bool every(bool f(int element)) => _Collections.every(this, f);
@@ -14160,8 +14141,7 @@ class Int32Array extends ArrayBufferView implements List<int> {
Iterable mappedBy(f(int element)) => new MappedIterable(this, f);
- Collection<int> where(bool f(int element)) =>
- _Collections.where(this, <int>[], f);
+ Iterable<int> where(bool f(int element)) => new FilteredIterable<int>(this, f);
bool every(bool f(int element)) => _Collections.every(this, f);
@@ -14291,8 +14271,7 @@ class Int8Array extends ArrayBufferView implements List<int> {
Iterable mappedBy(f(int element)) => new MappedIterable(this, f);
- Collection<int> where(bool f(int element)) =>
- _Collections.where(this, <int>[], f);
+ Iterable<int> where(bool f(int element)) => new FilteredIterable<int>(this, f);
bool every(bool f(int element)) => _Collections.every(this, f);
@@ -17190,8 +17169,7 @@ class NamedNodeMap extends NativeFieldWrapperClass1 implements List<Node> {
Iterable mappedBy(f(Node element)) => new MappedIterable(this, f);
- Collection<Node> where(bool f(Node element)) =>
- _Collections.where(this, <Node>[], f);
+ Iterable<Node> where(bool f(Node element)) => new FilteredIterable<Node>(this, f);
bool every(bool f(Node element)) => _Collections.every(this, f);
@@ -17451,8 +17429,8 @@ class _ChildNodeListLazy implements List {
Iterable mappedBy(f(Node element)) => new MappedIterable(this, f);
- Collection<Node> where(bool f(Node element)) =>
- new _NodeListWrapper(_Collections.where(this, <Node>[], f));
+ Iterable<Node> where(bool f(Node element)) =>
+ new FilteredIterable<Node>(this, f);
bool every(bool f(Node element)) => _Collections.every(this, f);
@@ -17780,7 +17758,7 @@ class _ListWrapper<E> implements List<E> {
Iterable mappedBy(f(E element)) => new MappedIterable(this, f);
- List<E> where(bool f(E element)) => _list.where(f);
+ Iterable<E> where(bool f(E element)) => _list.where(f);
bool every(bool f(E element)) => _list.every(f);
@@ -17837,8 +17815,7 @@ class _ListWrapper<E> implements List<E> {
class _NodeListWrapper extends _ListWrapper<Node> implements List {
_NodeListWrapper(List list) : super(list);
- List<Node> where(bool f(Node element)) =>
- new _NodeListWrapper(_list.where(f));
+ Iterable<Node> where(bool f(Node element)) => new FilteredIterable(this, f);
List<Node> getRange(int start, int rangeLength) =>
new _NodeListWrapper(_list.getRange(start, rangeLength));
@@ -17897,8 +17874,7 @@ class NodeList extends NativeFieldWrapperClass1 implements List<Node> {
Iterable mappedBy(f(Node element)) => new MappedIterable(this, f);
- Collection<Node> where(bool f(Node element)) =>
- new _NodeListWrapper(_Collections.where(this, <Node>[], f));
+ Iterable<Node> where(bool f(Node element)) => new FilteredIterable(this, f);
bool every(bool f(Node element)) => _Collections.every(this, f);
@@ -20205,8 +20181,7 @@ class SQLResultSetRowList extends NativeFieldWrapperClass1 implements List<Map>
Iterable mappedBy(f(Map element)) => new MappedIterable(this, f);
- Collection<Map> where(bool f(Map element)) =>
- _Collections.where(this, <Map>[], f);
+ Iterable<Map> where(bool f(Map element)) => new FilteredIterable<Map>(this, f);
bool every(bool f(Map element)) => _Collections.every(this, f);
@@ -20923,8 +20898,7 @@ class SourceBufferList extends EventTarget implements List<SourceBuffer> {
Iterable mappedBy(f(SourceBuffer element)) => new MappedIterable(this, f);
- Collection<SourceBuffer> where(bool f(SourceBuffer element)) =>
- _Collections.where(this, <SourceBuffer>[], f);
+ Iterable<SourceBuffer> where(bool f(SourceBuffer element)) => new FilteredIterable<SourceBuffer>(this, f);
bool every(bool f(SourceBuffer element)) => _Collections.every(this, f);
@@ -21122,8 +21096,7 @@ class SpeechGrammarList extends NativeFieldWrapperClass1 implements List<SpeechG
Iterable mappedBy(f(SpeechGrammar element)) => new MappedIterable(this, f);
- Collection<SpeechGrammar> where(bool f(SpeechGrammar element)) =>
- _Collections.where(this, <SpeechGrammar>[], f);
+ Iterable<SpeechGrammar> where(bool f(SpeechGrammar element)) => new FilteredIterable<SpeechGrammar>(this, f);
bool every(bool f(SpeechGrammar element)) => _Collections.every(this, f);
@@ -22783,8 +22756,7 @@ class TextTrackCueList extends NativeFieldWrapperClass1 implements List<TextTrac
Iterable mappedBy(f(TextTrackCue element)) => new MappedIterable(this, f);
- Collection<TextTrackCue> where(bool f(TextTrackCue element)) =>
- _Collections.where(this, <TextTrackCue>[], f);
+ Iterable<TextTrackCue> where(bool f(TextTrackCue element)) => new FilteredIterable<TextTrackCue>(this, f);
bool every(bool f(TextTrackCue element)) => _Collections.every(this, f);
@@ -22896,8 +22868,7 @@ class TextTrackList extends EventTarget implements List<TextTrack> {
Iterable mappedBy(f(TextTrack element)) => new MappedIterable(this, f);
- Collection<TextTrack> where(bool f(TextTrack element)) =>
- _Collections.where(this, <TextTrack>[], f);
+ Iterable<TextTrack> where(bool f(TextTrack element)) => new FilteredIterable<TextTrack>(this, f);
bool every(bool f(TextTrack element)) => _Collections.every(this, f);
@@ -23167,8 +23138,7 @@ class TouchList extends NativeFieldWrapperClass1 implements List<Touch> {
Iterable mappedBy(f(Touch element)) => new MappedIterable(this, f);
- Collection<Touch> where(bool f(Touch element)) =>
- _Collections.where(this, <Touch>[], f);
+ Iterable<Touch> where(bool f(Touch element)) => new FilteredIterable<Touch>(this, f);
bool every(bool f(Touch element)) => _Collections.every(this, f);
@@ -23535,8 +23505,7 @@ class Uint16Array extends ArrayBufferView implements List<int> {
Iterable mappedBy(f(int element)) => new MappedIterable(this, f);
- Collection<int> where(bool f(int element)) =>
- _Collections.where(this, <int>[], f);
+ Iterable<int> where(bool f(int element)) => new FilteredIterable<int>(this, f);
bool every(bool f(int element)) => _Collections.every(this, f);
@@ -23666,8 +23635,7 @@ class Uint32Array extends ArrayBufferView implements List<int> {
Iterable mappedBy(f(int element)) => new MappedIterable(this, f);
- Collection<int> where(bool f(int element)) =>
- _Collections.where(this, <int>[], f);
+ Iterable<int> where(bool f(int element)) => new FilteredIterable<int>(this, f);
bool every(bool f(int element)) => _Collections.every(this, f);
@@ -23797,8 +23765,7 @@ class Uint8Array extends ArrayBufferView implements List<int> {
Iterable mappedBy(f(int element)) => new MappedIterable(this, f);
- Collection<int> where(bool f(int element)) =>
- _Collections.where(this, <int>[], f);
+ Iterable<int> where(bool f(int element)) => new FilteredIterable<int>(this, f);
bool every(bool f(int element)) => _Collections.every(this, f);
@@ -26481,8 +26448,7 @@ class _CSSRuleList extends NativeFieldWrapperClass1 implements List<CSSRule> {
Iterable mappedBy(f(CSSRule element)) => new MappedIterable(this, f);
- Collection<CSSRule> where(bool f(CSSRule element)) =>
- _Collections.where(this, <CSSRule>[], f);
+ Iterable<CSSRule> where(bool f(CSSRule element)) => new FilteredIterable<CSSRule>(this, f);
bool every(bool f(CSSRule element)) => _Collections.every(this, f);
@@ -26584,8 +26550,7 @@ class _CSSValueList extends CSSValue implements List<CSSValue> {
Iterable mappedBy(f(CSSValue element)) => new MappedIterable(this, f);
- Collection<CSSValue> where(bool f(CSSValue element)) =>
- _Collections.where(this, <CSSValue>[], f);
+ Iterable<CSSValue> where(bool f(CSSValue element)) => new FilteredIterable<CSSValue>(this, f);
bool every(bool f(CSSValue element)) => _Collections.every(this, f);
@@ -26687,8 +26652,7 @@ class _ClientRectList extends NativeFieldWrapperClass1 implements List<ClientRec
Iterable mappedBy(f(ClientRect element)) => new MappedIterable(this, f);
- Collection<ClientRect> where(bool f(ClientRect element)) =>
- _Collections.where(this, <ClientRect>[], f);
+ Iterable<ClientRect> where(bool f(ClientRect element)) => new FilteredIterable<ClientRect>(this, f);
bool every(bool f(ClientRect element)) => _Collections.every(this, f);
@@ -26798,8 +26762,7 @@ class _DOMStringList extends NativeFieldWrapperClass1 implements List<String> {
Iterable mappedBy(f(String element)) => new MappedIterable(this, f);
- Collection<String> where(bool f(String element)) =>
- _Collections.where(this, <String>[], f);
+ Iterable<String> where(bool f(String element)) => new FilteredIterable<String>(this, f);
bool every(bool f(String element)) => _Collections.every(this, f);
@@ -27370,8 +27333,7 @@ class _EntryArray extends NativeFieldWrapperClass1 implements List<Entry> {
Iterable mappedBy(f(Entry element)) => new MappedIterable(this, f);
- Collection<Entry> where(bool f(Entry element)) =>
- _Collections.where(this, <Entry>[], f);
+ Iterable<Entry> where(bool f(Entry element)) => new FilteredIterable<Entry>(this, f);
bool every(bool f(Entry element)) => _Collections.every(this, f);
@@ -27473,8 +27435,7 @@ class _EntryArraySync extends NativeFieldWrapperClass1 implements List<EntrySync
Iterable mappedBy(f(EntrySync element)) => new MappedIterable(this, f);
- Collection<EntrySync> where(bool f(EntrySync element)) =>
- _Collections.where(this, <EntrySync>[], f);
+ Iterable<EntrySync> where(bool f(EntrySync element)) => new FilteredIterable<EntrySync>(this, f);
bool every(bool f(EntrySync element)) => _Collections.every(this, f);
@@ -27584,8 +27545,7 @@ class _FileList extends NativeFieldWrapperClass1 implements List<File> {
Iterable mappedBy(f(File element)) => new MappedIterable(this, f);
- Collection<File> where(bool f(File element)) =>
- _Collections.where(this, <File>[], f);
+ Iterable<File> where(bool f(File element)) => new FilteredIterable<File>(this, f);
bool every(bool f(File element)) => _Collections.every(this, f);
@@ -27711,8 +27671,7 @@ class _GamepadList extends NativeFieldWrapperClass1 implements List<Gamepad> {
Iterable mappedBy(f(Gamepad element)) => new MappedIterable(this, f);
- Collection<Gamepad> where(bool f(Gamepad element)) =>
- _Collections.where(this, <Gamepad>[], f);
+ Iterable<Gamepad> where(bool f(Gamepad element)) => new FilteredIterable<Gamepad>(this, f);
bool every(bool f(Gamepad element)) => _Collections.every(this, f);
@@ -27863,8 +27822,7 @@ class _MediaStreamList extends NativeFieldWrapperClass1 implements List<MediaStr
Iterable mappedBy(f(MediaStream element)) => new MappedIterable(this, f);
- Collection<MediaStream> where(bool f(MediaStream element)) =>
- _Collections.where(this, <MediaStream>[], f);
+ Iterable<MediaStream> where(bool f(MediaStream element)) => new FilteredIterable<MediaStream>(this, f);
bool every(bool f(MediaStream element)) => _Collections.every(this, f);
@@ -28070,8 +28028,7 @@ class _SpeechInputResultList extends NativeFieldWrapperClass1 implements List<Sp
Iterable mappedBy(f(SpeechInputResult element)) => new MappedIterable(this, f);
- Collection<SpeechInputResult> where(bool f(SpeechInputResult element)) =>
- _Collections.where(this, <SpeechInputResult>[], f);
+ Iterable<SpeechInputResult> where(bool f(SpeechInputResult element)) => new FilteredIterable<SpeechInputResult>(this, f);
bool every(bool f(SpeechInputResult element)) => _Collections.every(this, f);
@@ -28181,8 +28138,7 @@ class _SpeechRecognitionResultList extends NativeFieldWrapperClass1 implements L
Iterable mappedBy(f(SpeechRecognitionResult element)) => new MappedIterable(this, f);
- Collection<SpeechRecognitionResult> where(bool f(SpeechRecognitionResult element)) =>
- _Collections.where(this, <SpeechRecognitionResult>[], f);
+ Iterable<SpeechRecognitionResult> where(bool f(SpeechRecognitionResult element)) => new FilteredIterable<SpeechRecognitionResult>(this, f);
bool every(bool f(SpeechRecognitionResult element)) => _Collections.every(this, f);
@@ -28284,8 +28240,7 @@ class _StyleSheetList extends NativeFieldWrapperClass1 implements List<StyleShee
Iterable mappedBy(f(StyleSheet element)) => new MappedIterable(this, f);
- Collection<StyleSheet> where(bool f(StyleSheet element)) =>
- _Collections.where(this, <StyleSheet>[], f);
+ Iterable<StyleSheet> where(bool f(StyleSheet element)) => new FilteredIterable<StyleSheet>(this, f);
bool every(bool f(StyleSheet element)) => _Collections.every(this, f);
@@ -28395,8 +28350,7 @@ class _WebKitAnimationList extends NativeFieldWrapperClass1 implements List<Anim
Iterable mappedBy(f(Animation element)) => new MappedIterable(this, f);
- Collection<Animation> where(bool f(Animation element)) =>
- _Collections.where(this, <Animation>[], f);
+ Iterable<Animation> where(bool f(Animation element)) => new FilteredIterable<Animation>(this, f);
bool every(bool f(Animation element)) => _Collections.every(this, f);
@@ -28553,7 +28507,7 @@ abstract class CssClassSet implements Set<String> {
Iterable mappedBy(f(String element)) => readClasses().mappedBy(f);
- Collection<String> where(bool f(String element)) => readClasses().where(f);
+ Iterable<String> where(bool f(String element)) => readClasses().where(f);
bool every(bool f(String element)) => readClasses().every(f);
@@ -28721,7 +28675,7 @@ class FilteredElementList implements List {
}
Iterable mappedBy(f(Element element)) => _filtered.mappedBy(f);
- Collection<Element> where(bool f(Element element)) => _filtered.where(f);
+ Iterable<Element> where(bool f(Element element)) => _filtered.where(f);
bool every(bool f(Element element)) => _filtered.every(f);
bool some(bool f(Element element)) => _filtered.some(f);
bool get isEmpty => _filtered.isEmpty;
@@ -29555,10 +29509,6 @@ class _Collections {
}
}
- static Iterable mappedBy(Iterable<Object> source, f(o)) {
- return new MappedIterable(source, f);
- }
-
static bool some(Iterable<Object> iterable, bool f(Object o)) {
for (final e in iterable) {
if (f(e)) return true;
@@ -29573,15 +29523,6 @@ class _Collections {
return true;
}
- static List where(Iterable<Object> source,
- List<Object> destination,
- bool f(o)) {
- for (final e in source) {
- if (f(e)) destination.add(e);
- }
- return destination;
- }
-
static bool isEmpty(Iterable<Object> iterable) {
return !iterable.iterator.moveNext();
}

Powered by Google App Engine
This is Rietveld 408576698