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

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

Issue 1392723003: Switch dart:html objects not to be NativeFieldWrapper subclasses with JsInterop (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | sdk/lib/js/dartium/js_dartium.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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 'IDBVersionChangeEvent': () => VersionChangeEvent.internalCreateVersionChangeE vent, 138 'IDBVersionChangeEvent': () => VersionChangeEvent.internalCreateVersionChangeE vent,
139 139
140 }; 140 };
141 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 141 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
142 // for details. All rights reserved. Use of this source code is governed by a 142 // for details. All rights reserved. Use of this source code is governed by a
143 // BSD-style license that can be found in the LICENSE file. 143 // BSD-style license that can be found in the LICENSE file.
144 144
145 145
146 @DomName('IDBCursor') 146 @DomName('IDBCursor')
147 @Unstable() 147 @Unstable()
148 class Cursor extends NativeFieldWrapperClass2 { 148 class Cursor extends DartHtmlDomObject {
149 @DomName('IDBCursor.delete') 149 @DomName('IDBCursor.delete')
150 Future delete() { 150 Future delete() {
151 try { 151 try {
152 return _completeRequest(_delete()); 152 return _completeRequest(_delete());
153 } catch (e, stacktrace) { 153 } catch (e, stacktrace) {
154 return new Future.error(e, stacktrace); 154 return new Future.error(e, stacktrace);
155 } 155 }
156 } 156 }
157 157
158 @DomName('IDBCursor.value') 158 @DomName('IDBCursor.value')
159 Future update(value) { 159 Future update(value) {
160 try { 160 try {
161 return _completeRequest(_update(value)); 161 return _completeRequest(_update(value));
162 } catch (e, stacktrace) { 162 } catch (e, stacktrace) {
163 return new Future.error(e, stacktrace); 163 return new Future.error(e, stacktrace);
164 } 164 }
165 } 165 }
166 166
167 // To suppress missing implicit constructor warnings. 167 // To suppress missing implicit constructor warnings.
168 factory Cursor._() { throw new UnsupportedError("Not supported"); } 168 factory Cursor._() { throw new UnsupportedError("Not supported"); }
169 169
170 static Cursor internalCreateCursor() { 170 static Cursor internalCreateCursor() {
171 return new Cursor._internalWrap(); 171 return new Cursor._internalWrap();
172 } 172 }
173 173
174 js.JsObject blink_jsObject;
175
176 factory Cursor._internalWrap() { 174 factory Cursor._internalWrap() {
177 return new Cursor.internal_(); 175 return new Cursor.internal_();
178 } 176 }
179 177
180 Cursor.internal_() { } 178 Cursor.internal_() { }
181 179
182 bool operator ==(other) => unwrap_jso(other) == unwrap_jso(this) || identical( this, other); 180 bool operator ==(other) => unwrap_jso(other) == unwrap_jso(this) || identical( this, other);
183 int get hashCode => unwrap_jso(this).hashCode; 181 int get hashCode => unwrap_jso(this).hashCode;
184 182
185 @DomName('IDBCursor.direction') 183 @DomName('IDBCursor.direction')
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 // for details. All rights reserved. Use of this source code is governed by a 440 // for details. All rights reserved. Use of this source code is governed by a
443 // BSD-style license that can be found in the LICENSE file. 441 // BSD-style license that can be found in the LICENSE file.
444 442
445 443
446 @DomName('IDBFactory') 444 @DomName('IDBFactory')
447 @SupportedBrowser(SupportedBrowser.CHROME) 445 @SupportedBrowser(SupportedBrowser.CHROME)
448 @SupportedBrowser(SupportedBrowser.FIREFOX, '15') 446 @SupportedBrowser(SupportedBrowser.FIREFOX, '15')
449 @SupportedBrowser(SupportedBrowser.IE, '10') 447 @SupportedBrowser(SupportedBrowser.IE, '10')
450 @Experimental() 448 @Experimental()
451 @Unstable() 449 @Unstable()
452 class IdbFactory extends NativeFieldWrapperClass2 { 450 class IdbFactory extends DartHtmlDomObject {
453 /** 451 /**
454 * Checks to see if Indexed DB is supported on the current platform. 452 * Checks to see if Indexed DB is supported on the current platform.
455 */ 453 */
456 static bool get supported { 454 static bool get supported {
457 return true; 455 return true;
458 } 456 }
459 457
460 @DomName('IDBFactory.open') 458 @DomName('IDBFactory.open')
461 Future<Database> open(String name, 459 Future<Database> open(String name,
462 {int version, void onUpgradeNeeded(VersionChangeEvent), 460 {int version, void onUpgradeNeeded(VersionChangeEvent),
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 return true; 523 return true;
526 } 524 }
527 525
528 // To suppress missing implicit constructor warnings. 526 // To suppress missing implicit constructor warnings.
529 factory IdbFactory._() { throw new UnsupportedError("Not supported"); } 527 factory IdbFactory._() { throw new UnsupportedError("Not supported"); }
530 528
531 static IdbFactory internalCreateIdbFactory() { 529 static IdbFactory internalCreateIdbFactory() {
532 return new IdbFactory._internalWrap(); 530 return new IdbFactory._internalWrap();
533 } 531 }
534 532
535 js.JsObject blink_jsObject;
536
537 factory IdbFactory._internalWrap() { 533 factory IdbFactory._internalWrap() {
538 return new IdbFactory.internal_(); 534 return new IdbFactory.internal_();
539 } 535 }
540 536
541 IdbFactory.internal_() { } 537 IdbFactory.internal_() { }
542 538
543 bool operator ==(other) => unwrap_jso(other) == unwrap_jso(this) || identical( this, other); 539 bool operator ==(other) => unwrap_jso(other) == unwrap_jso(this) || identical( this, other);
544 int get hashCode => unwrap_jso(this).hashCode; 540 int get hashCode => unwrap_jso(this).hashCode;
545 541
546 @DomName('IDBFactory.cmp') 542 @DomName('IDBFactory.cmp')
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 request.onError.listen(completer.completeError); 578 request.onError.listen(completer.completeError);
583 return completer.future; 579 return completer.future;
584 } 580 }
585 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 581 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
586 // for details. All rights reserved. Use of this source code is governed by a 582 // for details. All rights reserved. Use of this source code is governed by a
587 // BSD-style license that can be found in the LICENSE file. 583 // BSD-style license that can be found in the LICENSE file.
588 584
589 585
590 @DomName('IDBIndex') 586 @DomName('IDBIndex')
591 @Unstable() 587 @Unstable()
592 class Index extends NativeFieldWrapperClass2 { 588 class Index extends DartHtmlDomObject {
593 @DomName('IDBIndex.count') 589 @DomName('IDBIndex.count')
594 Future<int> count([key_OR_range]) { 590 Future<int> count([key_OR_range]) {
595 try { 591 try {
596 var request = _count(key_OR_range); 592 var request = _count(key_OR_range);
597 return _completeRequest(request); 593 return _completeRequest(request);
598 } catch (e, stacktrace) { 594 } catch (e, stacktrace) {
599 return new Future.error(e, stacktrace); 595 return new Future.error(e, stacktrace);
600 } 596 }
601 } 597 }
602 598
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 return ObjectStore._cursorStreamFromResult(request, autoAdvance); 674 return ObjectStore._cursorStreamFromResult(request, autoAdvance);
679 } 675 }
680 676
681 // To suppress missing implicit constructor warnings. 677 // To suppress missing implicit constructor warnings.
682 factory Index._() { throw new UnsupportedError("Not supported"); } 678 factory Index._() { throw new UnsupportedError("Not supported"); }
683 679
684 static Index internalCreateIndex() { 680 static Index internalCreateIndex() {
685 return new Index._internalWrap(); 681 return new Index._internalWrap();
686 } 682 }
687 683
688 js.JsObject blink_jsObject;
689
690 factory Index._internalWrap() { 684 factory Index._internalWrap() {
691 return new Index.internal_(); 685 return new Index.internal_();
692 } 686 }
693 687
694 Index.internal_() { } 688 Index.internal_() { }
695 689
696 bool operator ==(other) => unwrap_jso(other) == unwrap_jso(this) || identical( this, other); 690 bool operator ==(other) => unwrap_jso(other) == unwrap_jso(this) || identical( this, other);
697 int get hashCode => unwrap_jso(this).hashCode; 691 int get hashCode => unwrap_jso(this).hashCode;
698 692
699 @DomName('IDBIndex.keyPath') 693 @DomName('IDBIndex.keyPath')
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 } 737 }
744 738
745 } 739 }
746 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 740 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
747 // for details. All rights reserved. Use of this source code is governed by a 741 // for details. All rights reserved. Use of this source code is governed by a
748 // BSD-style license that can be found in the LICENSE file. 742 // BSD-style license that can be found in the LICENSE file.
749 743
750 744
751 @DomName('IDBKeyRange') 745 @DomName('IDBKeyRange')
752 @Unstable() 746 @Unstable()
753 class KeyRange extends NativeFieldWrapperClass2 { 747 class KeyRange extends DartHtmlDomObject {
754 @DomName('IDBKeyRange.only') 748 @DomName('IDBKeyRange.only')
755 factory KeyRange.only(/*Key*/ value) => 749 factory KeyRange.only(/*Key*/ value) =>
756 _KeyRangeFactoryProvider.createKeyRange_only(value); 750 _KeyRangeFactoryProvider.createKeyRange_only(value);
757 751
758 @DomName('IDBKeyRange.lowerBound') 752 @DomName('IDBKeyRange.lowerBound')
759 factory KeyRange.lowerBound(/*Key*/ bound, [bool open = false]) => 753 factory KeyRange.lowerBound(/*Key*/ bound, [bool open = false]) =>
760 _KeyRangeFactoryProvider.createKeyRange_lowerBound(bound, open); 754 _KeyRangeFactoryProvider.createKeyRange_lowerBound(bound, open);
761 755
762 @DomName('IDBKeyRange.upperBound') 756 @DomName('IDBKeyRange.upperBound')
763 factory KeyRange.upperBound(/*Key*/ bound, [bool open = false]) => 757 factory KeyRange.upperBound(/*Key*/ bound, [bool open = false]) =>
764 _KeyRangeFactoryProvider.createKeyRange_upperBound(bound, open); 758 _KeyRangeFactoryProvider.createKeyRange_upperBound(bound, open);
765 759
766 @DomName('KeyRange.bound') 760 @DomName('KeyRange.bound')
767 factory KeyRange.bound(/*Key*/ lower, /*Key*/ upper, 761 factory KeyRange.bound(/*Key*/ lower, /*Key*/ upper,
768 [bool lowerOpen = false, bool upperOpen = false]) => 762 [bool lowerOpen = false, bool upperOpen = false]) =>
769 _KeyRangeFactoryProvider.createKeyRange_bound( 763 _KeyRangeFactoryProvider.createKeyRange_bound(
770 lower, upper, lowerOpen, upperOpen); 764 lower, upper, lowerOpen, upperOpen);
771 765
772 // To suppress missing implicit constructor warnings. 766 // To suppress missing implicit constructor warnings.
773 factory KeyRange._() { throw new UnsupportedError("Not supported"); } 767 factory KeyRange._() { throw new UnsupportedError("Not supported"); }
774 768
775 static KeyRange internalCreateKeyRange() { 769 static KeyRange internalCreateKeyRange() {
776 return new KeyRange._internalWrap(); 770 return new KeyRange._internalWrap();
777 } 771 }
778 772
779 js.JsObject blink_jsObject;
780
781 factory KeyRange._internalWrap() { 773 factory KeyRange._internalWrap() {
782 return new KeyRange.internal_(); 774 return new KeyRange.internal_();
783 } 775 }
784 776
785 KeyRange.internal_() { } 777 KeyRange.internal_() { }
786 778
787 bool operator ==(other) => unwrap_jso(other) == unwrap_jso(this) || identical( this, other); 779 bool operator ==(other) => unwrap_jso(other) == unwrap_jso(this) || identical( this, other);
788 int get hashCode => unwrap_jso(this).hashCode; 780 int get hashCode => unwrap_jso(this).hashCode;
789 781
790 @DomName('IDBKeyRange.lower') 782 @DomName('IDBKeyRange.lower')
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 } 825 }
834 826
835 } 827 }
836 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 828 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
837 // for details. All rights reserved. Use of this source code is governed by a 829 // for details. All rights reserved. Use of this source code is governed by a
838 // BSD-style license that can be found in the LICENSE file. 830 // BSD-style license that can be found in the LICENSE file.
839 831
840 832
841 @DomName('IDBObjectStore') 833 @DomName('IDBObjectStore')
842 @Unstable() 834 @Unstable()
843 class ObjectStore extends NativeFieldWrapperClass2 { 835 class ObjectStore extends DartHtmlDomObject {
844 836
845 @DomName('IDBObjectStore.add') 837 @DomName('IDBObjectStore.add')
846 Future add(value, [key]) { 838 Future add(value, [key]) {
847 try { 839 try {
848 var request; 840 var request;
849 if (key != null) { 841 if (key != null) {
850 request = _add(value, key); 842 request = _add(value, key);
851 } else { 843 } else {
852 request = _add(value); 844 request = _add(value);
853 } 845 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 return _createIndex(name, keyPath, options); 960 return _createIndex(name, keyPath, options);
969 } 961 }
970 962
971 // To suppress missing implicit constructor warnings. 963 // To suppress missing implicit constructor warnings.
972 factory ObjectStore._() { throw new UnsupportedError("Not supported"); } 964 factory ObjectStore._() { throw new UnsupportedError("Not supported"); }
973 965
974 static ObjectStore internalCreateObjectStore() { 966 static ObjectStore internalCreateObjectStore() {
975 return new ObjectStore._internalWrap(); 967 return new ObjectStore._internalWrap();
976 } 968 }
977 969
978 js.JsObject blink_jsObject;
979
980 factory ObjectStore._internalWrap() { 970 factory ObjectStore._internalWrap() {
981 return new ObjectStore.internal_(); 971 return new ObjectStore.internal_();
982 } 972 }
983 973
984 ObjectStore.internal_() { } 974 ObjectStore.internal_() { }
985 975
986 bool operator ==(other) => unwrap_jso(other) == unwrap_jso(this) || identical( this, other); 976 bool operator ==(other) => unwrap_jso(other) == unwrap_jso(this) || identical( this, other);
987 int get hashCode => unwrap_jso(this).hashCode; 977 int get hashCode => unwrap_jso(this).hashCode;
988 978
989 @DomName('IDBObjectStore.autoIncrement') 979 @DomName('IDBObjectStore.autoIncrement')
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 1382
1393 @DomName('IDBVersionChangeEvent.newVersion') 1383 @DomName('IDBVersionChangeEvent.newVersion')
1394 @DocsEditable() 1384 @DocsEditable()
1395 int get newVersion => _blink.BlinkIDBVersionChangeEvent.instance.newVersion_Ge tter_(unwrap_jso(this)); 1385 int get newVersion => _blink.BlinkIDBVersionChangeEvent.instance.newVersion_Ge tter_(unwrap_jso(this));
1396 1386
1397 @DomName('IDBVersionChangeEvent.oldVersion') 1387 @DomName('IDBVersionChangeEvent.oldVersion')
1398 @DocsEditable() 1388 @DocsEditable()
1399 int get oldVersion => _blink.BlinkIDBVersionChangeEvent.instance.oldVersion_Ge tter_(unwrap_jso(this)); 1389 int get oldVersion => _blink.BlinkIDBVersionChangeEvent.instance.oldVersion_Ge tter_(unwrap_jso(this));
1400 1390
1401 } 1391 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | sdk/lib/js/dartium/js_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698