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

Side by Side Diff: sdk/lib/web_sql/dartium/web_sql_dartium.dart

Issue 14619013: Explicitly implementing some DOM iterable APIs for performance (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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
« no previous file with comments | « sdk/lib/web_sql/dart2js/web_sql_dart2js.dart ('k') | tests/html/node_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /** 1 /**
2 * An API for storing data in the browser that can be queried with SQL. 2 * An API for storing data in the browser that can be queried with SQL.
3 * 3 *
4 * **Caution:** this specification is no longer actively maintained by the Web 4 * **Caution:** this specification is no longer actively maintained by the Web
5 * Applications Working Group and may be removed at any time. 5 * Applications Working Group and may be removed at any time.
6 * See [the W3C Web SQL Database specification](http://www.w3.org/TR/webdatabase /) 6 * See [the W3C Web SQL Database specification](http://www.w3.org/TR/webdatabase /)
7 * for more information. 7 * for more information.
8 * 8 *
9 * The [dart:indexed_db] APIs is a recommended alternatives. 9 * The [dart:indexed_db] APIs is a recommended alternatives.
10 */ 10 */
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 210
211 @DocsEditable 211 @DocsEditable
212 @DomName('SQLResultSetRowList') 212 @DomName('SQLResultSetRowList')
213 class SqlResultSetRowList extends NativeFieldWrapperClass1 with ListMixin<Map>, ImmutableListMixin<Map> implements List<Map> { 213 class SqlResultSetRowList extends NativeFieldWrapperClass1 with ListMixin<Map>, ImmutableListMixin<Map> implements List<Map> {
214 SqlResultSetRowList.internal(); 214 SqlResultSetRowList.internal();
215 215
216 @DomName('SQLResultSetRowList.length') 216 @DomName('SQLResultSetRowList.length')
217 @DocsEditable 217 @DocsEditable
218 int get length native "SQLResultSetRowList_length_Getter"; 218 int get length native "SQLResultSetRowList_length_Getter";
219 219
220 Map operator[](int index) native "SQLResultSetRowList_item_Callback"; 220 Map operator[](int index) {
221 if (index < 0 || index >= length)
222 throw new RangeError.range(index, 0, length);
223 return _nativeIndexedGetter(index);
224 }
225 Map _nativeIndexedGetter(int index) native "SQLResultSetRowList_item_Callback" ;
221 226
222 void operator[]=(int index, Map value) { 227 void operator[]=(int index, Map value) {
223 throw new UnsupportedError("Cannot assign element of immutable List."); 228 throw new UnsupportedError("Cannot assign element of immutable List.");
224 } 229 }
225 // -- start List<Map> mixins. 230 // -- start List<Map> mixins.
226 // Map is the element type. 231 // Map is the element type.
227 232
228 233
229 void set length(int value) { 234 void set length(int value) {
230 throw new UnsupportedError("Cannot resize immutable List."); 235 throw new UnsupportedError("Cannot resize immutable List.");
231 } 236 }
232 237
238 Map get first {
239 if (this.length > 0) {
240 return this[0];
241 }
242 throw new StateError("No elements");
243 }
244
245 Map get last {
246 int len = this.length;
247 if (len > 0) {
248 return this[len - 1];
249 }
250 throw new StateError("No elements");
251 }
252
253 Map get single {
254 int len = this.length;
255 if (len == 1) {
256 return this[0];
257 }
258 if (len == 0) throw new StateError("No elements");
259 throw new StateError("More than one element");
260 }
261
262 Map elementAt(int index) => this[index];
233 // -- end List<Map> mixins. 263 // -- end List<Map> mixins.
234 264
235 @DomName('SQLResultSetRowList.item') 265 @DomName('SQLResultSetRowList.item')
236 @DocsEditable 266 @DocsEditable
237 Map item(int index) native "SQLResultSetRowList_item_Callback"; 267 Map item(int index) native "SQLResultSetRowList_item_Callback";
238 268
239 } 269 }
240 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 270 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
241 // for details. All rights reserved. Use of this source code is governed by a 271 // for details. All rights reserved. Use of this source code is governed by a
242 // BSD-style license that can be found in the LICENSE file. 272 // BSD-style license that can be found in the LICENSE file.
(...skipping 23 matching lines...) Expand all
266 296
267 @DocsEditable 297 @DocsEditable
268 @DomName('SQLTransactionSync') 298 @DomName('SQLTransactionSync')
269 @SupportedBrowser(SupportedBrowser.CHROME) 299 @SupportedBrowser(SupportedBrowser.CHROME)
270 @SupportedBrowser(SupportedBrowser.SAFARI) 300 @SupportedBrowser(SupportedBrowser.SAFARI)
271 @Experimental 301 @Experimental
272 abstract class _SQLTransactionSync extends NativeFieldWrapperClass1 { 302 abstract class _SQLTransactionSync extends NativeFieldWrapperClass1 {
273 _SQLTransactionSync.internal(); 303 _SQLTransactionSync.internal();
274 304
275 } 305 }
OLDNEW
« no previous file with comments | « sdk/lib/web_sql/dart2js/web_sql_dart2js.dart ('k') | tests/html/node_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698