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

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: Merge to head. 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 ae704df9a27d9ae2bea76a84c660a95139e785d0..d639caa68b8f246dda0db6a1556541c3d7633484 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -7535,7 +7535,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];
}
@@ -7543,7 +7543,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];
}
@@ -7839,7 +7839,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;
@@ -8107,7 +8109,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;
@@ -8493,7 +8497,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;
@@ -8714,8 +8720,14 @@ 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;
+ if (growable) {
+ output = <Element>[];
+ output.length = _childElements.length;
+ } else {
+ output = new List<Element>(_childElements.length);
+ }
for (int i = 0, len = _childElements.length; i < len; i++) {
output[i] = _childElements[i];
}
@@ -9011,7 +9023,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) {
@@ -11320,7 +11333,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;
@@ -11931,7 +11946,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;
@@ -12166,7 +12183,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;
@@ -12855,7 +12874,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;
@@ -13064,7 +13085,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;
@@ -15395,7 +15418,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;
@@ -15630,7 +15655,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;
@@ -15865,7 +15892,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;
@@ -18653,7 +18682,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;
@@ -19039,7 +19069,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;
@@ -21712,7 +21744,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;
@@ -22030,7 +22064,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;
@@ -23664,7 +23700,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;
@@ -23873,7 +23911,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;
@@ -24289,7 +24329,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;
@@ -24780,7 +24822,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;
@@ -25015,7 +25059,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;
@@ -25250,7 +25296,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;
@@ -25483,7 +25531,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;
@@ -29168,7 +29218,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;
@@ -29369,7 +29421,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;
@@ -29570,7 +29624,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;
@@ -29914,7 +29970,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;
@@ -30115,7 +30173,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;
@@ -30316,7 +30376,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;
@@ -30608,7 +30670,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;
@@ -30833,7 +30897,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;
@@ -31034,7 +31100,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;
@@ -31235,7 +31303,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;
@@ -31867,7 +31937,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);
@@ -34110,7 +34181,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]);
}
@@ -34285,7 +34356,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