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

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

Issue 13973017: Revert "Revert "Allow multiple tags in native clause."" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 7 years, 8 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/dart2js/html_dart2js.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 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:typeddata'; 6 import 'dart:typeddata';
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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 const String _idbKey = '=List|=Object|num|String'; // TODO(sra): Add DateTime. 132 const String _idbKey = '=List|=Object|num|String'; // TODO(sra): Add DateTime.
133 const _annotation_Creates_IDBKey = const Creates(_idbKey); 133 const _annotation_Creates_IDBKey = const Creates(_idbKey);
134 const _annotation_Returns_IDBKey = const Returns(_idbKey); 134 const _annotation_Returns_IDBKey = const Returns(_idbKey);
135 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 135 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
136 // for details. All rights reserved. Use of this source code is governed by a 136 // for details. All rights reserved. Use of this source code is governed by a
137 // BSD-style license that can be found in the LICENSE file. 137 // BSD-style license that can be found in the LICENSE file.
138 138
139 139
140 @DomName('IDBCursor') 140 @DomName('IDBCursor')
141 class Cursor native "*IDBCursor" { 141 class Cursor native "IDBCursor" {
142 @DomName('IDBCursor.delete') 142 @DomName('IDBCursor.delete')
143 Future delete() { 143 Future delete() {
144 try { 144 try {
145 return _completeRequest($dom_delete()); 145 return _completeRequest($dom_delete());
146 } catch (e, stacktrace) { 146 } catch (e, stacktrace) {
147 return new Future.error(e, stacktrace); 147 return new Future.error(e, stacktrace);
148 } 148 }
149 } 149 }
150 150
151 @DomName('IDBCursor.value') 151 @DomName('IDBCursor.value')
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 Request _$dom_update_1(value) native; 202 Request _$dom_update_1(value) native;
203 203
204 } 204 }
205 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 205 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
206 // for details. All rights reserved. Use of this source code is governed by a 206 // for details. All rights reserved. Use of this source code is governed by a
207 // BSD-style license that can be found in the LICENSE file. 207 // BSD-style license that can be found in the LICENSE file.
208 208
209 209
210 @DocsEditable 210 @DocsEditable
211 @DomName('IDBCursorWithValue') 211 @DomName('IDBCursorWithValue')
212 class CursorWithValue extends Cursor native "*IDBCursorWithValue" { 212 class CursorWithValue extends Cursor native "IDBCursorWithValue" {
213 213
214 dynamic get value => _convertNativeToDart_IDBAny(this._get_value); 214 dynamic get value => _convertNativeToDart_IDBAny(this._get_value);
215 @JSName('value') 215 @JSName('value')
216 @DomName('IDBCursorWithValue.value') 216 @DomName('IDBCursorWithValue.value')
217 @DocsEditable 217 @DocsEditable
218 @annotation_Creates_SerializedScriptValue 218 @annotation_Creates_SerializedScriptValue
219 @annotation_Returns_SerializedScriptValue 219 @annotation_Returns_SerializedScriptValue
220 final dynamic _get_value; 220 final dynamic _get_value;
221 } 221 }
222 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 222 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
223 // for details. All rights reserved. Use of this source code is governed by a 223 // for details. All rights reserved. Use of this source code is governed by a
224 // BSD-style license that can be found in the LICENSE file. 224 // BSD-style license that can be found in the LICENSE file.
225 225
226 226
227 @DocsEditable 227 @DocsEditable
228 @DomName('IDBDatabase') 228 @DomName('IDBDatabase')
229 @SupportedBrowser(SupportedBrowser.CHROME) 229 @SupportedBrowser(SupportedBrowser.CHROME)
230 @SupportedBrowser(SupportedBrowser.FIREFOX, '15') 230 @SupportedBrowser(SupportedBrowser.FIREFOX, '15')
231 @SupportedBrowser(SupportedBrowser.IE, '10') 231 @SupportedBrowser(SupportedBrowser.IE, '10')
232 @Experimental 232 @Experimental
233 class Database extends EventTarget native "*IDBDatabase" { 233 class Database extends EventTarget native "IDBDatabase" {
234 @DomName('IDBDatabase.createObjectStore') 234 @DomName('IDBDatabase.createObjectStore')
235 @DocsEditable 235 @DocsEditable
236 ObjectStore createObjectStore(String name, 236 ObjectStore createObjectStore(String name,
237 {String keyPath, bool autoIncrement}) { 237 {String keyPath, bool autoIncrement}) {
238 var options = {}; 238 var options = {};
239 if (keyPath != null) { 239 if (keyPath != null) {
240 options['keyPath'] = keyPath; 240 options['keyPath'] = keyPath;
241 } 241 }
242 if (autoIncrement != null) { 242 if (autoIncrement != null) {
243 options['autoIncrement'] = autoIncrement; 243 options['autoIncrement'] = autoIncrement;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 345 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
346 // for details. All rights reserved. Use of this source code is governed by a 346 // for details. All rights reserved. Use of this source code is governed by a
347 // BSD-style license that can be found in the LICENSE file. 347 // BSD-style license that can be found in the LICENSE file.
348 348
349 349
350 @DomName('IDBFactory') 350 @DomName('IDBFactory')
351 @SupportedBrowser(SupportedBrowser.CHROME) 351 @SupportedBrowser(SupportedBrowser.CHROME)
352 @SupportedBrowser(SupportedBrowser.FIREFOX, '15') 352 @SupportedBrowser(SupportedBrowser.FIREFOX, '15')
353 @SupportedBrowser(SupportedBrowser.IE, '10') 353 @SupportedBrowser(SupportedBrowser.IE, '10')
354 @Experimental 354 @Experimental
355 class IdbFactory native "*IDBFactory" { 355 class IdbFactory native "IDBFactory" {
356 /** 356 /**
357 * Checks to see if Indexed DB is supported on the current platform. 357 * Checks to see if Indexed DB is supported on the current platform.
358 */ 358 */
359 static bool get supported { 359 static bool get supported {
360 return JS('bool', 360 return JS('bool',
361 '!!(window.indexedDB || ' 361 '!!(window.indexedDB || '
362 'window.webkitIndexedDB || ' 362 'window.webkitIndexedDB || '
363 'window.mozIndexedDB)'); 363 'window.mozIndexedDB)');
364 } 364 }
365 365
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 completer.completeError(e); 474 completer.completeError(e);
475 }); 475 });
476 return completer.future; 476 return completer.future;
477 } 477 }
478 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 478 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
479 // for details. All rights reserved. Use of this source code is governed by a 479 // for details. All rights reserved. Use of this source code is governed by a
480 // BSD-style license that can be found in the LICENSE file. 480 // BSD-style license that can be found in the LICENSE file.
481 481
482 482
483 @DomName('IDBIndex') 483 @DomName('IDBIndex')
484 class Index native "*IDBIndex" { 484 class Index native "IDBIndex" {
485 @DomName('IDBIndex.count') 485 @DomName('IDBIndex.count')
486 Future<int> count([key_OR_range]) { 486 Future<int> count([key_OR_range]) {
487 try { 487 try {
488 var request; 488 var request;
489 if (key_OR_range != null) { 489 if (key_OR_range != null) {
490 request = $dom_count(key_OR_range); 490 request = $dom_count(key_OR_range);
491 } else { 491 } else {
492 request = $dom_count(); 492 request = $dom_count();
493 } 493 }
494 return _completeRequest(request); 494 return _completeRequest(request);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 @Creates('Cursor') 632 @Creates('Cursor')
633 Request $dom_openKeyCursor([key_OR_range, String direction]) native; 633 Request $dom_openKeyCursor([key_OR_range, String direction]) native;
634 634
635 } 635 }
636 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 636 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
637 // for details. All rights reserved. Use of this source code is governed by a 637 // for details. All rights reserved. Use of this source code is governed by a
638 // BSD-style license that can be found in the LICENSE file. 638 // BSD-style license that can be found in the LICENSE file.
639 639
640 640
641 @DomName('IDBKeyRange') 641 @DomName('IDBKeyRange')
642 class KeyRange native "*IDBKeyRange" { 642 class KeyRange native "IDBKeyRange" {
643 @DomName('IDBKeyRange.only') 643 @DomName('IDBKeyRange.only')
644 factory KeyRange.only(/*Key*/ value) => 644 factory KeyRange.only(/*Key*/ value) =>
645 _KeyRangeFactoryProvider.createKeyRange_only(value); 645 _KeyRangeFactoryProvider.createKeyRange_only(value);
646 646
647 @DomName('IDBKeyRange.lowerBound') 647 @DomName('IDBKeyRange.lowerBound')
648 factory KeyRange.lowerBound(/*Key*/ bound, [bool open = false]) => 648 factory KeyRange.lowerBound(/*Key*/ bound, [bool open = false]) =>
649 _KeyRangeFactoryProvider.createKeyRange_lowerBound(bound, open); 649 _KeyRangeFactoryProvider.createKeyRange_lowerBound(bound, open);
650 650
651 @DomName('IDBKeyRange.upperBound') 651 @DomName('IDBKeyRange.upperBound')
652 factory KeyRange.upperBound(/*Key*/ bound, [bool open = false]) => 652 factory KeyRange.upperBound(/*Key*/ bound, [bool open = false]) =>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 @DocsEditable 695 @DocsEditable
696 static KeyRange upperBound_(Object bound, [bool open]) native; 696 static KeyRange upperBound_(Object bound, [bool open]) native;
697 697
698 } 698 }
699 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 699 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
700 // for details. All rights reserved. Use of this source code is governed by a 700 // for details. All rights reserved. Use of this source code is governed by a
701 // BSD-style license that can be found in the LICENSE file. 701 // BSD-style license that can be found in the LICENSE file.
702 702
703 703
704 @DomName('IDBObjectStore') 704 @DomName('IDBObjectStore')
705 class ObjectStore native "*IDBObjectStore" { 705 class ObjectStore native "IDBObjectStore" {
706 706
707 @DomName('IDBObjectStore.add') 707 @DomName('IDBObjectStore.add')
708 Future add(value, [key]) { 708 Future add(value, [key]) {
709 try { 709 try {
710 var request; 710 var request;
711 if (key != null) { 711 if (key != null) {
712 request = $dom_add(value, key); 712 request = $dom_add(value, key);
713 } else { 713 } else {
714 request = $dom_add(value); 714 request = $dom_add(value);
715 } 715 }
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 return controller.stream; 1023 return controller.stream;
1024 } 1024 }
1025 } 1025 }
1026 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1026 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
1027 // for details. All rights reserved. Use of this source code is governed by a 1027 // for details. All rights reserved. Use of this source code is governed by a
1028 // BSD-style license that can be found in the LICENSE file. 1028 // BSD-style license that can be found in the LICENSE file.
1029 1029
1030 1030
1031 @DocsEditable 1031 @DocsEditable
1032 @DomName('IDBOpenDBRequest') 1032 @DomName('IDBOpenDBRequest')
1033 class OpenDBRequest extends Request implements EventTarget native "*IDBOpenDBReq uest" { 1033 class OpenDBRequest extends Request implements EventTarget native "IDBOpenDBRequ est" {
1034 1034
1035 @DomName('IDBOpenDBRequest.blockedEvent') 1035 @DomName('IDBOpenDBRequest.blockedEvent')
1036 @DocsEditable 1036 @DocsEditable
1037 static const EventStreamProvider<Event> blockedEvent = const EventStreamProvid er<Event>('blocked'); 1037 static const EventStreamProvider<Event> blockedEvent = const EventStreamProvid er<Event>('blocked');
1038 1038
1039 @DomName('IDBOpenDBRequest.upgradeneededEvent') 1039 @DomName('IDBOpenDBRequest.upgradeneededEvent')
1040 @DocsEditable 1040 @DocsEditable
1041 static const EventStreamProvider<VersionChangeEvent> upgradeNeededEvent = cons t EventStreamProvider<VersionChangeEvent>('upgradeneeded'); 1041 static const EventStreamProvider<VersionChangeEvent> upgradeNeededEvent = cons t EventStreamProvider<VersionChangeEvent>('upgradeneeded');
1042 1042
1043 @DomName('IDBOpenDBRequest.onblocked') 1043 @DomName('IDBOpenDBRequest.onblocked')
1044 @DocsEditable 1044 @DocsEditable
1045 Stream<Event> get onBlocked => blockedEvent.forTarget(this); 1045 Stream<Event> get onBlocked => blockedEvent.forTarget(this);
1046 1046
1047 @DomName('IDBOpenDBRequest.onupgradeneeded') 1047 @DomName('IDBOpenDBRequest.onupgradeneeded')
1048 @DocsEditable 1048 @DocsEditable
1049 Stream<VersionChangeEvent> get onUpgradeNeeded => upgradeNeededEvent.forTarget (this); 1049 Stream<VersionChangeEvent> get onUpgradeNeeded => upgradeNeededEvent.forTarget (this);
1050 } 1050 }
1051 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1051 // 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 1052 // 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. 1053 // BSD-style license that can be found in the LICENSE file.
1054 1054
1055 1055
1056 @DocsEditable 1056 @DocsEditable
1057 @DomName('IDBRequest') 1057 @DomName('IDBRequest')
1058 class Request extends EventTarget native "*IDBRequest" { 1058 class Request extends EventTarget native "IDBRequest" {
1059 1059
1060 @DomName('IDBRequest.errorEvent') 1060 @DomName('IDBRequest.errorEvent')
1061 @DocsEditable 1061 @DocsEditable
1062 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider <Event>('error'); 1062 static const EventStreamProvider<Event> errorEvent = const EventStreamProvider <Event>('error');
1063 1063
1064 @DomName('IDBRequest.successEvent') 1064 @DomName('IDBRequest.successEvent')
1065 @DocsEditable 1065 @DocsEditable
1066 static const EventStreamProvider<Event> successEvent = const EventStreamProvid er<Event>('success'); 1066 static const EventStreamProvider<Event> successEvent = const EventStreamProvid er<Event>('success');
1067 1067
1068 @DomName('IDBRequest.error') 1068 @DomName('IDBRequest.error')
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 @DomName('IDBRequest.onsuccess') 1118 @DomName('IDBRequest.onsuccess')
1119 @DocsEditable 1119 @DocsEditable
1120 Stream<Event> get onSuccess => successEvent.forTarget(this); 1120 Stream<Event> get onSuccess => successEvent.forTarget(this);
1121 } 1121 }
1122 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1122 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
1123 // for details. All rights reserved. Use of this source code is governed by a 1123 // for details. All rights reserved. Use of this source code is governed by a
1124 // BSD-style license that can be found in the LICENSE file. 1124 // BSD-style license that can be found in the LICENSE file.
1125 1125
1126 1126
1127 @DomName('IDBTransaction') 1127 @DomName('IDBTransaction')
1128 class Transaction extends EventTarget native "*IDBTransaction" { 1128 class Transaction extends EventTarget native "IDBTransaction" {
1129 1129
1130 /** 1130 /**
1131 * Provides a Future which will be completed once the transaction has 1131 * Provides a Future which will be completed once the transaction has
1132 * completed. 1132 * completed.
1133 * 1133 *
1134 * The future will error if an error occurrs on the transaction or if the 1134 * The future will error if an error occurrs on the transaction or if the
1135 * transaction is aborted. 1135 * transaction is aborted.
1136 */ 1136 */
1137 Future<Database> get completed { 1137 Future<Database> get completed {
1138 var completer = new Completer<Database>(); 1138 var completer = new Completer<Database>();
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 Stream<Event> get onError => errorEvent.forTarget(this); 1220 Stream<Event> get onError => errorEvent.forTarget(this);
1221 1221
1222 } 1222 }
1223 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1223 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
1224 // for details. All rights reserved. Use of this source code is governed by a 1224 // for details. All rights reserved. Use of this source code is governed by a
1225 // BSD-style license that can be found in the LICENSE file. 1225 // BSD-style license that can be found in the LICENSE file.
1226 1226
1227 1227
1228 @DocsEditable 1228 @DocsEditable
1229 @DomName('IDBVersionChangeEvent') 1229 @DomName('IDBVersionChangeEvent')
1230 class VersionChangeEvent extends Event native "*IDBVersionChangeEvent" { 1230 class VersionChangeEvent extends Event native "IDBVersionChangeEvent" {
1231 1231
1232 @DomName('IDBVersionChangeEvent.newVersion') 1232 @DomName('IDBVersionChangeEvent.newVersion')
1233 @DocsEditable 1233 @DocsEditable
1234 final dynamic newVersion; 1234 final dynamic newVersion;
1235 1235
1236 @DomName('IDBVersionChangeEvent.oldVersion') 1236 @DomName('IDBVersionChangeEvent.oldVersion')
1237 @DocsEditable 1237 @DocsEditable
1238 final dynamic oldVersion; 1238 final dynamic oldVersion;
1239 } 1239 }
1240 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1240 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
1241 // for details. All rights reserved. Use of this source code is governed by a 1241 // for details. All rights reserved. Use of this source code is governed by a
1242 // BSD-style license that can be found in the LICENSE file. 1242 // BSD-style license that can be found in the LICENSE file.
1243 1243
1244 1244
1245 @DocsEditable 1245 @DocsEditable
1246 @DomName('IDBAny') 1246 @DomName('IDBAny')
1247 abstract class _IDBAny native "*IDBAny" { 1247 abstract class _IDBAny native "IDBAny" {
1248 } 1248 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | sdk/lib/svg/dart2js/svg_dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698