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

Side by Side Diff: sdk/lib/web_sql/dartium/web_sql_dartium.dart

Issue 1832713002: Optimize dartium dart:html bindings so real world application performance is acceptable. Improves d… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
1 /** 1 /**
2 * An API for storing data in the browser that can be queried with SQL. 2 * An API for storing data in the browser that can be queried with SQL.
3 * 3 *
4 * **Caution:** this specification is no longer actively maintained by the Web 4 * **Caution:** this specification is no longer actively maintained by the Web
5 * Applications Working Group and may be removed at any time. 5 * Applications Working Group and may be removed at any time.
6 * See [the W3C Web SQL Database specification](http://www.w3.org/TR/webdatabase /) 6 * See [the W3C Web SQL Database specification](http://www.w3.org/TR/webdatabase /)
7 * for more information. 7 * for more information.
8 * 8 *
9 * The [dart:indexed_db] APIs is a recommended alternatives. 9 * The [dart:indexed_db] APIs is a recommended alternatives.
10 */ 10 */
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 return new SqlDatabase._internalWrap(); 114 return new SqlDatabase._internalWrap();
115 } 115 }
116 116
117 factory SqlDatabase._internalWrap() { 117 factory SqlDatabase._internalWrap() {
118 return new SqlDatabase.internal_(); 118 return new SqlDatabase.internal_();
119 } 119 }
120 120
121 @Deprecated("Internal Use Only") 121 @Deprecated("Internal Use Only")
122 SqlDatabase.internal_() { } 122 SqlDatabase.internal_() { }
123 123
124 bool operator ==(other) => unwrap_jso(other) == unwrap_jso(this) || identical( this, other);
125 int get hashCode => unwrap_jso(this).hashCode;
126
127 /// Checks if this type is supported on the current platform. 124 /// Checks if this type is supported on the current platform.
128 static bool get supported => true; 125 static bool get supported => true;
129 126
130 @DomName('Database.version') 127 @DomName('Database.version')
131 @DocsEditable() 128 @DocsEditable()
132 String get version => _blink.BlinkDatabase.instance.version_Getter_(unwrap_jso (this)); 129 String get version => _blink.BlinkDatabase.instance.version_Getter_(this);
133 130
134 void changeVersion(String oldVersion, String newVersion, [SqlTransactionCallba ck callback, SqlTransactionErrorCallback errorCallback, VoidCallback successCall back]) { 131 void changeVersion(String oldVersion, String newVersion, [SqlTransactionCallba ck callback, SqlTransactionErrorCallback errorCallback, VoidCallback successCall back]) {
135 if (successCallback != null) { 132 if (successCallback != null) {
136 _blink.BlinkDatabase.instance.changeVersion_Callback_5_(unwrap_jso(this), oldVersion, newVersion, unwrap_jso((transaction) => callback(wrap_jso(transactio n))), unwrap_jso((error) => errorCallback(wrap_jso(error))), unwrap_jso(() => su ccessCallback())); 133 _blink.BlinkDatabase.instance.changeVersion_Callback_5_(this, oldVersion, newVersion, callback, errorCallback, successCallback);
137 return; 134 return;
138 } 135 }
139 if (errorCallback != null) { 136 if (errorCallback != null) {
140 _blink.BlinkDatabase.instance.changeVersion_Callback_4_(unwrap_jso(this), oldVersion, newVersion, unwrap_jso((transaction) => callback(wrap_jso(transactio n))), unwrap_jso((error) => errorCallback(wrap_jso(error)))); 137 _blink.BlinkDatabase.instance.changeVersion_Callback_4_(this, oldVersion, newVersion, callback, errorCallback);
141 return; 138 return;
142 } 139 }
143 if (callback != null) { 140 if (callback != null) {
144 _blink.BlinkDatabase.instance.changeVersion_Callback_3_(unwrap_jso(this), oldVersion, newVersion, unwrap_jso((transaction) => callback(wrap_jso(transactio n)))); 141 _blink.BlinkDatabase.instance.changeVersion_Callback_3_(this, oldVersion, newVersion, callback);
145 return; 142 return;
146 } 143 }
147 _blink.BlinkDatabase.instance.changeVersion_Callback_2_(unwrap_jso(this), ol dVersion, newVersion); 144 _blink.BlinkDatabase.instance.changeVersion_Callback_2_(this, oldVersion, ne wVersion);
148 return; 145 return;
149 } 146 }
150 147
151 void readTransaction(SqlTransactionCallback callback, [SqlTransactionErrorCall back errorCallback, VoidCallback successCallback]) { 148 void readTransaction(SqlTransactionCallback callback, [SqlTransactionErrorCall back errorCallback, VoidCallback successCallback]) {
152 if (successCallback != null) { 149 if (successCallback != null) {
153 _blink.BlinkDatabase.instance.readTransaction_Callback_3_(unwrap_jso(this) , unwrap_jso((transaction) => callback(wrap_jso(transaction))), unwrap_jso((erro r) => errorCallback(wrap_jso(error))), unwrap_jso(() => successCallback())); 150 _blink.BlinkDatabase.instance.readTransaction_Callback_3_(this, callback, errorCallback, successCallback);
154 return; 151 return;
155 } 152 }
156 if (errorCallback != null) { 153 if (errorCallback != null) {
157 _blink.BlinkDatabase.instance.readTransaction_Callback_2_(unwrap_jso(this) , unwrap_jso((transaction) => callback(wrap_jso(transaction))), unwrap_jso((erro r) => errorCallback(wrap_jso(error)))); 154 _blink.BlinkDatabase.instance.readTransaction_Callback_2_(this, callback, errorCallback);
158 return; 155 return;
159 } 156 }
160 _blink.BlinkDatabase.instance.readTransaction_Callback_1_(unwrap_jso(this), unwrap_jso((transaction) => callback(wrap_jso(transaction)))); 157 _blink.BlinkDatabase.instance.readTransaction_Callback_1_(this, callback);
161 return; 158 return;
162 } 159 }
163 160
164 void transaction(SqlTransactionCallback callback, [SqlTransactionErrorCallback errorCallback, VoidCallback successCallback]) { 161 void transaction(SqlTransactionCallback callback, [SqlTransactionErrorCallback errorCallback, VoidCallback successCallback]) {
165 if (successCallback != null) { 162 if (successCallback != null) {
166 _blink.BlinkDatabase.instance.transaction_Callback_3_(unwrap_jso(this), un wrap_jso((transaction) => callback(wrap_jso(transaction))), unwrap_jso((error) = > errorCallback(wrap_jso(error))), unwrap_jso(() => successCallback())); 163 _blink.BlinkDatabase.instance.transaction_Callback_3_(this, callback, erro rCallback, successCallback);
167 return; 164 return;
168 } 165 }
169 if (errorCallback != null) { 166 if (errorCallback != null) {
170 _blink.BlinkDatabase.instance.transaction_Callback_2_(unwrap_jso(this), un wrap_jso((transaction) => callback(wrap_jso(transaction))), unwrap_jso((error) = > errorCallback(wrap_jso(error)))); 167 _blink.BlinkDatabase.instance.transaction_Callback_2_(this, callback, erro rCallback);
171 return; 168 return;
172 } 169 }
173 _blink.BlinkDatabase.instance.transaction_Callback_1_(unwrap_jso(this), unwr ap_jso((transaction) => callback(wrap_jso(transaction)))); 170 _blink.BlinkDatabase.instance.transaction_Callback_1_(this, callback);
174 return; 171 return;
175 } 172 }
176 173
177 } 174 }
178 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 175 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
179 // for details. All rights reserved. Use of this source code is governed by a 176 // for details. All rights reserved. Use of this source code is governed by a
180 // BSD-style license that can be found in the LICENSE file. 177 // BSD-style license that can be found in the LICENSE file.
181 178
182 // WARNING: Do not edit - generated code. 179 // WARNING: Do not edit - generated code.
183 180
(...skipping 11 matching lines...) Expand all
195 return new SqlError._internalWrap(); 192 return new SqlError._internalWrap();
196 } 193 }
197 194
198 factory SqlError._internalWrap() { 195 factory SqlError._internalWrap() {
199 return new SqlError.internal_(); 196 return new SqlError.internal_();
200 } 197 }
201 198
202 @Deprecated("Internal Use Only") 199 @Deprecated("Internal Use Only")
203 SqlError.internal_() { } 200 SqlError.internal_() { }
204 201
205 bool operator ==(other) => unwrap_jso(other) == unwrap_jso(this) || identical( this, other);
206 int get hashCode => unwrap_jso(this).hashCode;
207
208 @DomName('SQLError.CONSTRAINT_ERR') 202 @DomName('SQLError.CONSTRAINT_ERR')
209 @DocsEditable() 203 @DocsEditable()
210 static const int CONSTRAINT_ERR = 6; 204 static const int CONSTRAINT_ERR = 6;
211 205
212 @DomName('SQLError.DATABASE_ERR') 206 @DomName('SQLError.DATABASE_ERR')
213 @DocsEditable() 207 @DocsEditable()
214 static const int DATABASE_ERR = 1; 208 static const int DATABASE_ERR = 1;
215 209
216 @DomName('SQLError.QUOTA_ERR') 210 @DomName('SQLError.QUOTA_ERR')
217 @DocsEditable() 211 @DocsEditable()
(...skipping 14 matching lines...) Expand all
232 @DomName('SQLError.UNKNOWN_ERR') 226 @DomName('SQLError.UNKNOWN_ERR')
233 @DocsEditable() 227 @DocsEditable()
234 static const int UNKNOWN_ERR = 0; 228 static const int UNKNOWN_ERR = 0;
235 229
236 @DomName('SQLError.VERSION_ERR') 230 @DomName('SQLError.VERSION_ERR')
237 @DocsEditable() 231 @DocsEditable()
238 static const int VERSION_ERR = 2; 232 static const int VERSION_ERR = 2;
239 233
240 @DomName('SQLError.code') 234 @DomName('SQLError.code')
241 @DocsEditable() 235 @DocsEditable()
242 int get code => _blink.BlinkSQLError.instance.code_Getter_(unwrap_jso(this)); 236 int get code => _blink.BlinkSQLError.instance.code_Getter_(this);
243 237
244 @DomName('SQLError.message') 238 @DomName('SQLError.message')
245 @DocsEditable() 239 @DocsEditable()
246 String get message => _blink.BlinkSQLError.instance.message_Getter_(unwrap_jso (this)); 240 String get message => _blink.BlinkSQLError.instance.message_Getter_(this);
247 241
248 } 242 }
249 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 243 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
250 // for details. All rights reserved. Use of this source code is governed by a 244 // for details. All rights reserved. Use of this source code is governed by a
251 // BSD-style license that can be found in the LICENSE file. 245 // BSD-style license that can be found in the LICENSE file.
252 246
253 // WARNING: Do not edit - generated code. 247 // WARNING: Do not edit - generated code.
254 248
255 249
256 @DocsEditable() 250 @DocsEditable()
257 @DomName('SQLResultSet') 251 @DomName('SQLResultSet')
258 // http://www.w3.org/TR/webdatabase/#sqlresultset 252 // http://www.w3.org/TR/webdatabase/#sqlresultset
259 @Experimental() // deprecated 253 @Experimental() // deprecated
260 class SqlResultSet extends DartHtmlDomObject { 254 class SqlResultSet extends DartHtmlDomObject {
261 // To suppress missing implicit constructor warnings. 255 // To suppress missing implicit constructor warnings.
262 factory SqlResultSet._() { throw new UnsupportedError("Not supported"); } 256 factory SqlResultSet._() { throw new UnsupportedError("Not supported"); }
263 257
264 @Deprecated("Internal Use Only") 258 @Deprecated("Internal Use Only")
265 static SqlResultSet internalCreateSqlResultSet() { 259 static SqlResultSet internalCreateSqlResultSet() {
266 return new SqlResultSet._internalWrap(); 260 return new SqlResultSet._internalWrap();
267 } 261 }
268 262
269 factory SqlResultSet._internalWrap() { 263 factory SqlResultSet._internalWrap() {
270 return new SqlResultSet.internal_(); 264 return new SqlResultSet.internal_();
271 } 265 }
272 266
273 @Deprecated("Internal Use Only") 267 @Deprecated("Internal Use Only")
274 SqlResultSet.internal_() { } 268 SqlResultSet.internal_() { }
275 269
276 bool operator ==(other) => unwrap_jso(other) == unwrap_jso(this) || identical( this, other);
277 int get hashCode => unwrap_jso(this).hashCode;
278
279 @DomName('SQLResultSet.insertId') 270 @DomName('SQLResultSet.insertId')
280 @DocsEditable() 271 @DocsEditable()
281 int get insertId => _blink.BlinkSQLResultSet.instance.insertId_Getter_(unwrap_ jso(this)); 272 int get insertId => _blink.BlinkSQLResultSet.instance.insertId_Getter_(this);
282 273
283 @DomName('SQLResultSet.rows') 274 @DomName('SQLResultSet.rows')
284 @DocsEditable() 275 @DocsEditable()
285 SqlResultSetRowList get rows => wrap_jso(_blink.BlinkSQLResultSet.instance.row s_Getter_(unwrap_jso(this))); 276 SqlResultSetRowList get rows => _blink.BlinkSQLResultSet.instance.rows_Getter_ (this);
286 277
287 @DomName('SQLResultSet.rowsAffected') 278 @DomName('SQLResultSet.rowsAffected')
288 @DocsEditable() 279 @DocsEditable()
289 int get rowsAffected => _blink.BlinkSQLResultSet.instance.rowsAffected_Getter_ (unwrap_jso(this)); 280 int get rowsAffected => _blink.BlinkSQLResultSet.instance.rowsAffected_Getter_ (this);
290 281
291 } 282 }
292 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 283 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
293 // for details. All rights reserved. Use of this source code is governed by a 284 // for details. All rights reserved. Use of this source code is governed by a
294 // BSD-style license that can be found in the LICENSE file. 285 // BSD-style license that can be found in the LICENSE file.
295 286
296 // WARNING: Do not edit - generated code. 287 // WARNING: Do not edit - generated code.
297 288
298 289
299 @DocsEditable() 290 @DocsEditable()
300 @DomName('SQLResultSetRowList') 291 @DomName('SQLResultSetRowList')
301 // http://www.w3.org/TR/webdatabase/#sqlresultsetrowlist 292 // http://www.w3.org/TR/webdatabase/#sqlresultsetrowlist
302 @Experimental() // deprecated 293 @Experimental() // deprecated
303 class SqlResultSetRowList extends DartHtmlDomObject with ListMixin<Map>, Immutab leListMixin<Map> implements List<Map> { 294 class SqlResultSetRowList extends DartHtmlDomObject with ListMixin<Map>, Immutab leListMixin<Map> implements List<Map> {
304 // To suppress missing implicit constructor warnings. 295 // To suppress missing implicit constructor warnings.
305 factory SqlResultSetRowList._() { throw new UnsupportedError("Not supported"); } 296 factory SqlResultSetRowList._() { throw new UnsupportedError("Not supported"); }
306 297
307 @Deprecated("Internal Use Only") 298 @Deprecated("Internal Use Only")
308 static SqlResultSetRowList internalCreateSqlResultSetRowList() { 299 static SqlResultSetRowList internalCreateSqlResultSetRowList() {
309 return new SqlResultSetRowList._internalWrap(); 300 return new SqlResultSetRowList._internalWrap();
310 } 301 }
311 302
312 factory SqlResultSetRowList._internalWrap() { 303 factory SqlResultSetRowList._internalWrap() {
313 return new SqlResultSetRowList.internal_(); 304 return new SqlResultSetRowList.internal_();
314 } 305 }
315 306
316 @Deprecated("Internal Use Only") 307 @Deprecated("Internal Use Only")
317 SqlResultSetRowList.internal_() { } 308 SqlResultSetRowList.internal_() { }
318 309
319 bool operator ==(other) => unwrap_jso(other) == unwrap_jso(this) || identical( this, other);
320 int get hashCode => unwrap_jso(this).hashCode;
321
322 @DomName('SQLResultSetRowList.length') 310 @DomName('SQLResultSetRowList.length')
323 @DocsEditable() 311 @DocsEditable()
324 int get length => _blink.BlinkSQLResultSetRowList.instance.length_Getter_(unwr ap_jso(this)); 312 int get length => _blink.BlinkSQLResultSetRowList.instance.length_Getter_(this );
325 313
326 Map operator[](int index) { 314 Map operator[](int index) {
327 if (index < 0 || index >= length) 315 if (index < 0 || index >= length)
328 throw new RangeError.index(index, this); 316 throw new RangeError.index(index, this);
329 return wrap_jso(_blink.BlinkSQLResultSetRowList.instance.item_Callback_1_(un wrap_jso(this), index)); 317 return _blink.BlinkSQLResultSetRowList.instance.item_Callback_1_(this, index );
330 } 318 }
331 319
332 Map _nativeIndexedGetter(int index) => wrap_jso(_blink.BlinkSQLResultSetRowLis t.instance.item_Callback_1_(unwrap_jso(this), index)); 320 Map _nativeIndexedGetter(int index) => _blink.BlinkSQLResultSetRowList.instanc e.item_Callback_1_(this, index);
333 321
334 void operator[]=(int index, Map value) { 322 void operator[]=(int index, Map value) {
335 throw new UnsupportedError("Cannot assign element of immutable List."); 323 throw new UnsupportedError("Cannot assign element of immutable List.");
336 } 324 }
337 // -- start List<Map> mixins. 325 // -- start List<Map> mixins.
338 // Map is the element type. 326 // Map is the element type.
339 327
340 328
341 set length(int value) { 329 set length(int value) {
342 throw new UnsupportedError("Cannot resize immutable List."); 330 throw new UnsupportedError("Cannot resize immutable List.");
(...skipping 21 matching lines...) Expand all
364 } 352 }
365 if (len == 0) throw new StateError("No elements"); 353 if (len == 0) throw new StateError("No elements");
366 throw new StateError("More than one element"); 354 throw new StateError("More than one element");
367 } 355 }
368 356
369 Map elementAt(int index) => this[index]; 357 Map elementAt(int index) => this[index];
370 // -- end List<Map> mixins. 358 // -- end List<Map> mixins.
371 359
372 @DomName('SQLResultSetRowList.item') 360 @DomName('SQLResultSetRowList.item')
373 @DocsEditable() 361 @DocsEditable()
374 Object item(int index) => wrap_jso(_blink.BlinkSQLResultSetRowList.instance.it em_Callback_1_(unwrap_jso(this), index)); 362 Object item(int index) => (_blink.BlinkSQLResultSetRowList.instance.item_Callb ack_1_(this, index));
375 363
376 } 364 }
377 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 365 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
378 // for details. All rights reserved. Use of this source code is governed by a 366 // for details. All rights reserved. Use of this source code is governed by a
379 // BSD-style license that can be found in the LICENSE file. 367 // BSD-style license that can be found in the LICENSE file.
380 368
381 // WARNING: Do not edit - generated code. 369 // WARNING: Do not edit - generated code.
382 370
383 371
384 @DocsEditable() 372 @DocsEditable()
(...skipping 12 matching lines...) Expand all
397 return new SqlTransaction._internalWrap(); 385 return new SqlTransaction._internalWrap();
398 } 386 }
399 387
400 factory SqlTransaction._internalWrap() { 388 factory SqlTransaction._internalWrap() {
401 return new SqlTransaction.internal_(); 389 return new SqlTransaction.internal_();
402 } 390 }
403 391
404 @Deprecated("Internal Use Only") 392 @Deprecated("Internal Use Only")
405 SqlTransaction.internal_() { } 393 SqlTransaction.internal_() { }
406 394
407 bool operator ==(other) => unwrap_jso(other) == unwrap_jso(this) || identical( this, other);
408 int get hashCode => unwrap_jso(this).hashCode;
409
410 void executeSql(String sqlStatement, [List arguments, SqlStatementCallback cal lback, SqlStatementErrorCallback errorCallback]) { 395 void executeSql(String sqlStatement, [List arguments, SqlStatementCallback cal lback, SqlStatementErrorCallback errorCallback]) {
411 if (errorCallback != null) { 396 if (errorCallback != null) {
412 _blink.BlinkSQLTransaction.instance.executeSql_Callback_4_(unwrap_jso(this ), sqlStatement, arguments, unwrap_jso((transaction, resultSet) => callback(wrap _jso(transaction), wrap_jso(resultSet))), unwrap_jso((transaction, error) => err orCallback(wrap_jso(transaction), wrap_jso(error)))); 397 _blink.BlinkSQLTransaction.instance.executeSql_Callback_4_(this, sqlStatem ent, arguments, callback, errorCallback);
413 return; 398 return;
414 } 399 }
415 if (callback != null) { 400 if (callback != null) {
416 _blink.BlinkSQLTransaction.instance.executeSql_Callback_3_(unwrap_jso(this ), sqlStatement, arguments, unwrap_jso((transaction, resultSet) => callback(wrap _jso(transaction), wrap_jso(resultSet)))); 401 _blink.BlinkSQLTransaction.instance.executeSql_Callback_3_(this, sqlStatem ent, arguments, callback);
417 return; 402 return;
418 } 403 }
419 if (arguments != null) { 404 if (arguments != null) {
420 _blink.BlinkSQLTransaction.instance.executeSql_Callback_2_(unwrap_jso(this ), sqlStatement, arguments); 405 _blink.BlinkSQLTransaction.instance.executeSql_Callback_2_(this, sqlStatem ent, arguments);
421 return; 406 return;
422 } 407 }
423 _blink.BlinkSQLTransaction.instance.executeSql_Callback_1_(unwrap_jso(this), sqlStatement); 408 _blink.BlinkSQLTransaction.instance.executeSql_Callback_1_(this, sqlStatemen t);
424 return; 409 return;
425 } 410 }
426 411
427 } 412 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698