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

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

Issue 16125005: Make new StreamController be async by default. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 library dart.dom.indexed_db; 1 library dart.dom.indexed_db;
2 2
3 import 'dart:async'; 3 import 'dart:async';
4 import 'dart:html'; 4 import 'dart:html';
5 import 'dart:html_common'; 5 import 'dart:html_common';
6 import 'dart:typed_data'; 6 import 'dart:typed_data';
7 import 'dart:_js_helper' show Creates, Returns, JSName, Null; 7 import 'dart:_js_helper' show Creates, Returns, JSName, Null;
8 import 'dart:_foreign_helper' show JS; 8 import 'dart:_foreign_helper' show JS;
9 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 9 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
10 // for details. All rights reserved. Use of this source code is governed by a 10 // for details. All rights reserved. Use of this source code is governed by a
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 @DomName('IDBCursor.value') 152 @DomName('IDBCursor.value')
153 Future update(value) { 153 Future update(value) {
154 try { 154 try {
155 return _completeRequest($dom_update(value)); 155 return _completeRequest($dom_update(value));
156 } catch (e, stacktrace) { 156 } catch (e, stacktrace) {
157 return new Future.error(e, stacktrace); 157 return new Future.error(e, stacktrace);
158 } 158 }
159 } 159 }
160 160
161 161
162 @DomName('IDBCursor.direction') 162 @DomName('IDBCursor.direction')
163 @DocsEditable 163 @DocsEditable
164 final String direction; 164 final String direction;
165 165
166 @DomName('IDBCursor.key') 166 @DomName('IDBCursor.key')
167 @DocsEditable 167 @DocsEditable
168 @_annotation_Creates_IDBKey 168 @_annotation_Creates_IDBKey
169 @_annotation_Returns_IDBKey 169 @_annotation_Returns_IDBKey
170 final Object key; 170 final Object key;
171 171
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 } 578 }
579 var request; 579 var request;
580 if (direction == null) { 580 if (direction == null) {
581 request = $dom_openKeyCursor(key_OR_range); 581 request = $dom_openKeyCursor(key_OR_range);
582 } else { 582 } else {
583 request = $dom_openKeyCursor(key_OR_range, direction); 583 request = $dom_openKeyCursor(key_OR_range, direction);
584 } 584 }
585 return ObjectStore._cursorStreamFromResult(request, autoAdvance); 585 return ObjectStore._cursorStreamFromResult(request, autoAdvance);
586 } 586 }
587 587
588 588
589 @DomName('IDBIndex.keyPath') 589 @DomName('IDBIndex.keyPath')
590 @DocsEditable 590 @DocsEditable
591 final dynamic keyPath; 591 final dynamic keyPath;
592 592
593 @DomName('IDBIndex.multiEntry') 593 @DomName('IDBIndex.multiEntry')
594 @DocsEditable 594 @DocsEditable
595 final bool multiEntry; 595 final bool multiEntry;
596 596
597 @DomName('IDBIndex.name') 597 @DomName('IDBIndex.name')
598 @DocsEditable 598 @DocsEditable
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 1009
1010 1010
1011 /** 1011 /**
1012 * Helper for iterating over cursors in a request. 1012 * Helper for iterating over cursors in a request.
1013 */ 1013 */
1014 static Stream<Cursor> _cursorStreamFromResult(Request request, 1014 static Stream<Cursor> _cursorStreamFromResult(Request request,
1015 bool autoAdvance) { 1015 bool autoAdvance) {
1016 // TODO: need to guarantee that the controller provides the values 1016 // TODO: need to guarantee that the controller provides the values
1017 // immediately as waiting until the next tick will cause the transaction to 1017 // immediately as waiting until the next tick will cause the transaction to
1018 // close. 1018 // close.
1019 var controller = new StreamController(); 1019 var controller = new StreamController(sync: true);
1020 1020
1021 request.onError.listen((e) { 1021 request.onError.listen((e) {
1022 //TODO: Report stacktrace once issue 4061 is resolved. 1022 //TODO: Report stacktrace once issue 4061 is resolved.
1023 controller.addError(e); 1023 controller.addError(e);
1024 }); 1024 });
1025 1025
1026 request.onSuccess.listen((e) { 1026 request.onSuccess.listen((e) {
1027 Cursor cursor = request.result; 1027 Cursor cursor = request.result;
1028 if (cursor == null) { 1028 if (cursor == null) {
1029 controller.close(); 1029 controller.close();
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1258 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
1259 // for details. All rights reserved. Use of this source code is governed by a 1259 // for details. All rights reserved. Use of this source code is governed by a
1260 // BSD-style license that can be found in the LICENSE file. 1260 // BSD-style license that can be found in the LICENSE file.
1261 1261
1262 1262
1263 @DocsEditable 1263 @DocsEditable
1264 @DomName('IDBAny') 1264 @DomName('IDBAny')
1265 @deprecated // nonstandard 1265 @deprecated // nonstandard
1266 abstract class _IDBAny native "IDBAny" { 1266 abstract class _IDBAny native "IDBAny" {
1267 } 1267 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698