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

Side by Side Diff: sdk/lib/web_sql/dart2js/web_sql_dart2js.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/svg/dartium/svg_dartium.dart ('k') | sdk/lib/web_sql/dartium/web_sql_dartium.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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 192
193 193
194 @DocsEditable 194 @DocsEditable
195 @DomName('SQLResultSetRowList') 195 @DomName('SQLResultSetRowList')
196 class SqlResultSetRowList extends Object with ListMixin<Map>, ImmutableListMixin <Map> implements JavaScriptIndexingBehavior, List<Map> native "SQLResultSetRowLi st" { 196 class SqlResultSetRowList extends Object with ListMixin<Map>, ImmutableListMixin <Map> implements JavaScriptIndexingBehavior, List<Map> native "SQLResultSetRowLi st" {
197 197
198 @DomName('SQLResultSetRowList.length') 198 @DomName('SQLResultSetRowList.length')
199 @DocsEditable 199 @DocsEditable
200 int get length => JS("int", "#.length", this); 200 int get length => JS("int", "#.length", this);
201 201
202 Map operator[](int index) => this.item(index); 202 Map operator[](int index) {
203 203 if (JS("bool", "# >>> 0 !== # || # >= #", index,
204 index, index, length))
205 throw new RangeError.range(index, 0, length);
206 return this.item(index);
207 }
204 void operator[]=(int index, Map value) { 208 void operator[]=(int index, Map value) {
205 throw new UnsupportedError("Cannot assign element of immutable List."); 209 throw new UnsupportedError("Cannot assign element of immutable List.");
206 } 210 }
207 // -- start List<Map> mixins. 211 // -- start List<Map> mixins.
208 // Map is the element type. 212 // Map is the element type.
209 213
210 214
211 void set length(int value) { 215 void set length(int value) {
212 throw new UnsupportedError("Cannot resize immutable List."); 216 throw new UnsupportedError("Cannot resize immutable List.");
213 } 217 }
214 218
219 Map get first {
220 if (this.length > 0) {
221 return JS('Map', '#[0]', this);
222 }
223 throw new StateError("No elements");
224 }
225
226 Map get last {
227 int len = this.length;
228 if (len > 0) {
229 return JS('Map', '#[#]', this, len - 1);
230 }
231 throw new StateError("No elements");
232 }
233
234 Map get single {
235 int len = this.length;
236 if (len == 1) {
237 return JS('Map', '#[0]', this);
238 }
239 if (len == 0) throw new StateError("No elements");
240 throw new StateError("More than one element");
241 }
242
243 Map elementAt(int index) => this[index];
215 // -- end List<Map> mixins. 244 // -- end List<Map> mixins.
216 245
217 @DomName('SQLResultSetRowList.item') 246 @DomName('SQLResultSetRowList.item')
218 @DocsEditable 247 @DocsEditable
219 @Creates('=Object') 248 @Creates('=Object')
220 Map item(int index) { 249 Map item(int index) {
221 return convertNativeToDart_Dictionary(_item_1(index)); 250 return convertNativeToDart_Dictionary(_item_1(index));
222 } 251 }
223 @JSName('item') 252 @JSName('item')
224 @DomName('SQLResultSetRowList.item') 253 @DomName('SQLResultSetRowList.item')
(...skipping 22 matching lines...) Expand all
247 // BSD-style license that can be found in the LICENSE file. 276 // BSD-style license that can be found in the LICENSE file.
248 277
249 278
250 @DocsEditable 279 @DocsEditable
251 @DomName('SQLTransactionSync') 280 @DomName('SQLTransactionSync')
252 @SupportedBrowser(SupportedBrowser.CHROME) 281 @SupportedBrowser(SupportedBrowser.CHROME)
253 @SupportedBrowser(SupportedBrowser.SAFARI) 282 @SupportedBrowser(SupportedBrowser.SAFARI)
254 @Experimental 283 @Experimental
255 abstract class _SQLTransactionSync native "SQLTransactionSync" { 284 abstract class _SQLTransactionSync native "SQLTransactionSync" {
256 } 285 }
OLDNEW
« no previous file with comments | « sdk/lib/svg/dartium/svg_dartium.dart ('k') | sdk/lib/web_sql/dartium/web_sql_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698