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

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

Issue 1473443003: Switch IDB Database.transaction to use a template to do the right type conversions (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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/indexed_db/dart2js/indexed_db_dart2js.dart ('k') | tools/dom/scripts/htmlrenamer.py » ('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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 if (keyPath != null) { 285 if (keyPath != null) {
286 options['keyPath'] = keyPath; 286 options['keyPath'] = keyPath;
287 } 287 }
288 if (autoIncrement != null) { 288 if (autoIncrement != null) {
289 options['autoIncrement'] = autoIncrement; 289 options['autoIncrement'] = autoIncrement;
290 } 290 }
291 291
292 return _createObjectStore(name, options); 292 return _createObjectStore(name, options);
293 } 293 }
294 294
295 Transaction transaction(storeName_OR_storeNames, String mode) {
296 if (mode != 'readonly' && mode != 'readwrite') {
297 throw new ArgumentError("Invalid transaction mode $mode");
298 }
299 var names;
300 if (storeName_OR_storeNames == null) {
301 throw new ArgumentError("stores may not be null in transaction");
302 } else if (storeName_OR_storeNames is String || storeName_OR_storeNames is D omStringList) {
303 names = unwrap_jso(storeName_OR_storeNames);
304 } else if (storeName_OR_storeNames is List<String>) {
305 names = convertDartToNative_List(storeName_OR_storeNames);
306 } else {
307 throw new ArgumentError("Invalid store(s) $store_Name_OR_storeNames");
308 }
309
310 return wrap_jso(_blink.BlinkIDBDatabase.instance.transaction_Callback_2_(unw rap_jso(this), names, mode));
311 }
312
313 Transaction transactionList(List<String> storeNames, String mode) => transacti on(storeNames, mode);
314 Transaction transactionStores(List<String> storeNames, String mode) => transac tion(storeNames, mode);
315 Transaction transactionStore(String storeName, String mode) => transaction(sto reName, mode);
295 316
296 // To suppress missing implicit constructor warnings. 317 // To suppress missing implicit constructor warnings.
297 factory Database._() { throw new UnsupportedError("Not supported"); } 318 factory Database._() { throw new UnsupportedError("Not supported"); }
298 319
299 /** 320 /**
300 * Static factory designed to expose `abort` events to event 321 * Static factory designed to expose `abort` events to event
301 * handlers that are not necessarily instances of [Database]. 322 * handlers that are not necessarily instances of [Database].
302 * 323 *
303 * See [EventStreamProvider] for usage information. 324 * See [EventStreamProvider] for usage information.
304 */ 325 */
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 if (options != null) { 393 if (options != null) {
373 return wrap_jso(_blink.BlinkIDBDatabase.instance.createObjectStore_Callbac k_2_(unwrap_jso(this), name, convertDartToNative_Dictionary(options))); 394 return wrap_jso(_blink.BlinkIDBDatabase.instance.createObjectStore_Callbac k_2_(unwrap_jso(this), name, convertDartToNative_Dictionary(options)));
374 } 395 }
375 return wrap_jso(_blink.BlinkIDBDatabase.instance.createObjectStore_Callback_ 1_(unwrap_jso(this), name)); 396 return wrap_jso(_blink.BlinkIDBDatabase.instance.createObjectStore_Callback_ 1_(unwrap_jso(this), name));
376 } 397 }
377 398
378 @DomName('IDBDatabase.deleteObjectStore') 399 @DomName('IDBDatabase.deleteObjectStore')
379 @DocsEditable() 400 @DocsEditable()
380 void deleteObjectStore(String name) => _blink.BlinkIDBDatabase.instance.delete ObjectStore_Callback_1_(unwrap_jso(this), name); 401 void deleteObjectStore(String name) => _blink.BlinkIDBDatabase.instance.delete ObjectStore_Callback_1_(unwrap_jso(this), name);
381 402
382 Transaction transaction(storeName_OR_storeNames, [String mode]) {
383 if ((storeName_OR_storeNames is String || storeName_OR_storeNames == null) & & mode == null) {
384 return wrap_jso(_blink.BlinkIDBDatabase.instance.transaction_Callback_1_(u nwrap_jso(this), unwrap_jso(storeName_OR_storeNames)));
385 }
386 if ((mode is String || mode == null) && (storeName_OR_storeNames is String | | storeName_OR_storeNames == null)) {
387 return wrap_jso(_blink.BlinkIDBDatabase.instance.transaction_Callback_2_(u nwrap_jso(this), unwrap_jso(storeName_OR_storeNames), mode));
388 }
389 if ((storeName_OR_storeNames is List<String> || storeName_OR_storeNames == n ull) && mode == null) {
390 return wrap_jso(_blink.BlinkIDBDatabase.instance.transaction_Callback_1_(u nwrap_jso(this), unwrap_jso(storeName_OR_storeNames)));
391 }
392 if ((mode is String || mode == null) && (storeName_OR_storeNames is List<Str ing> || storeName_OR_storeNames == null)) {
393 return wrap_jso(_blink.BlinkIDBDatabase.instance.transaction_Callback_2_(u nwrap_jso(this), unwrap_jso(storeName_OR_storeNames), mode));
394 }
395 if ((storeName_OR_storeNames is DomStringList || storeName_OR_storeNames == null) && mode == null) {
396 return wrap_jso(_blink.BlinkIDBDatabase.instance.transaction_Callback_1_(u nwrap_jso(this), unwrap_jso(storeName_OR_storeNames)));
397 }
398 if ((mode is String || mode == null) && (storeName_OR_storeNames is DomStrin gList || storeName_OR_storeNames == null)) {
399 return wrap_jso(_blink.BlinkIDBDatabase.instance.transaction_Callback_2_(u nwrap_jso(this), unwrap_jso(storeName_OR_storeNames), mode));
400 }
401 throw new ArgumentError("Incorrect number or type of arguments");
402 }
403
404 Transaction transactionList(List<String> storeNames, [String mode]) {
405 if (mode != null) {
406 return wrap_jso(_blink.BlinkIDBDatabase.instance.transaction_Callback_2_(u nwrap_jso(this), convertDartToNative_StringArray(storeNames), mode));
407 }
408 return wrap_jso(_blink.BlinkIDBDatabase.instance.transaction_Callback_1_(unw rap_jso(this), convertDartToNative_StringArray(storeNames)));
409 }
410
411 Transaction transactionStore(String storeName, [String mode]) {
412 if (mode != null) {
413 return wrap_jso(_blink.BlinkIDBDatabase.instance.transaction_Callback_2_(u nwrap_jso(this), storeName, mode));
414 }
415 return wrap_jso(_blink.BlinkIDBDatabase.instance.transaction_Callback_1_(unw rap_jso(this), storeName));
416 }
417
418 Transaction transactionStores(List<String> storeNames, [String mode]) {
419 if (mode != null) {
420 return wrap_jso(_blink.BlinkIDBDatabase.instance.transaction_Callback_2_(u nwrap_jso(this), unwrap_jso(storeNames), mode));
421 }
422 return wrap_jso(_blink.BlinkIDBDatabase.instance.transaction_Callback_1_(unw rap_jso(this), unwrap_jso(storeNames)));
423 }
424
425 /// Stream of `abort` events handled by this [Database]. 403 /// Stream of `abort` events handled by this [Database].
426 @DomName('IDBDatabase.onabort') 404 @DomName('IDBDatabase.onabort')
427 @DocsEditable() 405 @DocsEditable()
428 Stream<Event> get onAbort => abortEvent.forTarget(this); 406 Stream<Event> get onAbort => abortEvent.forTarget(this);
429 407
430 /// Stream of `close` events handled by this [Database]. 408 /// Stream of `close` events handled by this [Database].
431 @DomName('IDBDatabase.onclose') 409 @DomName('IDBDatabase.onclose')
432 @DocsEditable() 410 @DocsEditable()
433 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=22540 411 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=22540
434 @Experimental() 412 @Experimental()
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 1384
1407 @DomName('IDBVersionChangeEvent.newVersion') 1385 @DomName('IDBVersionChangeEvent.newVersion')
1408 @DocsEditable() 1386 @DocsEditable()
1409 int get newVersion => _blink.BlinkIDBVersionChangeEvent.instance.newVersion_Ge tter_(unwrap_jso(this)); 1387 int get newVersion => _blink.BlinkIDBVersionChangeEvent.instance.newVersion_Ge tter_(unwrap_jso(this));
1410 1388
1411 @DomName('IDBVersionChangeEvent.oldVersion') 1389 @DomName('IDBVersionChangeEvent.oldVersion')
1412 @DocsEditable() 1390 @DocsEditable()
1413 int get oldVersion => _blink.BlinkIDBVersionChangeEvent.instance.oldVersion_Ge tter_(unwrap_jso(this)); 1391 int get oldVersion => _blink.BlinkIDBVersionChangeEvent.instance.oldVersion_Ge tter_(unwrap_jso(this));
1414 1392
1415 } 1393 }
OLDNEW
« no previous file with comments | « sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart ('k') | tools/dom/scripts/htmlrenamer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698