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

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

Issue 18054021: Fixing up DOM constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 import 'dart:_interceptors' show JSExtendableArray; 9 import 'dart:_interceptors' show Interceptor, JSExtendableArray;
10 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 10 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
11 // for details. All rights reserved. Use of this source code is governed by a 11 // for details. All rights reserved. Use of this source code is governed by a
12 // BSD-style license that can be found in the LICENSE file. 12 // BSD-style license that can be found in the LICENSE file.
13 13
14 // DO NOT EDIT - unless you are editing documentation as per: 14 // DO NOT EDIT - unless you are editing documentation as per:
15 // https://code.google.com/p/dart/wiki/ContributingHTMLDocumentation 15 // https://code.google.com/p/dart/wiki/ContributingHTMLDocumentation
16 // Auto-generated dart:svg library. 16 // Auto-generated dart:svg library.
17 17
18 18
19 19
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 const String _idbKey = 'JSExtendableArray|=Object|num|String'; 133 const String _idbKey = 'JSExtendableArray|=Object|num|String';
134 const _annotation_Creates_IDBKey = const Creates(_idbKey); 134 const _annotation_Creates_IDBKey = const Creates(_idbKey);
135 const _annotation_Returns_IDBKey = const Returns(_idbKey); 135 const _annotation_Returns_IDBKey = const Returns(_idbKey);
136 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 136 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
137 // for details. All rights reserved. Use of this source code is governed by a 137 // for details. All rights reserved. Use of this source code is governed by a
138 // BSD-style license that can be found in the LICENSE file. 138 // BSD-style license that can be found in the LICENSE file.
139 139
140 140
141 @DomName('IDBCursor') 141 @DomName('IDBCursor')
142 @Unstable 142 @Unstable
143 class Cursor native "IDBCursor" { 143 class Cursor extends Interceptor native "IDBCursor" {
144 @DomName('IDBCursor.delete') 144 @DomName('IDBCursor.delete')
145 Future delete() { 145 Future delete() {
146 try { 146 try {
147 return _completeRequest($dom_delete()); 147 return _completeRequest($dom_delete());
148 } catch (e, stacktrace) { 148 } catch (e, stacktrace) {
149 return new Future.error(e, stacktrace); 149 return new Future.error(e, stacktrace);
150 } 150 }
151 } 151 }
152 152
153 @DomName('IDBCursor.value') 153 @DomName('IDBCursor.value')
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 } 210 }
211 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 211 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
212 // for details. All rights reserved. Use of this source code is governed by a 212 // for details. All rights reserved. Use of this source code is governed by a
213 // BSD-style license that can be found in the LICENSE file. 213 // BSD-style license that can be found in the LICENSE file.
214 214
215 215
216 @DocsEditable 216 @DocsEditable
217 @DomName('IDBCursorWithValue') 217 @DomName('IDBCursorWithValue')
218 @Unstable 218 @Unstable
219 class CursorWithValue extends Cursor native "IDBCursorWithValue" { 219 class CursorWithValue extends Cursor native "IDBCursorWithValue" {
220 // To suppress missing implicit constructor warnings.
221 factory CursorWithValue._() { throw new UnsupportedError("Not supported"); }
220 222
221 dynamic get value => _convertNativeToDart_IDBAny(this._get_value); 223 dynamic get value => _convertNativeToDart_IDBAny(this._get_value);
222 @JSName('value') 224 @JSName('value')
223 @DomName('IDBCursorWithValue.value') 225 @DomName('IDBCursorWithValue.value')
224 @DocsEditable 226 @DocsEditable
225 @annotation_Creates_SerializedScriptValue 227 @annotation_Creates_SerializedScriptValue
226 @annotation_Returns_SerializedScriptValue 228 @annotation_Returns_SerializedScriptValue
227 final dynamic _get_value; 229 final dynamic _get_value;
228 } 230 }
229 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 231 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 266
265 // Try and create a transaction with a string mode. Browsers that expect a 267 // Try and create a transaction with a string mode. Browsers that expect a
266 // numeric mode tend to convert the string into a number. This fails 268 // numeric mode tend to convert the string into a number. This fails
267 // silently, resulting in zero ('readonly'). 269 // silently, resulting in zero ('readonly').
268 return _transaction(storeName_OR_storeNames, mode); 270 return _transaction(storeName_OR_storeNames, mode);
269 } 271 }
270 272
271 @JSName('transaction') 273 @JSName('transaction')
272 Transaction _transaction(stores, mode) native; 274 Transaction _transaction(stores, mode) native;
273 275
276 // To suppress missing implicit constructor warnings.
277 factory Database._() { throw new UnsupportedError("Not supported"); }
274 278
275 @DomName('IDBDatabase.abortEvent') 279 @DomName('IDBDatabase.abortEvent')
276 @DocsEditable 280 @DocsEditable
277 static const EventStreamProvider<Event> abortEvent = const EventStreamProvider <Event>('abort'); 281 static const EventStreamProvider<Event> abortEvent = const EventStreamProvider <Event>('abort');
278 282
279 @DomName('IDBDatabase.errorEvent') 283 @DomName('IDBDatabase.errorEvent')
280 @DocsEditable 284 @DocsEditable
281 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider <Event>('error'); 285 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider <Event>('error');
282 286
283 @DomName('IDBDatabase.versionchangeEvent') 287 @DomName('IDBDatabase.versionchangeEvent')
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 // for details. All rights reserved. Use of this source code is governed by a 360 // for details. All rights reserved. Use of this source code is governed by a
357 // BSD-style license that can be found in the LICENSE file. 361 // BSD-style license that can be found in the LICENSE file.
358 362
359 363
360 @DomName('IDBFactory') 364 @DomName('IDBFactory')
361 @SupportedBrowser(SupportedBrowser.CHROME) 365 @SupportedBrowser(SupportedBrowser.CHROME)
362 @SupportedBrowser(SupportedBrowser.FIREFOX, '15') 366 @SupportedBrowser(SupportedBrowser.FIREFOX, '15')
363 @SupportedBrowser(SupportedBrowser.IE, '10') 367 @SupportedBrowser(SupportedBrowser.IE, '10')
364 @Experimental 368 @Experimental
365 @Unstable 369 @Unstable
366 class IdbFactory native "IDBFactory" { 370 class IdbFactory extends Interceptor native "IDBFactory" {
367 /** 371 /**
368 * Checks to see if Indexed DB is supported on the current platform. 372 * Checks to see if Indexed DB is supported on the current platform.
369 */ 373 */
370 static bool get supported { 374 static bool get supported {
371 return JS('bool', 375 return JS('bool',
372 '!!(window.indexedDB || ' 376 '!!(window.indexedDB || '
373 'window.webkitIndexedDB || ' 377 'window.webkitIndexedDB || '
374 'window.mozIndexedDB)'); 378 'window.mozIndexedDB)');
375 } 379 }
376 380
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 }); 497 });
494 return completer.future; 498 return completer.future;
495 } 499 }
496 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 500 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
497 // for details. All rights reserved. Use of this source code is governed by a 501 // for details. All rights reserved. Use of this source code is governed by a
498 // BSD-style license that can be found in the LICENSE file. 502 // BSD-style license that can be found in the LICENSE file.
499 503
500 504
501 @DomName('IDBIndex') 505 @DomName('IDBIndex')
502 @Unstable 506 @Unstable
503 class Index native "IDBIndex" { 507 class Index extends Interceptor native "IDBIndex" {
504 @DomName('IDBIndex.count') 508 @DomName('IDBIndex.count')
505 Future<int> count([key_OR_range]) { 509 Future<int> count([key_OR_range]) {
506 try { 510 try {
507 var request; 511 var request;
508 if (key_OR_range != null) { 512 if (key_OR_range != null) {
509 request = $dom_count(key_OR_range); 513 request = $dom_count(key_OR_range);
510 } else { 514 } else {
511 request = $dom_count(); 515 request = $dom_count();
512 } 516 }
513 return _completeRequest(request); 517 return _completeRequest(request);
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 Request $dom_openKeyCursor([key_OR_range, String direction]) native; 657 Request $dom_openKeyCursor([key_OR_range, String direction]) native;
654 658
655 } 659 }
656 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 660 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
657 // for details. All rights reserved. Use of this source code is governed by a 661 // for details. All rights reserved. Use of this source code is governed by a
658 // BSD-style license that can be found in the LICENSE file. 662 // BSD-style license that can be found in the LICENSE file.
659 663
660 664
661 @DomName('IDBKeyRange') 665 @DomName('IDBKeyRange')
662 @Unstable 666 @Unstable
663 class KeyRange native "IDBKeyRange" { 667 class KeyRange extends Interceptor native "IDBKeyRange" {
664 @DomName('IDBKeyRange.only') 668 @DomName('IDBKeyRange.only')
665 factory KeyRange.only(/*Key*/ value) => 669 factory KeyRange.only(/*Key*/ value) =>
666 _KeyRangeFactoryProvider.createKeyRange_only(value); 670 _KeyRangeFactoryProvider.createKeyRange_only(value);
667 671
668 @DomName('IDBKeyRange.lowerBound') 672 @DomName('IDBKeyRange.lowerBound')
669 factory KeyRange.lowerBound(/*Key*/ bound, [bool open = false]) => 673 factory KeyRange.lowerBound(/*Key*/ bound, [bool open = false]) =>
670 _KeyRangeFactoryProvider.createKeyRange_lowerBound(bound, open); 674 _KeyRangeFactoryProvider.createKeyRange_lowerBound(bound, open);
671 675
672 @DomName('IDBKeyRange.upperBound') 676 @DomName('IDBKeyRange.upperBound')
673 factory KeyRange.upperBound(/*Key*/ bound, [bool open = false]) => 677 factory KeyRange.upperBound(/*Key*/ bound, [bool open = false]) =>
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 static KeyRange upperBound_(Object bound, [bool open]) native; 723 static KeyRange upperBound_(Object bound, [bool open]) native;
720 724
721 } 725 }
722 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 726 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
723 // for details. All rights reserved. Use of this source code is governed by a 727 // for details. All rights reserved. Use of this source code is governed by a
724 // BSD-style license that can be found in the LICENSE file. 728 // BSD-style license that can be found in the LICENSE file.
725 729
726 730
727 @DomName('IDBObjectStore') 731 @DomName('IDBObjectStore')
728 @Unstable 732 @Unstable
729 class ObjectStore native "IDBObjectStore" { 733 class ObjectStore extends Interceptor native "IDBObjectStore" {
730 734
731 @DomName('IDBObjectStore.add') 735 @DomName('IDBObjectStore.add')
732 Future add(value, [key]) { 736 Future add(value, [key]) {
733 try { 737 try {
734 var request; 738 var request;
735 if (key != null) { 739 if (key != null) {
736 request = $dom_add(value, key); 740 request = $dom_add(value, key);
737 } else { 741 } else {
738 request = $dom_add(value); 742 request = $dom_add(value);
739 } 743 }
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 } 1054 }
1051 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1055 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
1052 // for details. All rights reserved. Use of this source code is governed by a 1056 // for details. All rights reserved. Use of this source code is governed by a
1053 // BSD-style license that can be found in the LICENSE file. 1057 // BSD-style license that can be found in the LICENSE file.
1054 1058
1055 1059
1056 @DocsEditable 1060 @DocsEditable
1057 @DomName('IDBOpenDBRequest') 1061 @DomName('IDBOpenDBRequest')
1058 @Unstable 1062 @Unstable
1059 class OpenDBRequest extends Request implements EventTarget native "IDBOpenDBRequ est,IDBVersionChangeRequest" { 1063 class OpenDBRequest extends Request implements EventTarget native "IDBOpenDBRequ est,IDBVersionChangeRequest" {
1064 // To suppress missing implicit constructor warnings.
1065 factory OpenDBRequest._() { throw new UnsupportedError("Not supported"); }
1060 1066
1061 @DomName('IDBOpenDBRequest.blockedEvent') 1067 @DomName('IDBOpenDBRequest.blockedEvent')
1062 @DocsEditable 1068 @DocsEditable
1063 static const EventStreamProvider<Event> blockedEvent = const EventStreamProvid er<Event>('blocked'); 1069 static const EventStreamProvider<Event> blockedEvent = const EventStreamProvid er<Event>('blocked');
1064 1070
1065 @DomName('IDBOpenDBRequest.upgradeneededEvent') 1071 @DomName('IDBOpenDBRequest.upgradeneededEvent')
1066 @DocsEditable 1072 @DocsEditable
1067 static const EventStreamProvider<VersionChangeEvent> upgradeNeededEvent = cons t EventStreamProvider<VersionChangeEvent>('upgradeneeded'); 1073 static const EventStreamProvider<VersionChangeEvent> upgradeNeededEvent = cons t EventStreamProvider<VersionChangeEvent>('upgradeneeded');
1068 1074
1069 @DomName('IDBOpenDBRequest.onblocked') 1075 @DomName('IDBOpenDBRequest.onblocked')
1070 @DocsEditable 1076 @DocsEditable
1071 Stream<Event> get onBlocked => blockedEvent.forTarget(this); 1077 Stream<Event> get onBlocked => blockedEvent.forTarget(this);
1072 1078
1073 @DomName('IDBOpenDBRequest.onupgradeneeded') 1079 @DomName('IDBOpenDBRequest.onupgradeneeded')
1074 @DocsEditable 1080 @DocsEditable
1075 Stream<VersionChangeEvent> get onUpgradeNeeded => upgradeNeededEvent.forTarget (this); 1081 Stream<VersionChangeEvent> get onUpgradeNeeded => upgradeNeededEvent.forTarget (this);
1076 } 1082 }
1077 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1083 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
1078 // for details. All rights reserved. Use of this source code is governed by a 1084 // for details. All rights reserved. Use of this source code is governed by a
1079 // BSD-style license that can be found in the LICENSE file. 1085 // BSD-style license that can be found in the LICENSE file.
1080 1086
1081 1087
1082 @DocsEditable 1088 @DocsEditable
1083 @DomName('IDBRequest') 1089 @DomName('IDBRequest')
1084 @Unstable 1090 @Unstable
1085 class Request extends EventTarget native "IDBRequest" { 1091 class Request extends EventTarget native "IDBRequest" {
1092 // To suppress missing implicit constructor warnings.
1093 factory Request._() { throw new UnsupportedError("Not supported"); }
1086 1094
1087 @DomName('IDBRequest.errorEvent') 1095 @DomName('IDBRequest.errorEvent')
1088 @DocsEditable 1096 @DocsEditable
1089 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider <Event>('error'); 1097 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider <Event>('error');
1090 1098
1091 @DomName('IDBRequest.successEvent') 1099 @DomName('IDBRequest.successEvent')
1092 @DocsEditable 1100 @DocsEditable
1093 static const EventStreamProvider<Event> successEvent = const EventStreamProvid er<Event>('success'); 1101 static const EventStreamProvider<Event> successEvent = const EventStreamProvid er<Event>('success');
1094 1102
1095 @DomName('IDBRequest.error') 1103 @DomName('IDBRequest.error')
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 completer.completeError(e); 1181 completer.completeError(e);
1174 }); 1182 });
1175 1183
1176 this.onAbort.first.then((e) { 1184 this.onAbort.first.then((e) {
1177 completer.completeError(e); 1185 completer.completeError(e);
1178 }); 1186 });
1179 1187
1180 return completer.future; 1188 return completer.future;
1181 } 1189 }
1182 1190
1191 // To suppress missing implicit constructor warnings.
1192 factory Transaction._() { throw new UnsupportedError("Not supported"); }
1183 1193
1184 @DomName('IDBTransaction.abortEvent') 1194 @DomName('IDBTransaction.abortEvent')
1185 @DocsEditable 1195 @DocsEditable
1186 static const EventStreamProvider<Event> abortEvent = const EventStreamProvider <Event>('abort'); 1196 static const EventStreamProvider<Event> abortEvent = const EventStreamProvider <Event>('abort');
1187 1197
1188 @DomName('IDBTransaction.completeEvent') 1198 @DomName('IDBTransaction.completeEvent')
1189 @DocsEditable 1199 @DocsEditable
1190 static const EventStreamProvider<Event> completeEvent = const EventStreamProvi der<Event>('complete'); 1200 static const EventStreamProvider<Event> completeEvent = const EventStreamProvi der<Event>('complete');
1191 1201
1192 @DomName('IDBTransaction.errorEvent') 1202 @DomName('IDBTransaction.errorEvent')
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 } 1260 }
1251 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1261 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
1252 // for details. All rights reserved. Use of this source code is governed by a 1262 // for details. All rights reserved. Use of this source code is governed by a
1253 // BSD-style license that can be found in the LICENSE file. 1263 // BSD-style license that can be found in the LICENSE file.
1254 1264
1255 1265
1256 @DocsEditable 1266 @DocsEditable
1257 @DomName('IDBVersionChangeEvent') 1267 @DomName('IDBVersionChangeEvent')
1258 @Unstable 1268 @Unstable
1259 class VersionChangeEvent extends Event native "IDBVersionChangeEvent" { 1269 class VersionChangeEvent extends Event native "IDBVersionChangeEvent" {
1270 // To suppress missing implicit constructor warnings.
1271 factory VersionChangeEvent._() { throw new UnsupportedError("Not supported"); }
1260 1272
1261 @DomName('IDBVersionChangeEvent.newVersion') 1273 @DomName('IDBVersionChangeEvent.newVersion')
1262 @DocsEditable 1274 @DocsEditable
1263 @Creates('int|String|Null') 1275 @Creates('int|String|Null')
1264 @Returns('int|String|Null') 1276 @Returns('int|String|Null')
1265 final dynamic newVersion; 1277 final dynamic newVersion;
1266 1278
1267 @DomName('IDBVersionChangeEvent.oldVersion') 1279 @DomName('IDBVersionChangeEvent.oldVersion')
1268 @DocsEditable 1280 @DocsEditable
1269 @Creates('int|String|Null') 1281 @Creates('int|String|Null')
1270 @Returns('int|String|Null') 1282 @Returns('int|String|Null')
1271 final dynamic oldVersion; 1283 final dynamic oldVersion;
1272 } 1284 }
1273 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1285 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
1274 // for details. All rights reserved. Use of this source code is governed by a 1286 // for details. All rights reserved. Use of this source code is governed by a
1275 // BSD-style license that can be found in the LICENSE file. 1287 // BSD-style license that can be found in the LICENSE file.
1276 1288
1277 1289
1278 @DocsEditable 1290 @DocsEditable
1279 @DomName('IDBAny') 1291 @DomName('IDBAny')
1280 @deprecated // nonstandard 1292 @deprecated // nonstandard
1281 abstract class _IDBAny native "IDBAny" { 1293 abstract class _IDBAny extends Interceptor native "IDBAny" {
1282 } 1294 }
OLDNEW
« no previous file with comments | « sdk/lib/html/html_common/html_common_dart2js.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