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

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

Issue 11620004: Removed READ_ONLY constants from IDBTransaction class (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « sdk/lib/html/templates/html/dart2js/impl_IDBDatabase.darttemplate ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 library indexed_db; 1 library indexed_db;
2 2
3 import 'dart:html'; 3 import 'dart:html';
4 import 'dart:html_common'; 4 import 'dart:html_common';
5 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 5 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
6 // for details. All rights reserved. Use of this source code is governed by a 6 // for details. All rights reserved. Use of this source code is governed by a
7 // BSD-style license that can be found in the LICENSE file. 7 // BSD-style license that can be found in the LICENSE file.
8 8
9 // DO NOT EDIT 9 // DO NOT EDIT
10 // Auto-generated dart:svg library. 10 // Auto-generated dart:svg library.
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 class Database extends EventTarget native "*IDBDatabase" { 198 class Database extends EventTarget native "*IDBDatabase" {
199 199
200 Transaction transaction(storeName_OR_storeNames, String mode) { 200 Transaction transaction(storeName_OR_storeNames, String mode) {
201 if (mode != 'readonly' && mode != 'readwrite') { 201 if (mode != 'readonly' && mode != 'readwrite') {
202 throw new ArgumentError(mode); 202 throw new ArgumentError(mode);
203 } 203 }
204 204
205 // TODO(sra): Ensure storeName_OR_storeNames is a string or List<String>, 205 // TODO(sra): Ensure storeName_OR_storeNames is a string or List<String>,
206 // and copy to JavaScript array if necessary. 206 // and copy to JavaScript array if necessary.
207 207
208 if (_transaction_fn != null) {
209 return _transaction_fn(this, storeName_OR_storeNames, mode);
210 }
211
212 // Try and create a transaction with a string mode. Browsers that expect a 208 // Try and create a transaction with a string mode. Browsers that expect a
213 // numeric mode tend to convert the string into a number. This fails 209 // numeric mode tend to convert the string into a number. This fails
214 // silently, resulting in zero ('readonly'). 210 // silently, resulting in zero ('readonly').
215 var txn = _transaction(storeName_OR_storeNames, mode); 211 return _transaction(storeName_OR_storeNames, mode);
216 if (_hasNumericMode(txn)) {
217 _transaction_fn = _transaction_numeric_mode;
218 txn = _transaction_fn(this, storeName_OR_storeNames, mode);
219 } else {
220 _transaction_fn = _transaction_string_mode;
221 }
222 return txn;
223 }
224
225 static Transaction _transaction_string_mode(Database db, stores, mode) {
226 return db._transaction(stores, mode);
227 }
228
229 static Transaction _transaction_numeric_mode(Database db, stores, mode) {
230 int intMode;
231 if (mode == 'readonly') intMode = Transaction.READ_ONLY;
232 if (mode == 'readwrite') intMode = Transaction.READ_WRITE;
233 return db._transaction(stores, intMode);
234 } 212 }
235 213
236 @JSName('transaction') 214 @JSName('transaction')
237 Transaction _transaction(stores, mode) native; 215 Transaction _transaction(stores, mode) native;
238 216
239 static bool _hasNumericMode(txn) =>
240 JS('bool', 'typeof(#.mode) === "number"', txn);
241
242 217
243 /// @domName EventTarget.addEventListener, EventTarget.removeEventListener, Ev entTarget.dispatchEvent; @docsEditable true 218 /// @domName EventTarget.addEventListener, EventTarget.removeEventListener, Ev entTarget.dispatchEvent; @docsEditable true
244 DatabaseEvents get on => 219 DatabaseEvents get on =>
245 new DatabaseEvents(this); 220 new DatabaseEvents(this);
246 221
247 /// @domName IDBDatabase.name; @docsEditable true 222 /// @domName IDBDatabase.name; @docsEditable true
248 final String name; 223 final String name;
249 224
250 /// @domName IDBDatabase.objectStoreNames; @docsEditable true 225 /// @domName IDBDatabase.objectStoreNames; @docsEditable true
251 @Returns('DomStringList') @Creates('DomStringList') 226 @Returns('DomStringList') @Creates('DomStringList')
(...skipping 30 matching lines...) Expand all
282 bool $dom_dispatchEvent(Event evt) native; 257 bool $dom_dispatchEvent(Event evt) native;
283 258
284 /// @domName IDBDatabase.removeEventListener; @docsEditable true 259 /// @domName IDBDatabase.removeEventListener; @docsEditable true
285 @JSName('removeEventListener') 260 @JSName('removeEventListener')
286 void $dom_removeEventListener(String type, EventListener listener, [bool useCa pture]) native; 261 void $dom_removeEventListener(String type, EventListener listener, [bool useCa pture]) native;
287 262
288 /// @domName IDBDatabase.setVersion; @docsEditable true 263 /// @domName IDBDatabase.setVersion; @docsEditable true
289 VersionChangeRequest setVersion(String version) native; 264 VersionChangeRequest setVersion(String version) native;
290 } 265 }
291 266
292 // TODO(sra): This should be a static member of IDBTransaction but dart2js
293 // can't handle that. Move it back after dart2js is completely done.
294 var _transaction_fn; // Assigned one of the static methods.
295
296 /// @docsEditable true 267 /// @docsEditable true
297 class DatabaseEvents extends Events { 268 class DatabaseEvents extends Events {
298 /// @docsEditable true 269 /// @docsEditable true
299 DatabaseEvents(EventTarget _ptr) : super(_ptr); 270 DatabaseEvents(EventTarget _ptr) : super(_ptr);
300 271
301 /// @docsEditable true 272 /// @docsEditable true
302 EventListenerList get abort => this['abort']; 273 EventListenerList get abort => this['abort'];
303 274
304 /// @docsEditable true 275 /// @docsEditable true
305 EventListenerList get error => this['error']; 276 EventListenerList get error => this['error'];
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 EventListenerList get blocked => this['blocked']; 1010 EventListenerList get blocked => this['blocked'];
1040 } 1011 }
1041 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1012 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
1042 // for details. All rights reserved. Use of this source code is governed by a 1013 // for details. All rights reserved. Use of this source code is governed by a
1043 // BSD-style license that can be found in the LICENSE file. 1014 // BSD-style license that can be found in the LICENSE file.
1044 1015
1045 1016
1046 /// @domName IDBAny; @docsEditable true 1017 /// @domName IDBAny; @docsEditable true
1047 class _Any native "*IDBAny" { 1018 class _Any native "*IDBAny" {
1048 } 1019 }
OLDNEW
« no previous file with comments | « sdk/lib/html/templates/html/dart2js/impl_IDBDatabase.darttemplate ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698