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

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

Issue 410823002: Revert "Use @Native annotation on dart2js DOM native classes" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | sdk/lib/svg/dart2js/svg_dart2js.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 * [IndexedDB reference](http://docs.webplatform.org/wiki/apis/indexeddb) 70 * [IndexedDB reference](http://docs.webplatform.org/wiki/apis/indexeddb)
71 * provides wiki-style docs about indexedDB 71 * provides wiki-style docs about indexedDB
72 */ 72 */
73 library dart.dom.indexed_db; 73 library dart.dom.indexed_db;
74 74
75 import 'dart:async'; 75 import 'dart:async';
76 import 'dart:html'; 76 import 'dart:html';
77 import 'dart:html_common'; 77 import 'dart:html_common';
78 import 'dart:_native_typed_data'; 78 import 'dart:_native_typed_data';
79 import 'dart:typed_data'; 79 import 'dart:typed_data';
80 import 'dart:_js_helper' show Creates, Returns, JSName, Native, Null; 80 import 'dart:_js_helper' show Creates, Returns, JSName, Null;
81 import 'dart:_foreign_helper' show JS; 81 import 'dart:_foreign_helper' show JS;
82 import 'dart:_interceptors' show Interceptor, JSExtendableArray; 82 import 'dart:_interceptors' show Interceptor, JSExtendableArray;
83 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 83 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
84 // for details. All rights reserved. Use of this source code is governed by a 84 // for details. All rights reserved. Use of this source code is governed by a
85 // BSD-style license that can be found in the LICENSE file. 85 // BSD-style license that can be found in the LICENSE file.
86 86
87 // DO NOT EDIT - unless you are editing documentation as per: 87 // DO NOT EDIT - unless you are editing documentation as per:
88 // https://code.google.com/p/dart/wiki/ContributingHTMLDocumentation 88 // https://code.google.com/p/dart/wiki/ContributingHTMLDocumentation
89 // Auto-generated dart:svg library. 89 // Auto-generated dart:svg library.
90 90
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 const String _idbKey = 'JSExtendableArray|=Object|num|String'; 206 const String _idbKey = 'JSExtendableArray|=Object|num|String';
207 const _annotation_Creates_IDBKey = const Creates(_idbKey); 207 const _annotation_Creates_IDBKey = const Creates(_idbKey);
208 const _annotation_Returns_IDBKey = const Returns(_idbKey); 208 const _annotation_Returns_IDBKey = const Returns(_idbKey);
209 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 209 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
210 // for details. All rights reserved. Use of this source code is governed by a 210 // for details. All rights reserved. Use of this source code is governed by a
211 // BSD-style license that can be found in the LICENSE file. 211 // BSD-style license that can be found in the LICENSE file.
212 212
213 213
214 @DomName('IDBCursor') 214 @DomName('IDBCursor')
215 @Unstable() 215 @Unstable()
216 @Native("IDBCursor") 216 class Cursor extends Interceptor native "IDBCursor" {
217 class Cursor extends Interceptor {
218 @DomName('IDBCursor.delete') 217 @DomName('IDBCursor.delete')
219 Future delete() { 218 Future delete() {
220 try { 219 try {
221 return _completeRequest(_delete()); 220 return _completeRequest(_delete());
222 } catch (e, stacktrace) { 221 } catch (e, stacktrace) {
223 return new Future.error(e, stacktrace); 222 return new Future.error(e, stacktrace);
224 } 223 }
225 } 224 }
226 225
227 @DomName('IDBCursor.value') 226 @DomName('IDBCursor.value')
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 293
295 } 294 }
296 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 295 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
297 // for details. All rights reserved. Use of this source code is governed by a 296 // for details. All rights reserved. Use of this source code is governed by a
298 // BSD-style license that can be found in the LICENSE file. 297 // BSD-style license that can be found in the LICENSE file.
299 298
300 299
301 @DocsEditable() 300 @DocsEditable()
302 @DomName('IDBCursorWithValue') 301 @DomName('IDBCursorWithValue')
303 @Unstable() 302 @Unstable()
304 @Native("IDBCursorWithValue") 303 class CursorWithValue extends Cursor native "IDBCursorWithValue" {
305 class CursorWithValue extends Cursor {
306 // To suppress missing implicit constructor warnings. 304 // To suppress missing implicit constructor warnings.
307 factory CursorWithValue._() { throw new UnsupportedError("Not supported"); } 305 factory CursorWithValue._() { throw new UnsupportedError("Not supported"); }
308 306
309 @DomName('IDBCursorWithValue.value') 307 @DomName('IDBCursorWithValue.value')
310 @DocsEditable() 308 @DocsEditable()
311 dynamic get value => _convertNativeToDart_IDBAny(this._get_value); 309 dynamic get value => _convertNativeToDart_IDBAny(this._get_value);
312 @JSName('value') 310 @JSName('value')
313 @DomName('IDBCursorWithValue.value') 311 @DomName('IDBCursorWithValue.value')
314 @DocsEditable() 312 @DocsEditable()
315 @annotation_Creates_SerializedScriptValue 313 @annotation_Creates_SerializedScriptValue
316 @annotation_Returns_SerializedScriptValue 314 @annotation_Returns_SerializedScriptValue
317 final dynamic _get_value; 315 final dynamic _get_value;
318 } 316 }
319 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 317 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
320 // for details. All rights reserved. Use of this source code is governed by a 318 // for details. All rights reserved. Use of this source code is governed by a
321 // BSD-style license that can be found in the LICENSE file. 319 // BSD-style license that can be found in the LICENSE file.
322 320
323 321
324 @DocsEditable() 322 @DocsEditable()
325 /** 323 /**
326 * An indexed database object for storing client-side data 324 * An indexed database object for storing client-side data
327 * in web apps. 325 * in web apps.
328 */ 326 */
329 @DomName('IDBDatabase') 327 @DomName('IDBDatabase')
330 @SupportedBrowser(SupportedBrowser.CHROME) 328 @SupportedBrowser(SupportedBrowser.CHROME)
331 @SupportedBrowser(SupportedBrowser.FIREFOX, '15') 329 @SupportedBrowser(SupportedBrowser.FIREFOX, '15')
332 @SupportedBrowser(SupportedBrowser.IE, '10') 330 @SupportedBrowser(SupportedBrowser.IE, '10')
333 @Experimental() 331 @Experimental()
334 @Unstable() 332 @Unstable()
335 @Native("IDBDatabase") 333 class Database extends EventTarget native "IDBDatabase" {
336 class Database extends EventTarget {
337 @DomName('IDBDatabase.createObjectStore') 334 @DomName('IDBDatabase.createObjectStore')
338 @DocsEditable() 335 @DocsEditable()
339 ObjectStore createObjectStore(String name, 336 ObjectStore createObjectStore(String name,
340 {String keyPath, bool autoIncrement}) { 337 {String keyPath, bool autoIncrement}) {
341 var options = {}; 338 var options = {};
342 if (keyPath != null) { 339 if (keyPath != null) {
343 options['keyPath'] = keyPath; 340 options['keyPath'] = keyPath;
344 } 341 }
345 if (autoIncrement != null) { 342 if (autoIncrement != null) {
346 options['autoIncrement'] = autoIncrement; 343 options['autoIncrement'] = autoIncrement;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 // 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
505 // BSD-style license that can be found in the LICENSE file. 502 // BSD-style license that can be found in the LICENSE file.
506 503
507 504
508 @DomName('IDBFactory') 505 @DomName('IDBFactory')
509 @SupportedBrowser(SupportedBrowser.CHROME) 506 @SupportedBrowser(SupportedBrowser.CHROME)
510 @SupportedBrowser(SupportedBrowser.FIREFOX, '15') 507 @SupportedBrowser(SupportedBrowser.FIREFOX, '15')
511 @SupportedBrowser(SupportedBrowser.IE, '10') 508 @SupportedBrowser(SupportedBrowser.IE, '10')
512 @Experimental() 509 @Experimental()
513 @Unstable() 510 @Unstable()
514 @Native("IDBFactory") 511 class IdbFactory extends Interceptor native "IDBFactory" {
515 class IdbFactory extends Interceptor {
516 /** 512 /**
517 * Checks to see if Indexed DB is supported on the current platform. 513 * Checks to see if Indexed DB is supported on the current platform.
518 */ 514 */
519 static bool get supported { 515 static bool get supported {
520 return JS('bool', 516 return JS('bool',
521 '!!(window.indexedDB || ' 517 '!!(window.indexedDB || '
522 'window.webkitIndexedDB || ' 518 'window.webkitIndexedDB || '
523 'window.mozIndexedDB)'); 519 'window.mozIndexedDB)');
524 } 520 }
525 521
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 request.onError.listen(completer.completeError); 636 request.onError.listen(completer.completeError);
641 return completer.future; 637 return completer.future;
642 } 638 }
643 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 639 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
644 // for details. All rights reserved. Use of this source code is governed by a 640 // for details. All rights reserved. Use of this source code is governed by a
645 // BSD-style license that can be found in the LICENSE file. 641 // BSD-style license that can be found in the LICENSE file.
646 642
647 643
648 @DomName('IDBIndex') 644 @DomName('IDBIndex')
649 @Unstable() 645 @Unstable()
650 @Native("IDBIndex") 646 class Index extends Interceptor native "IDBIndex" {
651 class Index extends Interceptor {
652 @DomName('IDBIndex.count') 647 @DomName('IDBIndex.count')
653 Future<int> count([key_OR_range]) { 648 Future<int> count([key_OR_range]) {
654 try { 649 try {
655 var request = _count(key_OR_range); 650 var request = _count(key_OR_range);
656 return _completeRequest(request); 651 return _completeRequest(request);
657 } catch (e, stacktrace) { 652 } catch (e, stacktrace) {
658 return new Future.error(e, stacktrace); 653 return new Future.error(e, stacktrace);
659 } 654 }
660 } 655 }
661 656
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 Request _openKeyCursor(Object key, [String direction]) native; 793 Request _openKeyCursor(Object key, [String direction]) native;
799 794
800 } 795 }
801 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 796 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
802 // for details. All rights reserved. Use of this source code is governed by a 797 // for details. All rights reserved. Use of this source code is governed by a
803 // BSD-style license that can be found in the LICENSE file. 798 // BSD-style license that can be found in the LICENSE file.
804 799
805 800
806 @DomName('IDBKeyRange') 801 @DomName('IDBKeyRange')
807 @Unstable() 802 @Unstable()
808 @Native("IDBKeyRange") 803 class KeyRange extends Interceptor native "IDBKeyRange" {
809 class KeyRange extends Interceptor {
810 @DomName('IDBKeyRange.only') 804 @DomName('IDBKeyRange.only')
811 factory KeyRange.only(/*Key*/ value) => 805 factory KeyRange.only(/*Key*/ value) =>
812 _KeyRangeFactoryProvider.createKeyRange_only(value); 806 _KeyRangeFactoryProvider.createKeyRange_only(value);
813 807
814 @DomName('IDBKeyRange.lowerBound') 808 @DomName('IDBKeyRange.lowerBound')
815 factory KeyRange.lowerBound(/*Key*/ bound, [bool open = false]) => 809 factory KeyRange.lowerBound(/*Key*/ bound, [bool open = false]) =>
816 _KeyRangeFactoryProvider.createKeyRange_lowerBound(bound, open); 810 _KeyRangeFactoryProvider.createKeyRange_lowerBound(bound, open);
817 811
818 @DomName('IDBKeyRange.upperBound') 812 @DomName('IDBKeyRange.upperBound')
819 factory KeyRange.upperBound(/*Key*/ bound, [bool open = false]) => 813 factory KeyRange.upperBound(/*Key*/ bound, [bool open = false]) =>
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 static KeyRange upperBound_(Object bound, [bool open]) native; 861 static KeyRange upperBound_(Object bound, [bool open]) native;
868 862
869 } 863 }
870 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 864 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
871 // for details. All rights reserved. Use of this source code is governed by a 865 // for details. All rights reserved. Use of this source code is governed by a
872 // BSD-style license that can be found in the LICENSE file. 866 // BSD-style license that can be found in the LICENSE file.
873 867
874 868
875 @DomName('IDBObjectStore') 869 @DomName('IDBObjectStore')
876 @Unstable() 870 @Unstable()
877 @Native("IDBObjectStore") 871 class ObjectStore extends Interceptor native "IDBObjectStore" {
878 class ObjectStore extends Interceptor {
879 872
880 @DomName('IDBObjectStore.add') 873 @DomName('IDBObjectStore.add')
881 Future add(value, [key]) { 874 Future add(value, [key]) {
882 try { 875 try {
883 var request; 876 var request;
884 if (key != null) { 877 if (key != null) {
885 request = _add(value, key); 878 request = _add(value, key);
886 } else { 879 } else {
887 request = _add(value); 880 request = _add(value);
888 } 881 }
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 } 1191 }
1199 } 1192 }
1200 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1193 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
1201 // for details. All rights reserved. Use of this source code is governed by a 1194 // for details. All rights reserved. Use of this source code is governed by a
1202 // BSD-style license that can be found in the LICENSE file. 1195 // BSD-style license that can be found in the LICENSE file.
1203 1196
1204 1197
1205 @DocsEditable() 1198 @DocsEditable()
1206 @DomName('IDBOpenDBRequest') 1199 @DomName('IDBOpenDBRequest')
1207 @Unstable() 1200 @Unstable()
1208 @Native("IDBOpenDBRequest,IDBVersionChangeRequest") 1201 class OpenDBRequest extends Request native "IDBOpenDBRequest,IDBVersionChangeReq uest" {
1209 class OpenDBRequest extends Request {
1210 // To suppress missing implicit constructor warnings. 1202 // To suppress missing implicit constructor warnings.
1211 factory OpenDBRequest._() { throw new UnsupportedError("Not supported"); } 1203 factory OpenDBRequest._() { throw new UnsupportedError("Not supported"); }
1212 1204
1213 /** 1205 /**
1214 * Static factory designed to expose `blocked` events to event 1206 * Static factory designed to expose `blocked` events to event
1215 * handlers that are not necessarily instances of [OpenDBRequest]. 1207 * handlers that are not necessarily instances of [OpenDBRequest].
1216 * 1208 *
1217 * See [EventStreamProvider] for usage information. 1209 * See [EventStreamProvider] for usage information.
1218 */ 1210 */
1219 @DomName('IDBOpenDBRequest.blockedEvent') 1211 @DomName('IDBOpenDBRequest.blockedEvent')
(...skipping 21 matching lines...) Expand all
1241 Stream<VersionChangeEvent> get onUpgradeNeeded => upgradeNeededEvent.forTarget (this); 1233 Stream<VersionChangeEvent> get onUpgradeNeeded => upgradeNeededEvent.forTarget (this);
1242 } 1234 }
1243 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1235 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
1244 // for details. All rights reserved. Use of this source code is governed by a 1236 // for details. All rights reserved. Use of this source code is governed by a
1245 // BSD-style license that can be found in the LICENSE file. 1237 // BSD-style license that can be found in the LICENSE file.
1246 1238
1247 1239
1248 @DocsEditable() 1240 @DocsEditable()
1249 @DomName('IDBRequest') 1241 @DomName('IDBRequest')
1250 @Unstable() 1242 @Unstable()
1251 @Native("IDBRequest") 1243 class Request extends EventTarget native "IDBRequest" {
1252 class Request extends EventTarget {
1253 // To suppress missing implicit constructor warnings. 1244 // To suppress missing implicit constructor warnings.
1254 factory Request._() { throw new UnsupportedError("Not supported"); } 1245 factory Request._() { throw new UnsupportedError("Not supported"); }
1255 1246
1256 /** 1247 /**
1257 * Static factory designed to expose `error` events to event 1248 * Static factory designed to expose `error` events to event
1258 * handlers that are not necessarily instances of [Request]. 1249 * handlers that are not necessarily instances of [Request].
1259 * 1250 *
1260 * See [EventStreamProvider] for usage information. 1251 * See [EventStreamProvider] for usage information.
1261 */ 1252 */
1262 @DomName('IDBRequest.errorEvent') 1253 @DomName('IDBRequest.errorEvent')
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 @DocsEditable() 1300 @DocsEditable()
1310 Stream<Event> get onSuccess => successEvent.forTarget(this); 1301 Stream<Event> get onSuccess => successEvent.forTarget(this);
1311 } 1302 }
1312 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1303 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
1313 // for details. All rights reserved. Use of this source code is governed by a 1304 // for details. All rights reserved. Use of this source code is governed by a
1314 // BSD-style license that can be found in the LICENSE file. 1305 // BSD-style license that can be found in the LICENSE file.
1315 1306
1316 1307
1317 @DomName('IDBTransaction') 1308 @DomName('IDBTransaction')
1318 @Unstable() 1309 @Unstable()
1319 @Native("IDBTransaction") 1310 class Transaction extends EventTarget native "IDBTransaction" {
1320 class Transaction extends EventTarget {
1321 1311
1322 /** 1312 /**
1323 * Provides a Future which will be completed once the transaction has 1313 * Provides a Future which will be completed once the transaction has
1324 * completed. 1314 * completed.
1325 * 1315 *
1326 * The future will error if an error occurrs on the transaction or if the 1316 * The future will error if an error occurrs on the transaction or if the
1327 * transaction is aborted. 1317 * transaction is aborted.
1328 */ 1318 */
1329 Future<Database> get completed { 1319 Future<Database> get completed {
1330 var completer = new Completer<Database>(); 1320 var completer = new Completer<Database>();
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1417 1407
1418 } 1408 }
1419 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1409 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
1420 // for details. All rights reserved. Use of this source code is governed by a 1410 // for details. All rights reserved. Use of this source code is governed by a
1421 // BSD-style license that can be found in the LICENSE file. 1411 // BSD-style license that can be found in the LICENSE file.
1422 1412
1423 1413
1424 @DocsEditable() 1414 @DocsEditable()
1425 @DomName('IDBVersionChangeEvent') 1415 @DomName('IDBVersionChangeEvent')
1426 @Unstable() 1416 @Unstable()
1427 @Native("IDBVersionChangeEvent") 1417 class VersionChangeEvent extends Event native "IDBVersionChangeEvent" {
1428 class VersionChangeEvent extends Event {
1429 // To suppress missing implicit constructor warnings. 1418 // To suppress missing implicit constructor warnings.
1430 factory VersionChangeEvent._() { throw new UnsupportedError("Not supported"); } 1419 factory VersionChangeEvent._() { throw new UnsupportedError("Not supported"); }
1431 1420
1432 @DomName('IDBVersionChangeEvent.dataLoss') 1421 @DomName('IDBVersionChangeEvent.dataLoss')
1433 @DocsEditable() 1422 @DocsEditable()
1434 @Experimental() // untriaged 1423 @Experimental() // untriaged
1435 final String dataLoss; 1424 final String dataLoss;
1436 1425
1437 @DomName('IDBVersionChangeEvent.dataLossMessage') 1426 @DomName('IDBVersionChangeEvent.dataLossMessage')
1438 @DocsEditable() 1427 @DocsEditable()
1439 @Experimental() // untriaged 1428 @Experimental() // untriaged
1440 final String dataLossMessage; 1429 final String dataLossMessage;
1441 1430
1442 @DomName('IDBVersionChangeEvent.newVersion') 1431 @DomName('IDBVersionChangeEvent.newVersion')
1443 @DocsEditable() 1432 @DocsEditable()
1444 @Creates('int|String|Null') 1433 @Creates('int|String|Null')
1445 @Returns('int|String|Null') 1434 @Returns('int|String|Null')
1446 final Object newVersion; 1435 final Object newVersion;
1447 1436
1448 @DomName('IDBVersionChangeEvent.oldVersion') 1437 @DomName('IDBVersionChangeEvent.oldVersion')
1449 @DocsEditable() 1438 @DocsEditable()
1450 @Creates('int|String|Null') 1439 @Creates('int|String|Null')
1451 @Returns('int|String|Null') 1440 @Returns('int|String|Null')
1452 final Object oldVersion; 1441 final Object oldVersion;
1453 } 1442 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | sdk/lib/svg/dart2js/svg_dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698