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

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

Issue 12328104: Change new List(n) to return fixed length list. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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
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 e8cbf814f7909429bba149ce381609eb7c2757db..9a906c4f3071b54410a51ab992ba80f281546d7a 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -7534,7 +7534,7 @@ class Document extends Node
final mutableMatches = $dom_getElementsByName(
selectors.substring(7,selectors.length - 2));
int len = mutableMatches.length;
- final copyOfMatches = new List<Element>.fixedLength(len);
+ final copyOfMatches = new List<Element>(len);
for (int i = 0; i < len; ++i) {
copyOfMatches[i] = mutableMatches[i];
}
@@ -7542,7 +7542,7 @@ class Document extends Node
} else if (new RegExp("^[*a-zA-Z0-9]+\$").hasMatch(selectors)) {
final mutableMatches = $dom_getElementsByTagName(selectors);
int len = mutableMatches.length;
- final copyOfMatches = new List<Element>.fixedLength(len);
+ final copyOfMatches = new List<Element>(len);
for (int i = 0; i < len; ++i) {
copyOfMatches[i] = mutableMatches[i];
}
@@ -7838,7 +7838,9 @@ class DomMimeTypeArray extends NativeFieldWrapperClass1 implements List<DomMimeT
bool any(bool f(DomMimeType element)) => IterableMixinWorkaround.any(this, f);
- List<DomMimeType> toList() => new List<DomMimeType>.from(this);
+ List<DomMimeType> toList({ bool growable: false }) =>
+ new List<DomMimeType>.from(this, growable: growable);
+
Set<DomMimeType> toSet() => new Set<DomMimeType>.from(this);
bool get isEmpty => this.length == 0;
@@ -8106,7 +8108,9 @@ class DomPluginArray extends NativeFieldWrapperClass1 implements List<DomPlugin>
bool any(bool f(DomPlugin element)) => IterableMixinWorkaround.any(this, f);
- List<DomPlugin> toList() => new List<DomPlugin>.from(this);
+ List<DomPlugin> toList({ bool growable: false }) =>
+ new List<DomPlugin>.from(this, growable: growable);
+
Set<DomPlugin> toSet() => new Set<DomPlugin>.from(this);
bool get isEmpty => this.length == 0;
@@ -8492,7 +8496,9 @@ class DomStringList extends NativeFieldWrapperClass1 implements List<String> {
bool any(bool f(String element)) => IterableMixinWorkaround.any(this, f);
- List<String> toList() => new List<String>.from(this);
+ List<String> toList({ bool growable: false }) =>
+ new List<String>.from(this, growable: growable);
+
Set<String> toSet() => new Set<String>.from(this);
bool get isEmpty => this.length == 0;
@@ -8713,8 +8719,10 @@ class _ChildrenElementList implements List {
: _childElements = element.$dom_children,
_element = element;
- List<Element> toList() {
- final output = new List<Element>.fixedLength(_childElements.length);
+ List<Element> toList({ bool growable: false }) {
+ final output = growable
+ ? (<Element>[]..length = _childElements.length)
+ : new List<Element>(_childElements.length);
for (int i = 0, len = _childElements.length; i < len; i++) {
output[i] = _childElements[i];
}
@@ -9010,7 +9018,8 @@ class _FrozenElementList implements List {
return false;
}
- List<Element> toList() => new List<Element>.from(this);
+ List<Element> toList({ bool growable: false }) =>
+ new List<Element>.from(this, growable: growable);
Set<Element> toSet() => new Set<Element>.from(this);
Iterable<Element> take(int n) {
@@ -11319,7 +11328,9 @@ class FileList extends NativeFieldWrapperClass1 implements List<File> {
bool any(bool f(File element)) => IterableMixinWorkaround.any(this, f);
- List<File> toList() => new List<File>.from(this);
+ List<File> toList({ bool growable: false }) =>
+ new List<File>.from(this, growable: growable);
+
Set<File> toSet() => new Set<File>.from(this);
bool get isEmpty => this.length == 0;
@@ -11930,7 +11941,9 @@ class Float32Array extends ArrayBufferView implements List<num> {
bool any(bool f(num element)) => IterableMixinWorkaround.any(this, f);
- List<num> toList() => new List<num>.from(this);
+ List<num> toList({ bool growable: false }) =>
+ new List<num>.from(this, growable: growable);
+
Set<num> toSet() => new Set<num>.from(this);
bool get isEmpty => this.length == 0;
@@ -12165,7 +12178,9 @@ class Float64Array extends ArrayBufferView implements List<num> {
bool any(bool f(num element)) => IterableMixinWorkaround.any(this, f);
- List<num> toList() => new List<num>.from(this);
+ List<num> toList({ bool growable: false }) =>
+ new List<num>.from(this, growable: growable);
+
Set<num> toSet() => new Set<num>.from(this);
bool get isEmpty => this.length == 0;
@@ -12854,7 +12869,9 @@ class HtmlAllCollection extends NativeFieldWrapperClass1 implements List<Node> {
bool any(bool f(Node element)) => IterableMixinWorkaround.any(this, f);
- List<Node> toList() => new List<Node>.from(this);
+ List<Node> toList({ bool growable: false }) =>
+ new List<Node>.from(this, growable: growable);
+
Set<Node> toSet() => new Set<Node>.from(this);
bool get isEmpty => this.length == 0;
@@ -13063,7 +13080,9 @@ class HtmlCollection extends NativeFieldWrapperClass1 implements List<Node> {
bool any(bool f(Node element)) => IterableMixinWorkaround.any(this, f);
- List<Node> toList() => new List<Node>.from(this);
+ List<Node> toList({ bool growable: false }) =>
+ new List<Node>.from(this, growable: growable);
+
Set<Node> toSet() => new Set<Node>.from(this);
bool get isEmpty => this.length == 0;
@@ -15394,7 +15413,9 @@ class Int16Array extends ArrayBufferView implements List<int> {
bool any(bool f(int element)) => IterableMixinWorkaround.any(this, f);
- List<int> toList() => new List<int>.from(this);
+ List<int> toList({ bool growable: false }) =>
+ new List<int>.from(this, growable: growable);
+
Set<int> toSet() => new Set<int>.from(this);
bool get isEmpty => this.length == 0;
@@ -15629,7 +15650,9 @@ class Int32Array extends ArrayBufferView implements List<int> {
bool any(bool f(int element)) => IterableMixinWorkaround.any(this, f);
- List<int> toList() => new List<int>.from(this);
+ List<int> toList({ bool growable: false }) =>
+ new List<int>.from(this, growable: growable);
+
Set<int> toSet() => new Set<int>.from(this);
bool get isEmpty => this.length == 0;
@@ -15864,7 +15887,9 @@ class Int8Array extends ArrayBufferView implements List<int> {
bool any(bool f(int element)) => IterableMixinWorkaround.any(this, f);
- List<int> toList() => new List<int>.from(this);
+ List<int> toList({ bool growable: false }) =>
+ new List<int>.from(this, growable: growable);
+
Set<int> toSet() => new Set<int>.from(this);
bool get isEmpty => this.length == 0;
@@ -18652,7 +18677,8 @@ class _ChildNodeListLazy implements List {
bool any(bool f(Node element)) => IterableMixinWorkaround.any(this, f);
- List<Node> toList() => new List<Node>.from(this);
+ List<Node> toList({ bool growable: false }) =>
+ new List<Node>.from(this, growable: growable);
Set<Node> toSet() => new Set<Node>.from(this);
bool get isEmpty => this.length == 0;
@@ -19038,7 +19064,9 @@ class NodeList extends NativeFieldWrapperClass1 implements List<Node> {
bool any(bool f(Node element)) => IterableMixinWorkaround.any(this, f);
- List<Node> toList() => new List<Node>.from(this);
+ List<Node> toList({ bool growable: false }) =>
+ new List<Node>.from(this, growable: growable);
+
Set<Node> toSet() => new Set<Node>.from(this);
bool get isEmpty => this.length == 0;
@@ -21711,7 +21739,9 @@ class SourceBufferList extends EventTarget implements List<SourceBuffer> {
bool any(bool f(SourceBuffer element)) => IterableMixinWorkaround.any(this, f);
- List<SourceBuffer> toList() => new List<SourceBuffer>.from(this);
+ List<SourceBuffer> toList({ bool growable: false }) =>
+ new List<SourceBuffer>.from(this, growable: growable);
+
Set<SourceBuffer> toSet() => new Set<SourceBuffer>.from(this);
bool get isEmpty => this.length == 0;
@@ -22029,7 +22059,9 @@ class SpeechGrammarList extends NativeFieldWrapperClass1 implements List<SpeechG
bool any(bool f(SpeechGrammar element)) => IterableMixinWorkaround.any(this, f);
- List<SpeechGrammar> toList() => new List<SpeechGrammar>.from(this);
+ List<SpeechGrammar> toList({ bool growable: false }) =>
+ new List<SpeechGrammar>.from(this, growable: growable);
+
Set<SpeechGrammar> toSet() => new Set<SpeechGrammar>.from(this);
bool get isEmpty => this.length == 0;
@@ -23663,7 +23695,9 @@ class TextTrackCueList extends NativeFieldWrapperClass1 implements List<TextTrac
bool any(bool f(TextTrackCue element)) => IterableMixinWorkaround.any(this, f);
- List<TextTrackCue> toList() => new List<TextTrackCue>.from(this);
+ List<TextTrackCue> toList({ bool growable: false }) =>
+ new List<TextTrackCue>.from(this, growable: growable);
+
Set<TextTrackCue> toSet() => new Set<TextTrackCue>.from(this);
bool get isEmpty => this.length == 0;
@@ -23872,7 +23906,9 @@ class TextTrackList extends EventTarget implements List<TextTrack> {
bool any(bool f(TextTrack element)) => IterableMixinWorkaround.any(this, f);
- List<TextTrack> toList() => new List<TextTrack>.from(this);
+ List<TextTrack> toList({ bool growable: false }) =>
+ new List<TextTrack>.from(this, growable: growable);
+
Set<TextTrack> toSet() => new Set<TextTrack>.from(this);
bool get isEmpty => this.length == 0;
@@ -24288,7 +24324,9 @@ class TouchList extends NativeFieldWrapperClass1 implements List<Touch> {
bool any(bool f(Touch element)) => IterableMixinWorkaround.any(this, f);
- List<Touch> toList() => new List<Touch>.from(this);
+ List<Touch> toList({ bool growable: false }) =>
+ new List<Touch>.from(this, growable: growable);
+
Set<Touch> toSet() => new Set<Touch>.from(this);
bool get isEmpty => this.length == 0;
@@ -24779,7 +24817,9 @@ class Uint16Array extends ArrayBufferView implements List<int> {
bool any(bool f(int element)) => IterableMixinWorkaround.any(this, f);
- List<int> toList() => new List<int>.from(this);
+ List<int> toList({ bool growable: false }) =>
+ new List<int>.from(this, growable: growable);
+
Set<int> toSet() => new Set<int>.from(this);
bool get isEmpty => this.length == 0;
@@ -25014,7 +25054,9 @@ class Uint32Array extends ArrayBufferView implements List<int> {
bool any(bool f(int element)) => IterableMixinWorkaround.any(this, f);
- List<int> toList() => new List<int>.from(this);
+ List<int> toList({ bool growable: false }) =>
+ new List<int>.from(this, growable: growable);
+
Set<int> toSet() => new Set<int>.from(this);
bool get isEmpty => this.length == 0;
@@ -25249,7 +25291,9 @@ class Uint8Array extends ArrayBufferView implements List<int> {
bool any(bool f(int element)) => IterableMixinWorkaround.any(this, f);
- List<int> toList() => new List<int>.from(this);
+ List<int> toList({ bool growable: false }) =>
+ new List<int>.from(this, growable: growable);
+
Set<int> toSet() => new Set<int>.from(this);
bool get isEmpty => this.length == 0;
@@ -25482,7 +25526,9 @@ class Uint8ClampedArray extends Uint8Array implements List<int> {
bool any(bool f(int element)) => IterableMixinWorkaround.any(this, f);
- List<int> toList() => new List<int>.from(this);
+ List<int> toList({ bool growable: false }) =>
+ new List<int>.from(this, growable: growable);
+
Set<int> toSet() => new Set<int>.from(this);
bool get isEmpty => this.length == 0;
@@ -29164,7 +29210,9 @@ class _ClientRectList extends NativeFieldWrapperClass1 implements List<ClientRec
bool any(bool f(ClientRect element)) => IterableMixinWorkaround.any(this, f);
- List<ClientRect> toList() => new List<ClientRect>.from(this);
+ List<ClientRect> toList({ bool growable: false }) =>
+ new List<ClientRect>.from(this, growable: growable);
+
Set<ClientRect> toSet() => new Set<ClientRect>.from(this);
bool get isEmpty => this.length == 0;
@@ -29365,7 +29413,9 @@ class _CssRuleList extends NativeFieldWrapperClass1 implements List<CssRule> {
bool any(bool f(CssRule element)) => IterableMixinWorkaround.any(this, f);
- List<CssRule> toList() => new List<CssRule>.from(this);
+ List<CssRule> toList({ bool growable: false }) =>
+ new List<CssRule>.from(this, growable: growable);
+
Set<CssRule> toSet() => new Set<CssRule>.from(this);
bool get isEmpty => this.length == 0;
@@ -29566,7 +29616,9 @@ class _CssValueList extends CssValue implements List<CssValue> {
bool any(bool f(CssValue element)) => IterableMixinWorkaround.any(this, f);
- List<CssValue> toList() => new List<CssValue>.from(this);
+ List<CssValue> toList({ bool growable: false }) =>
+ new List<CssValue>.from(this, growable: growable);
+
Set<CssValue> toSet() => new Set<CssValue>.from(this);
bool get isEmpty => this.length == 0;
@@ -29910,7 +29962,9 @@ class _EntryArray extends NativeFieldWrapperClass1 implements List<Entry> {
bool any(bool f(Entry element)) => IterableMixinWorkaround.any(this, f);
- List<Entry> toList() => new List<Entry>.from(this);
+ List<Entry> toList({ bool growable: false }) =>
+ new List<Entry>.from(this, growable: growable);
+
Set<Entry> toSet() => new Set<Entry>.from(this);
bool get isEmpty => this.length == 0;
@@ -30111,7 +30165,9 @@ class _EntryArraySync extends NativeFieldWrapperClass1 implements List<EntrySync
bool any(bool f(EntrySync element)) => IterableMixinWorkaround.any(this, f);
- List<EntrySync> toList() => new List<EntrySync>.from(this);
+ List<EntrySync> toList({ bool growable: false }) =>
+ new List<EntrySync>.from(this, growable: growable);
+
Set<EntrySync> toSet() => new Set<EntrySync>.from(this);
bool get isEmpty => this.length == 0;
@@ -30312,7 +30368,9 @@ class _GamepadList extends NativeFieldWrapperClass1 implements List<Gamepad> {
bool any(bool f(Gamepad element)) => IterableMixinWorkaround.any(this, f);
- List<Gamepad> toList() => new List<Gamepad>.from(this);
+ List<Gamepad> toList({ bool growable: false }) =>
+ new List<Gamepad>.from(this, growable: growable);
+
Set<Gamepad> toSet() => new Set<Gamepad>.from(this);
bool get isEmpty => this.length == 0;
@@ -30604,7 +30662,9 @@ class _NamedNodeMap extends NativeFieldWrapperClass1 implements List<Node> {
bool any(bool f(Node element)) => IterableMixinWorkaround.any(this, f);
- List<Node> toList() => new List<Node>.from(this);
+ List<Node> toList({ bool growable: false }) =>
+ new List<Node>.from(this, growable: growable);
+
Set<Node> toSet() => new Set<Node>.from(this);
bool get isEmpty => this.length == 0;
@@ -30829,7 +30889,9 @@ class _SpeechInputResultList extends NativeFieldWrapperClass1 implements List<Sp
bool any(bool f(SpeechInputResult element)) => IterableMixinWorkaround.any(this, f);
- List<SpeechInputResult> toList() => new List<SpeechInputResult>.from(this);
+ List<SpeechInputResult> toList({ bool growable: false }) =>
+ new List<SpeechInputResult>.from(this, growable: growable);
+
Set<SpeechInputResult> toSet() => new Set<SpeechInputResult>.from(this);
bool get isEmpty => this.length == 0;
@@ -31030,7 +31092,9 @@ class _SpeechRecognitionResultList extends NativeFieldWrapperClass1 implements L
bool any(bool f(SpeechRecognitionResult element)) => IterableMixinWorkaround.any(this, f);
- List<SpeechRecognitionResult> toList() => new List<SpeechRecognitionResult>.from(this);
+ List<SpeechRecognitionResult> toList({ bool growable: false }) =>
+ new List<SpeechRecognitionResult>.from(this, growable: growable);
+
Set<SpeechRecognitionResult> toSet() => new Set<SpeechRecognitionResult>.from(this);
bool get isEmpty => this.length == 0;
@@ -31231,7 +31295,9 @@ class _StyleSheetList extends NativeFieldWrapperClass1 implements List<StyleShee
bool any(bool f(StyleSheet element)) => IterableMixinWorkaround.any(this, f);
- List<StyleSheet> toList() => new List<StyleSheet>.from(this);
+ List<StyleSheet> toList({ bool growable: false }) =>
+ new List<StyleSheet>.from(this, growable: growable);
+
Set<StyleSheet> toSet() => new Set<StyleSheet>.from(this);
bool get isEmpty => this.length == 0;
@@ -31863,7 +31929,8 @@ abstract class CssClassSet implements Set<String> {
String get first => readClasses().first;
String get last => readClasses().last;
String get single => readClasses().single;
- List<String> toList() => readClasses().toList();
+ List<String> toList({ bool growable: false }) =>
+ readClasses().toList(growable: growable);
Set<String> toSet() => readClasses().toSet();
String min([int compare(String a, String b)]) =>
readClasses().min(compare);
@@ -34106,7 +34173,7 @@ abstract class _Serializer extends _MessageTraverser {
_serializeList(List list) {
int len = list.length;
- var result = new List.fixedLength(len);
+ var result = new List(len);
for (int i = 0; i < len; i++) {
result[i] = _dispatch(list[i]);
}
@@ -34281,7 +34348,7 @@ class _Utils {
static List convertToList(List list) {
// FIXME: [possible optimization]: do not copy the array if Dart_IsArray is fine w/ it.
final length = list.length;
- List result = new List.fixedLength(length);
+ List result = new List(length);
result.setRange(0, length, list);
return result;
}

Powered by Google App Engine
This is Rietveld 408576698