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

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
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) throw new RangeError.range(index, 0, lengt h);
222 return _nativeIndexedGetter(index);
223 }
224 Map _nativeIndexedGetter(int index) native "SQLResultSetRowList_item_Callback" ;
221 225
222 void operator[]=(int index, Map value) { 226 void operator[]=(int index, Map value) {
223 throw new UnsupportedError("Cannot assign element of immutable List."); 227 throw new UnsupportedError("Cannot assign element of immutable List.");
224 } 228 }
225 // -- start List<Map> mixins. 229 // -- start List<Map> mixins.
226 // Map is the element type. 230 // Map is the element type.
227 231
228 232
229 void set length(int value) { 233 void set length(int value) {
230 throw new UnsupportedError("Cannot resize immutable List."); 234 throw new UnsupportedError("Cannot resize immutable List.");
231 } 235 }
232 236
237 Map get first {
238 if (this.length > 0) {
239 return this[0];
240 }
241 throw new StateError("No elements");
242 }
243
244 Map get last {
245 int len = this.length;
246 if (len > 0) {
247 return this[len - 1];
248 }
249 throw new StateError("No elements");
250 }
251
252 Map get single {
253 int len = this.length;
254 if (len == 1) {
255 return this[0];
256 }
257 if (len == 0) throw new StateError("No elements");
258 throw new StateError("More than one element");
259 }
260
261 Map elementAt(int index) {
262 return this[index];
263 }
264
233 // -- end List<Map> mixins. 265 // -- end List<Map> mixins.
234 266
235 @DomName('SQLResultSetRowList.item') 267 @DomName('SQLResultSetRowList.item')
236 @DocsEditable 268 @DocsEditable
237 Map item(int index) native "SQLResultSetRowList_item_Callback"; 269 Map item(int index) native "SQLResultSetRowList_item_Callback";
238 270
239 } 271 }
240 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 272 // 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 273 // 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. 274 // BSD-style license that can be found in the LICENSE file.
(...skipping 23 matching lines...) Expand all
266 298
267 @DocsEditable 299 @DocsEditable
268 @DomName('SQLTransactionSync') 300 @DomName('SQLTransactionSync')
269 @SupportedBrowser(SupportedBrowser.CHROME) 301 @SupportedBrowser(SupportedBrowser.CHROME)
270 @SupportedBrowser(SupportedBrowser.SAFARI) 302 @SupportedBrowser(SupportedBrowser.SAFARI)
271 @Experimental 303 @Experimental
272 abstract class _SQLTransactionSync extends NativeFieldWrapperClass1 { 304 abstract class _SQLTransactionSync extends NativeFieldWrapperClass1 {
273 _SQLTransactionSync.internal(); 305 _SQLTransactionSync.internal();
274 306
275 } 307 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698