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

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

Issue 17063007: Making all DOM types abstract and removing superfluous Dartium constructors. (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 // To suppress missing implicit constructor warnings.
162 factory Cursor._() { throw new UnsupportedError("Not supported"); }
163
162 @DomName('IDBCursor.direction') 164 @DomName('IDBCursor.direction')
163 @DocsEditable 165 @DocsEditable
164 final String direction; 166 final String direction;
165 167
166 @DomName('IDBCursor.key') 168 @DomName('IDBCursor.key')
167 @DocsEditable 169 @DocsEditable
168 @_annotation_Creates_IDBKey 170 @_annotation_Creates_IDBKey
169 @_annotation_Returns_IDBKey 171 @_annotation_Returns_IDBKey
170 final Object key; 172 final Object key;
171 173
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 211 }
210 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 212 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
211 // for details. All rights reserved. Use of this source code is governed by a 213 // for details. All rights reserved. Use of this source code is governed by a
212 // BSD-style license that can be found in the LICENSE file. 214 // BSD-style license that can be found in the LICENSE file.
213 215
214 216
215 @DocsEditable 217 @DocsEditable
216 @DomName('IDBCursorWithValue') 218 @DomName('IDBCursorWithValue')
217 @Unstable 219 @Unstable
218 class CursorWithValue extends Cursor native "IDBCursorWithValue" { 220 class CursorWithValue extends Cursor native "IDBCursorWithValue" {
221 // To suppress missing implicit constructor warnings.
222 factory CursorWithValue._() { throw new UnsupportedError("Not supported"); }
219 223
220 dynamic get value => _convertNativeToDart_IDBAny(this._get_value); 224 dynamic get value => _convertNativeToDart_IDBAny(this._get_value);
221 @JSName('value') 225 @JSName('value')
222 @DomName('IDBCursorWithValue.value') 226 @DomName('IDBCursorWithValue.value')
223 @DocsEditable 227 @DocsEditable
224 @annotation_Creates_SerializedScriptValue 228 @annotation_Creates_SerializedScriptValue
225 @annotation_Returns_SerializedScriptValue 229 @annotation_Returns_SerializedScriptValue
226 final dynamic _get_value; 230 final dynamic _get_value;
227 } 231 }
228 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 232 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 267
264 // Try and create a transaction with a string mode. Browsers that expect a 268 // Try and create a transaction with a string mode. Browsers that expect a
265 // numeric mode tend to convert the string into a number. This fails 269 // numeric mode tend to convert the string into a number. This fails
266 // silently, resulting in zero ('readonly'). 270 // silently, resulting in zero ('readonly').
267 return _transaction(storeName_OR_storeNames, mode); 271 return _transaction(storeName_OR_storeNames, mode);
268 } 272 }
269 273
270 @JSName('transaction') 274 @JSName('transaction')
271 Transaction _transaction(stores, mode) native; 275 Transaction _transaction(stores, mode) native;
272 276
277 // To suppress missing implicit constructor warnings.
278 factory Database._() { throw new UnsupportedError("Not supported"); }
273 279
274 @DomName('IDBDatabase.abortEvent') 280 @DomName('IDBDatabase.abortEvent')
275 @DocsEditable 281 @DocsEditable
276 static const EventStreamProvider<Event> abortEvent = const EventStreamProvider <Event>('abort'); 282 static const EventStreamProvider<Event> abortEvent = const EventStreamProvider <Event>('abort');
277 283
278 @DomName('IDBDatabase.errorEvent') 284 @DomName('IDBDatabase.errorEvent')
279 @DocsEditable 285 @DocsEditable
280 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider <Event>('error'); 286 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider <Event>('error');
281 287
282 @DomName('IDBDatabase.versionchangeEvent') 288 @DomName('IDBDatabase.versionchangeEvent')
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 } 443 }
438 444
439 /** 445 /**
440 * Checks to see if getDatabaseNames is supported by the current platform. 446 * Checks to see if getDatabaseNames is supported by the current platform.
441 */ 447 */
442 bool get supportsDatabaseNames { 448 bool get supportsDatabaseNames {
443 return supported && JS('bool', 449 return supported && JS('bool',
444 '!!(#.getDatabaseNames || #.webkitGetDatabaseNames)', this, this); 450 '!!(#.getDatabaseNames || #.webkitGetDatabaseNames)', this, this);
445 } 451 }
446 452
453 // To suppress missing implicit constructor warnings.
454 factory IdbFactory._() { throw new UnsupportedError("Not supported"); }
447 455
448 @DomName('IDBFactory.cmp') 456 @DomName('IDBFactory.cmp')
449 @DocsEditable 457 @DocsEditable
450 int cmp(Object first, Object second) native; 458 int cmp(Object first, Object second) native;
451 459
452 @JSName('deleteDatabase') 460 @JSName('deleteDatabase')
453 @DomName('IDBFactory.deleteDatabase') 461 @DomName('IDBFactory.deleteDatabase')
454 @DocsEditable 462 @DocsEditable
455 OpenDBRequest $dom_deleteDatabase(String name) native; 463 OpenDBRequest $dom_deleteDatabase(String name) native;
456 464
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 } 592 }
585 var request; 593 var request;
586 if (direction == null) { 594 if (direction == null) {
587 request = $dom_openKeyCursor(key_OR_range); 595 request = $dom_openKeyCursor(key_OR_range);
588 } else { 596 } else {
589 request = $dom_openKeyCursor(key_OR_range, direction); 597 request = $dom_openKeyCursor(key_OR_range, direction);
590 } 598 }
591 return ObjectStore._cursorStreamFromResult(request, autoAdvance); 599 return ObjectStore._cursorStreamFromResult(request, autoAdvance);
592 } 600 }
593 601
594 602 // To suppress missing implicit constructor warnings.
603 factory Index._() { throw new UnsupportedError("Not supported"); }
604
595 @DomName('IDBIndex.keyPath') 605 @DomName('IDBIndex.keyPath')
596 @DocsEditable 606 @DocsEditable
597 @annotation_Creates_SerializedScriptValue 607 @annotation_Creates_SerializedScriptValue
598 final dynamic keyPath; 608 final dynamic keyPath;
599 609
600 @DomName('IDBIndex.multiEntry') 610 @DomName('IDBIndex.multiEntry')
601 @DocsEditable 611 @DocsEditable
602 final bool multiEntry; 612 final bool multiEntry;
603 613
604 @DomName('IDBIndex.name') 614 @DomName('IDBIndex.name')
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 @DomName('IDBKeyRange.upperBound') 681 @DomName('IDBKeyRange.upperBound')
672 factory KeyRange.upperBound(/*Key*/ bound, [bool open = false]) => 682 factory KeyRange.upperBound(/*Key*/ bound, [bool open = false]) =>
673 _KeyRangeFactoryProvider.createKeyRange_upperBound(bound, open); 683 _KeyRangeFactoryProvider.createKeyRange_upperBound(bound, open);
674 684
675 @DomName('KeyRange.bound') 685 @DomName('KeyRange.bound')
676 factory KeyRange.bound(/*Key*/ lower, /*Key*/ upper, 686 factory KeyRange.bound(/*Key*/ lower, /*Key*/ upper,
677 [bool lowerOpen = false, bool upperOpen = false]) => 687 [bool lowerOpen = false, bool upperOpen = false]) =>
678 _KeyRangeFactoryProvider.createKeyRange_bound( 688 _KeyRangeFactoryProvider.createKeyRange_bound(
679 lower, upper, lowerOpen, upperOpen); 689 lower, upper, lowerOpen, upperOpen);
680 690
691 // To suppress missing implicit constructor warnings.
692 factory KeyRange._() { throw new UnsupportedError("Not supported"); }
681 693
682 @DomName('IDBKeyRange.lower') 694 @DomName('IDBKeyRange.lower')
683 @DocsEditable 695 @DocsEditable
684 @annotation_Creates_SerializedScriptValue 696 @annotation_Creates_SerializedScriptValue
685 final Object lower; 697 final Object lower;
686 698
687 @DomName('IDBKeyRange.lowerOpen') 699 @DomName('IDBKeyRange.lowerOpen')
688 @DocsEditable 700 @DocsEditable
689 final bool lowerOpen; 701 final bool lowerOpen;
690 702
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 if (unique != null) { 863 if (unique != null) {
852 options['unique'] = unique; 864 options['unique'] = unique;
853 } 865 }
854 if (multiEntry != null) { 866 if (multiEntry != null) {
855 options['multiEntry'] = multiEntry; 867 options['multiEntry'] = multiEntry;
856 } 868 }
857 869
858 return $dom_createIndex(name, keyPath, options); 870 return $dom_createIndex(name, keyPath, options);
859 } 871 }
860 872
873 // To suppress missing implicit constructor warnings.
874 factory ObjectStore._() { throw new UnsupportedError("Not supported"); }
861 875
862 @DomName('IDBObjectStore.autoIncrement') 876 @DomName('IDBObjectStore.autoIncrement')
863 @DocsEditable 877 @DocsEditable
864 final bool autoIncrement; 878 final bool autoIncrement;
865 879
866 @DomName('IDBObjectStore.indexNames') 880 @DomName('IDBObjectStore.indexNames')
867 @DocsEditable 881 @DocsEditable
868 @Returns('DomStringList') 882 @Returns('DomStringList')
869 @Creates('DomStringList') 883 @Creates('DomStringList')
870 final List<String> indexNames; 884 final List<String> indexNames;
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 } 1063 }
1050 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1064 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
1051 // for details. All rights reserved. Use of this source code is governed by a 1065 // for details. All rights reserved. Use of this source code is governed by a
1052 // BSD-style license that can be found in the LICENSE file. 1066 // BSD-style license that can be found in the LICENSE file.
1053 1067
1054 1068
1055 @DocsEditable 1069 @DocsEditable
1056 @DomName('IDBOpenDBRequest') 1070 @DomName('IDBOpenDBRequest')
1057 @Unstable 1071 @Unstable
1058 class OpenDBRequest extends Request implements EventTarget native "IDBOpenDBRequ est" { 1072 class OpenDBRequest extends Request implements EventTarget native "IDBOpenDBRequ est" {
1073 // To suppress missing implicit constructor warnings.
1074 factory OpenDBRequest._() { throw new UnsupportedError("Not supported"); }
1059 1075
1060 @DomName('IDBOpenDBRequest.blockedEvent') 1076 @DomName('IDBOpenDBRequest.blockedEvent')
1061 @DocsEditable 1077 @DocsEditable
1062 static const EventStreamProvider<Event> blockedEvent = const EventStreamProvid er<Event>('blocked'); 1078 static const EventStreamProvider<Event> blockedEvent = const EventStreamProvid er<Event>('blocked');
1063 1079
1064 @DomName('IDBOpenDBRequest.upgradeneededEvent') 1080 @DomName('IDBOpenDBRequest.upgradeneededEvent')
1065 @DocsEditable 1081 @DocsEditable
1066 static const EventStreamProvider<VersionChangeEvent> upgradeNeededEvent = cons t EventStreamProvider<VersionChangeEvent>('upgradeneeded'); 1082 static const EventStreamProvider<VersionChangeEvent> upgradeNeededEvent = cons t EventStreamProvider<VersionChangeEvent>('upgradeneeded');
1067 1083
1068 @DomName('IDBOpenDBRequest.onblocked') 1084 @DomName('IDBOpenDBRequest.onblocked')
1069 @DocsEditable 1085 @DocsEditable
1070 Stream<Event> get onBlocked => blockedEvent.forTarget(this); 1086 Stream<Event> get onBlocked => blockedEvent.forTarget(this);
1071 1087
1072 @DomName('IDBOpenDBRequest.onupgradeneeded') 1088 @DomName('IDBOpenDBRequest.onupgradeneeded')
1073 @DocsEditable 1089 @DocsEditable
1074 Stream<VersionChangeEvent> get onUpgradeNeeded => upgradeNeededEvent.forTarget (this); 1090 Stream<VersionChangeEvent> get onUpgradeNeeded => upgradeNeededEvent.forTarget (this);
1075 } 1091 }
1076 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1092 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
1077 // for details. All rights reserved. Use of this source code is governed by a 1093 // for details. All rights reserved. Use of this source code is governed by a
1078 // BSD-style license that can be found in the LICENSE file. 1094 // BSD-style license that can be found in the LICENSE file.
1079 1095
1080 1096
1081 @DocsEditable 1097 @DocsEditable
1082 @DomName('IDBRequest') 1098 @DomName('IDBRequest')
1083 @Unstable 1099 @Unstable
1084 class Request extends EventTarget native "IDBRequest" { 1100 class Request extends EventTarget native "IDBRequest" {
1101 // To suppress missing implicit constructor warnings.
1102 factory Request._() { throw new UnsupportedError("Not supported"); }
1085 1103
1086 @DomName('IDBRequest.errorEvent') 1104 @DomName('IDBRequest.errorEvent')
1087 @DocsEditable 1105 @DocsEditable
1088 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider <Event>('error'); 1106 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider <Event>('error');
1089 1107
1090 @DomName('IDBRequest.successEvent') 1108 @DomName('IDBRequest.successEvent')
1091 @DocsEditable 1109 @DocsEditable
1092 static const EventStreamProvider<Event> successEvent = const EventStreamProvid er<Event>('success'); 1110 static const EventStreamProvider<Event> successEvent = const EventStreamProvid er<Event>('success');
1093 1111
1094 @DomName('IDBRequest.error') 1112 @DomName('IDBRequest.error')
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 completer.completeError(e); 1190 completer.completeError(e);
1173 }); 1191 });
1174 1192
1175 this.onAbort.first.then((e) { 1193 this.onAbort.first.then((e) {
1176 completer.completeError(e); 1194 completer.completeError(e);
1177 }); 1195 });
1178 1196
1179 return completer.future; 1197 return completer.future;
1180 } 1198 }
1181 1199
1200 // To suppress missing implicit constructor warnings.
1201 factory Transaction._() { throw new UnsupportedError("Not supported"); }
1182 1202
1183 @DomName('IDBTransaction.abortEvent') 1203 @DomName('IDBTransaction.abortEvent')
1184 @DocsEditable 1204 @DocsEditable
1185 static const EventStreamProvider<Event> abortEvent = const EventStreamProvider <Event>('abort'); 1205 static const EventStreamProvider<Event> abortEvent = const EventStreamProvider <Event>('abort');
1186 1206
1187 @DomName('IDBTransaction.completeEvent') 1207 @DomName('IDBTransaction.completeEvent')
1188 @DocsEditable 1208 @DocsEditable
1189 static const EventStreamProvider<Event> completeEvent = const EventStreamProvi der<Event>('complete'); 1209 static const EventStreamProvider<Event> completeEvent = const EventStreamProvi der<Event>('complete');
1190 1210
1191 @DomName('IDBTransaction.errorEvent') 1211 @DomName('IDBTransaction.errorEvent')
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 } 1269 }
1250 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1270 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
1251 // for details. All rights reserved. Use of this source code is governed by a 1271 // for details. All rights reserved. Use of this source code is governed by a
1252 // BSD-style license that can be found in the LICENSE file. 1272 // BSD-style license that can be found in the LICENSE file.
1253 1273
1254 1274
1255 @DocsEditable 1275 @DocsEditable
1256 @DomName('IDBVersionChangeEvent') 1276 @DomName('IDBVersionChangeEvent')
1257 @Unstable 1277 @Unstable
1258 class VersionChangeEvent extends Event native "IDBVersionChangeEvent" { 1278 class VersionChangeEvent extends Event native "IDBVersionChangeEvent" {
1279 // To suppress missing implicit constructor warnings.
1280 factory VersionChangeEvent._() { throw new UnsupportedError("Not supported"); }
1259 1281
1260 @DomName('IDBVersionChangeEvent.newVersion') 1282 @DomName('IDBVersionChangeEvent.newVersion')
1261 @DocsEditable 1283 @DocsEditable
1262 @Creates('int|String|Null') 1284 @Creates('int|String|Null')
1263 @Returns('int|String|Null') 1285 @Returns('int|String|Null')
1264 final dynamic newVersion; 1286 final dynamic newVersion;
1265 1287
1266 @DomName('IDBVersionChangeEvent.oldVersion') 1288 @DomName('IDBVersionChangeEvent.oldVersion')
1267 @DocsEditable 1289 @DocsEditable
1268 @Creates('int|String|Null') 1290 @Creates('int|String|Null')
1269 @Returns('int|String|Null') 1291 @Returns('int|String|Null')
1270 final dynamic oldVersion; 1292 final dynamic oldVersion;
1271 } 1293 }
1272 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1294 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
1273 // for details. All rights reserved. Use of this source code is governed by a 1295 // for details. All rights reserved. Use of this source code is governed by a
1274 // BSD-style license that can be found in the LICENSE file. 1296 // BSD-style license that can be found in the LICENSE file.
1275 1297
1276 1298
1277 @DocsEditable 1299 @DocsEditable
1278 @DomName('IDBAny') 1300 @DomName('IDBAny')
1279 @deprecated // nonstandard 1301 @deprecated // nonstandard
1280 abstract class _IDBAny native "IDBAny" { 1302 abstract class _IDBAny native "IDBAny" {
1303 // To suppress missing implicit constructor warnings.
1304 factory _IDBAny._() { throw new UnsupportedError("Not supported"); }
1281 } 1305 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698