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

Side by Side Diff: sdk/lib/indexed_db/dartium/indexed_db_dartium.dart

Issue 1903973002: Fix indexed_db strong mode warnings. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: ready for review 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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 request.onBlocked.listen(onBlocked); 490 request.onBlocked.listen(onBlocked);
491 } 491 }
492 return _completeRequest(request); 492 return _completeRequest(request);
493 } catch (e, stacktrace) { 493 } catch (e, stacktrace) {
494 return new Future.error(e, stacktrace); 494 return new Future.error(e, stacktrace);
495 } 495 }
496 } 496 }
497 497
498 @DomName('IDBFactory.deleteDatabase') 498 @DomName('IDBFactory.deleteDatabase')
499 Future<IdbFactory> deleteDatabase(String name, 499 Future<IdbFactory> deleteDatabase(String name,
500 {void onBlocked(Event)}) { 500 {void onBlocked(Event e)}) {
501 try { 501 try {
502 var request = _deleteDatabase(name); 502 var request = _deleteDatabase(name);
503 503
504 if (onBlocked != null) { 504 if (onBlocked != null) {
505 request.onBlocked.listen(onBlocked); 505 request.onBlocked.listen(onBlocked);
506 } 506 }
507 var completer = new Completer.sync(); 507 var completer = new Completer<IdbFactory>.sync();
508 request.onSuccess.listen((e) { 508 request.onSuccess.listen((e) {
509 completer.complete(this); 509 completer.complete(this);
510 }); 510 });
511 request.onError.listen(completer.completeError); 511 request.onError.listen(completer.completeError);
512 return completer.future; 512 return completer.future;
513 } catch (e, stacktrace) { 513 } catch (e, stacktrace) {
514 return new Future.error(e, stacktrace); 514 return new Future.error(e, stacktrace);
515 } 515 }
516 } 516 }
517 517
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 @Experimental() 567 @Experimental()
568 Request _webkitGetDatabaseNames() => _blink.BlinkIDBFactory.instance.webkitGet DatabaseNames_Callback_0_(this); 568 Request _webkitGetDatabaseNames() => _blink.BlinkIDBFactory.instance.webkitGet DatabaseNames_Callback_0_(this);
569 569
570 } 570 }
571 571
572 572
573 /** 573 /**
574 * Ties a request to a completer, so the completer is completed when it succeeds 574 * Ties a request to a completer, so the completer is completed when it succeeds
575 * and errors out when the request errors. 575 * and errors out when the request errors.
576 */ 576 */
577 Future _completeRequest(Request request) { 577 Future/*<T>*/ _completeRequest/*<T>*/(Request request) {
578 var completer = new Completer.sync(); 578 var completer = new Completer/*<T>*/.sync();
579 // TODO: make sure that completer.complete is synchronous as transactions 579 // TODO: make sure that completer.complete is synchronous as transactions
580 // may be committed if the result is not processed immediately. 580 // may be committed if the result is not processed immediately.
581 request.onSuccess.listen((e) { 581 request.onSuccess.listen((e) {
582 completer.complete(request.result); 582 completer.complete(request.result as dynamic/*=T*/);
583 }); 583 });
584 request.onError.listen(completer.completeError); 584 request.onError.listen(completer.completeError);
585 return completer.future; 585 return completer.future;
586 } 586 }
587 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 587 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
588 // for details. All rights reserved. Use of this source code is governed by a 588 // for details. All rights reserved. Use of this source code is governed by a
589 // BSD-style license that can be found in the LICENSE file. 589 // BSD-style license that can be found in the LICENSE file.
590 590
591 591
592 @DomName('IDBIndex') 592 @DomName('IDBIndex')
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 if (key != null) { 1068 if (key != null) {
1069 return _blink.BlinkIDBObjectStore.instance.put_Callback_2_(this, convertDa rtToNative_SerializedScriptValue(value), convertDartToNative_SerializedScriptVal ue(key)); 1069 return _blink.BlinkIDBObjectStore.instance.put_Callback_2_(this, convertDa rtToNative_SerializedScriptValue(value), convertDartToNative_SerializedScriptVal ue(key));
1070 } 1070 }
1071 return _blink.BlinkIDBObjectStore.instance.put_Callback_1_(this, convertDart ToNative_SerializedScriptValue(value)); 1071 return _blink.BlinkIDBObjectStore.instance.put_Callback_1_(this, convertDart ToNative_SerializedScriptValue(value));
1072 } 1072 }
1073 1073
1074 1074
1075 /** 1075 /**
1076 * Helper for iterating over cursors in a request. 1076 * Helper for iterating over cursors in a request.
1077 */ 1077 */
1078 static Stream<Cursor> _cursorStreamFromResult(Request request, 1078 static Stream/*<T>*/ _cursorStreamFromResult/*<T extends Cursor>*/(Request req uest,
1079 bool autoAdvance) { 1079 bool autoAdvance) {
1080 // TODO: need to guarantee that the controller provides the values 1080 // TODO: need to guarantee that the controller provides the values
1081 // immediately as waiting until the next tick will cause the transaction to 1081 // immediately as waiting until the next tick will cause the transaction to
1082 // close. 1082 // close.
1083 var controller = new StreamController(sync: true); 1083 var controller = new StreamController/*<T>*/(sync: true);
1084 1084
1085 //TODO: Report stacktrace once issue 4061 is resolved. 1085 //TODO: Report stacktrace once issue 4061 is resolved.
1086 request.onError.listen(controller.addError); 1086 request.onError.listen(controller.addError);
1087 1087
1088 request.onSuccess.listen((e) { 1088 request.onSuccess.listen((e) {
1089 Cursor cursor = request.result; 1089 var cursor = request.result as dynamic /*=T*/;
1090 if (cursor == null) { 1090 if (cursor == null) {
1091 controller.close(); 1091 controller.close();
1092 } else { 1092 } else {
1093 controller.add(cursor); 1093 controller.add(cursor);
1094 if (autoAdvance == true && controller.hasListener) { 1094 if (autoAdvance == true && controller.hasListener) {
1095 cursor.next(); 1095 cursor.next();
1096 } 1096 }
1097 } 1097 }
1098 }); 1098 });
1099 return controller.stream; 1099 return controller.stream;
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 1388
1389 @DomName('IDBVersionChangeEvent.newVersion') 1389 @DomName('IDBVersionChangeEvent.newVersion')
1390 @DocsEditable() 1390 @DocsEditable()
1391 int get newVersion => _blink.BlinkIDBVersionChangeEvent.instance.newVersion_Ge tter_(this); 1391 int get newVersion => _blink.BlinkIDBVersionChangeEvent.instance.newVersion_Ge tter_(this);
1392 1392
1393 @DomName('IDBVersionChangeEvent.oldVersion') 1393 @DomName('IDBVersionChangeEvent.oldVersion')
1394 @DocsEditable() 1394 @DocsEditable()
1395 int get oldVersion => _blink.BlinkIDBVersionChangeEvent.instance.oldVersion_Ge tter_(this); 1395 int get oldVersion => _blink.BlinkIDBVersionChangeEvent.instance.oldVersion_Ge tter_(this);
1396 1396
1397 } 1397 }
OLDNEW
« no previous file with comments | « sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart ('k') | tools/dom/templates/html/impl/impl_IDBFactory.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698