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

Side by Side Diff: sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart

Issue 1909613003: Revert "Remove the generics from _FrozenElementList: causes checked mode failures" (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 /** 1 /**
2 * A client-side key-value store with support for indexes. 2 * A client-side key-value store with support for indexes.
3 * 3 *
4 * Many browsers support IndexedDB—a web standard for 4 * Many browsers support IndexedDB—a web standard for
5 * an indexed database. 5 * an indexed database.
6 * By storing data on the client in an IndexedDB, 6 * By storing data on the client in an IndexedDB,
7 * a web app gets some advantages, such as faster performance and persistence. 7 * a web app gets some advantages, such as faster performance and persistence.
8 * To find out which browsers support IndexedDB, 8 * To find out which browsers support IndexedDB,
9 * refer to [Can I Use?](http://caniuse.com/#feat=indexeddb) 9 * refer to [Can I Use?](http://caniuse.com/#feat=indexeddb)
10 * 10 *
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 request.onBlocked.listen(onBlocked); 546 request.onBlocked.listen(onBlocked);
547 } 547 }
548 return _completeRequest(request); 548 return _completeRequest(request);
549 } catch (e, stacktrace) { 549 } catch (e, stacktrace) {
550 return new Future.error(e, stacktrace); 550 return new Future.error(e, stacktrace);
551 } 551 }
552 } 552 }
553 553
554 @DomName('IDBFactory.deleteDatabase') 554 @DomName('IDBFactory.deleteDatabase')
555 Future<IdbFactory> deleteDatabase(String name, 555 Future<IdbFactory> deleteDatabase(String name,
556 {void onBlocked(Event)}) { 556 {void onBlocked(Event e)}) {
557 try { 557 try {
558 var request = _deleteDatabase(name); 558 var request = _deleteDatabase(name);
559 559
560 if (onBlocked != null) { 560 if (onBlocked != null) {
561 request.onBlocked.listen(onBlocked); 561 request.onBlocked.listen(onBlocked);
562 } 562 }
563 var completer = new Completer.sync(); 563 var completer = new Completer<IdbFactory>.sync();
564 request.onSuccess.listen((e) { 564 request.onSuccess.listen((e) {
565 completer.complete(this); 565 completer.complete(this);
566 }); 566 });
567 request.onError.listen(completer.completeError); 567 request.onError.listen(completer.completeError);
568 return completer.future; 568 return completer.future;
569 } catch (e, stacktrace) { 569 } catch (e, stacktrace) {
570 return new Future.error(e, stacktrace); 570 return new Future.error(e, stacktrace);
571 } 571 }
572 } 572 }
573 573
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 @Creates('DomStringList') 623 @Creates('DomStringList')
624 Request _webkitGetDatabaseNames() native; 624 Request _webkitGetDatabaseNames() native;
625 625
626 } 626 }
627 627
628 628
629 /** 629 /**
630 * Ties a request to a completer, so the completer is completed when it succeeds 630 * Ties a request to a completer, so the completer is completed when it succeeds
631 * and errors out when the request errors. 631 * and errors out when the request errors.
632 */ 632 */
633 Future _completeRequest(Request request) { 633 Future/*<T>*/ _completeRequest/*<T>*/(Request request) {
634 var completer = new Completer.sync(); 634 var completer = new Completer/*<T>*/.sync();
635 // TODO: make sure that completer.complete is synchronous as transactions 635 // TODO: make sure that completer.complete is synchronous as transactions
636 // may be committed if the result is not processed immediately. 636 // may be committed if the result is not processed immediately.
637 request.onSuccess.listen((e) { 637 request.onSuccess.listen((e) {
638 completer.complete(request.result); 638 completer.complete(request.result as dynamic/*=T*/);
639 }); 639 });
640 request.onError.listen(completer.completeError); 640 request.onError.listen(completer.completeError);
641 return completer.future; 641 return completer.future;
642 } 642 }
643 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 643 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
644 // for details. All rights reserved. Use of this source code is governed by a 644 // for details. All rights reserved. Use of this source code is governed by a
645 // BSD-style license that can be found in the LICENSE file. 645 // BSD-style license that can be found in the LICENSE file.
646 646
647 647
648 @DomName('IDBIndex') 648 @DomName('IDBIndex')
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 1173
1174 1174
1175 /** 1175 /**
1176 * Helper for iterating over cursors in a request. 1176 * Helper for iterating over cursors in a request.
1177 */ 1177 */
1178 static Stream<Cursor> _cursorStreamFromResult(Request request, 1178 static Stream<Cursor> _cursorStreamFromResult(Request request,
1179 bool autoAdvance) { 1179 bool autoAdvance) {
1180 // TODO: need to guarantee that the controller provides the values 1180 // TODO: need to guarantee that the controller provides the values
1181 // immediately as waiting until the next tick will cause the transaction to 1181 // immediately as waiting until the next tick will cause the transaction to
1182 // close. 1182 // close.
1183 var controller = new StreamController(sync: true); 1183 var controller = new StreamController<Cursor>(sync: true);
1184 1184
1185 //TODO: Report stacktrace once issue 4061 is resolved. 1185 //TODO: Report stacktrace once issue 4061 is resolved.
1186 request.onError.listen(controller.addError); 1186 request.onError.listen(controller.addError);
1187 1187
1188 request.onSuccess.listen((e) { 1188 request.onSuccess.listen((e) {
1189 Cursor cursor = request.result; 1189 Cursor cursor = request.result;
1190 if (cursor == null) { 1190 if (cursor == null) {
1191 controller.close(); 1191 controller.close();
1192 } else { 1192 } else {
1193 controller.add(cursor); 1193 controller.add(cursor);
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 @Creates('int|String|Null') 1465 @Creates('int|String|Null')
1466 @Returns('int|String|Null') 1466 @Returns('int|String|Null')
1467 final int newVersion; 1467 final int newVersion;
1468 1468
1469 @DomName('IDBVersionChangeEvent.oldVersion') 1469 @DomName('IDBVersionChangeEvent.oldVersion')
1470 @DocsEditable() 1470 @DocsEditable()
1471 @Creates('int|String|Null') 1471 @Creates('int|String|Null')
1472 @Returns('int|String|Null') 1472 @Returns('int|String|Null')
1473 final int oldVersion; 1473 final int oldVersion;
1474 } 1474 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | sdk/lib/indexed_db/dartium/indexed_db_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698