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

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

Issue 27036002: Update dom streams with new signatures. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 * 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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 try { 517 try {
518 var request = _deleteDatabase(name); 518 var request = _deleteDatabase(name);
519 519
520 if (onBlocked != null) { 520 if (onBlocked != null) {
521 request.onBlocked.listen(onBlocked); 521 request.onBlocked.listen(onBlocked);
522 } 522 }
523 var completer = new Completer.sync(); 523 var completer = new Completer.sync();
524 request.onSuccess.listen((e) { 524 request.onSuccess.listen((e) {
525 completer.complete(this); 525 completer.complete(this);
526 }); 526 });
527 request.onError.listen((e) { 527 request.onError.listen(completer.completeError);
528 completer.completeError(e);
529 });
530 return completer.future; 528 return completer.future;
531 } catch (e, stacktrace) { 529 } catch (e, stacktrace) {
532 return new Future.error(e, stacktrace); 530 return new Future.error(e, stacktrace);
533 } 531 }
534 } 532 }
535 533
536 @DomName('IDBFactory.getDatabaseNames') 534 @DomName('IDBFactory.getDatabaseNames')
537 @SupportedBrowser(SupportedBrowser.CHROME) 535 @SupportedBrowser(SupportedBrowser.CHROME)
538 @Experimental() 536 @Experimental()
539 Future<List<String>> getDatabaseNames() { 537 Future<List<String>> getDatabaseNames() {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 * Ties a request to a completer, so the completer is completed when it succeeds 588 * Ties a request to a completer, so the completer is completed when it succeeds
591 * and errors out when the request errors. 589 * and errors out when the request errors.
592 */ 590 */
593 Future _completeRequest(Request request) { 591 Future _completeRequest(Request request) {
594 var completer = new Completer.sync(); 592 var completer = new Completer.sync();
595 // TODO: make sure that completer.complete is synchronous as transactions 593 // TODO: make sure that completer.complete is synchronous as transactions
596 // may be committed if the result is not processed immediately. 594 // may be committed if the result is not processed immediately.
597 request.onSuccess.listen((e) { 595 request.onSuccess.listen((e) {
598 completer.complete(request.result); 596 completer.complete(request.result);
599 }); 597 });
600 request.onError.listen((e) { 598 request.onError.listen(completer.completeError);
601 completer.completeError(e);
602 });
603 return completer.future; 599 return completer.future;
604 } 600 }
605 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 601 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
606 // for details. All rights reserved. Use of this source code is governed by a 602 // for details. All rights reserved. Use of this source code is governed by a
607 // BSD-style license that can be found in the LICENSE file. 603 // BSD-style license that can be found in the LICENSE file.
608 604
609 605
610 @DomName('IDBIndex') 606 @DomName('IDBIndex')
611 @Unstable() 607 @Unstable()
612 class Index extends Interceptor native "IDBIndex" { 608 class Index extends Interceptor native "IDBIndex" {
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 /** 1117 /**
1122 * Helper for iterating over cursors in a request. 1118 * Helper for iterating over cursors in a request.
1123 */ 1119 */
1124 static Stream<Cursor> _cursorStreamFromResult(Request request, 1120 static Stream<Cursor> _cursorStreamFromResult(Request request,
1125 bool autoAdvance) { 1121 bool autoAdvance) {
1126 // TODO: need to guarantee that the controller provides the values 1122 // TODO: need to guarantee that the controller provides the values
1127 // immediately as waiting until the next tick will cause the transaction to 1123 // immediately as waiting until the next tick will cause the transaction to
1128 // close. 1124 // close.
1129 var controller = new StreamController(sync: true); 1125 var controller = new StreamController(sync: true);
1130 1126
1131 request.onError.listen((e) { 1127 //TODO: Report stacktrace once issue 4061 is resolved.
1132 //TODO: Report stacktrace once issue 4061 is resolved. 1128 request.onError.listen(controller.addError);
1133 controller.addError(e);
1134 });
1135 1129
1136 request.onSuccess.listen((e) { 1130 request.onSuccess.listen((e) {
1137 Cursor cursor = request.result; 1131 Cursor cursor = request.result;
1138 if (cursor == null) { 1132 if (cursor == null) {
1139 controller.close(); 1133 controller.close();
1140 } else { 1134 } else {
1141 controller.add(cursor); 1135 controller.add(cursor);
1142 if (autoAdvance == true && controller.hasListener) { 1136 if (autoAdvance == true && controller.hasListener) {
1143 cursor.next(); 1137 cursor.next();
1144 } 1138 }
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1337 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
1344 // for details. All rights reserved. Use of this source code is governed by a 1338 // for details. All rights reserved. Use of this source code is governed by a
1345 // BSD-style license that can be found in the LICENSE file. 1339 // BSD-style license that can be found in the LICENSE file.
1346 1340
1347 1341
1348 @DocsEditable() 1342 @DocsEditable()
1349 @DomName('IDBAny') 1343 @DomName('IDBAny')
1350 @deprecated // nonstandard 1344 @deprecated // nonstandard
1351 abstract class _IDBAny extends Interceptor native "IDBAny" { 1345 abstract class _IDBAny extends Interceptor native "IDBAny" {
1352 } 1346 }
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